CS 194-26: Project 4A - Image Warping/Mosaicing!

Tejas Thvar, Fall 2021

Part 1 - Shoot the Pictures

3 sets of panorama photos are shown below, along with their correspondences. Correspondences were recoreded by using correspond.py, a script wrote using plt.ginput. Note that 7 correspondences were used to create a more pleasing panorama result. AE/AF exposure was locked between takes.







Part 2 - Recover Homographies

Homographies are calculated by computing the pointwise projection matrix of the respective sets of correspondences. This ends up taking the form of a matrix problem where the homography is the solution for the projection. The homography matrix was set up as according to the image below (source: https://towardsdatascience.com/estimating-a-homography-matrix-522c70ec4b2c). We set the last coordinate of the homography matrix, h33 to 1 and solve using OLS (overdetermined system).

->

Part 3 - Warp Images

Warps were done by calculating the homographies for the correpondence point values and warping the source image to the target. The canvas dimensions in the background were generated by calculating the warped coordinates and then creating the largest possible canvas necessary to hold all warped coordinates. The offsets to translate each image were similarly calculated by looking at the min warped coordinate and max warped coordinate (min was negative, indicating need for offset), and adjusting respectively. The warped images for the Berkeley landscape are shown below.



Part 4 - Image Rectification

In order to test that homography and warping was working correctly, the below images were rectified by seeing them in a front-view.







Part 5 - Blend Images into mosaic

In order to blend the images, a simple alpha blending procedure was used. Shown below are the masks used for the left and right image of the Berkeley landscape example - the gray part is representative of the overlapping sections of each image. I used a distance transform to obtain the individual masks and used a bitwise and to obtain the intersection. The results of said alpha blending is shown below on the Berkeley Example, as well as the other two examples.

















Tell us what you have learned

In this project, I learned that homographies are really just simple projections and are super interesting in the world of art/street painting. I also learned how critical labelling accurate correspondences is, as it significantly affected the quality of my end results (trees and other objects with finer details ended up not aligning as well/blurring slightly when computing the final mosaic.)