Auto Stitching & Photo Mosaics

COMPSCI 194-26 // Project 5 // Spring 2020

By Naomi Jung // cs194-26-acs

Part 1: Image Warping and Mosaicing

In Part 1, our goal was to make an image mosaic by stiching two overlapping images together. This involved manually choosing overlap points between the two images, recovering the homographies between the two images, warping the images into their rectified versions, and finally blending the two warped images together.

Below are the initial pictures that I shot that I digitized for this project so that I could stich them together into a mosaic.

Image 1

Image 2

After choosing several overlap points between these images, we recovered the homography matrix H between the original points p and new points p', where p' = Hp. To do this, we used least squares regression to solve Ax=b, where A was a matrix built using the original coorinates of size 2n x 8, and b was a vector of length 2n consisting of the new points. We then reshaped the resulting vector x, into a 3x3 matrix with the last entry set to 1 to recover H.

Next, we warped our image using our homography matrix. We used inverse warping to map pixels in the output shape to corresponding pixel values in the original image. We took the dot product of H inverse and p' to and then normalized by w to recover the original (x,y) coordinates. We then performed interpolation using these float coordinates to determine the pixel values to use to avoid aliasing.

At this point, we were able to rectify images! By taking an image with planar suraces, we mapped this to a rectangular set of points to rectify the image so that its plane was frontal-parallel. Below are some of the results of image rectification!

Part 1 Learnings

During this part, I enjoyed being able to learn how to warp images for image rectification. It was similar to some of the algorithms that we used in Project 3, but also incorporated new concepts such as homography and interpolation which we used to map multiple points in an image and find the best mapping to warp the images. Seeing the results after rectifying the images was also really rewarding!