Project 5A: Image Warping and Mosaicing

Yuhong Chen (cs194-26-afk)

In this project, we use image warping and linear blending to combine images taken closely together to form a single image with a wider angle.

Recovering Homographies

In order to align the two images we're using, we use a homography matrix to project them onto the same plane. We use the equation p' = Hp to define the transformation from one image into its projected version. Using 4 anchor points in each image as p and p', we can solve for the matrix H, which is a 3 by 3 matrix with 8 degrees of freedom.

Warping the Images

Once we recover the homography matrix, we can warp one of the images so that it's planar parallel with the other image. For this, the correspondence is p_warped = np.inv(H) @ p_orig. We use back-projection to recover the warped image.

Here are some examples:

Original Image 1-left:

Warped Image 1-left:

Original Image 2-left:

Warped Image 2-left:

Stitching and Blending

After warping, we can use linear blending to blend the warped left image and original right image together. I used a 0.5 to 0.5 ratio when blending the images.

Here are some results:

What I learned

Simple methods like linear blending are extremely powerful. Antialiasing is important when taking pictures of sofas with fabric surfaces. For-loops are extremely slow and should be avoided at all cost.