Project 6: [Auto]Stitching Photo Mosaics

Yena Kim - cs194-26-aax




Part A: Image Warping and Mosaicing

Overview

In this project, we compute homography matrices and use them to rectify images as well as create mosaics using multiple photos of the same scene.

Homography

To compute the homography matrix, I find correspondance points in two images. I then use the equation p'=Hp, with p' being the points for one image and p being the corresponding points on the other, to find H.

Warping Images

To warp one image to another, I compute the homography matrix using their correspondance points. I find the size of the final image and create an empty image with just the image I'm warping to in the middle. I then do inverse warping for the other image by finding the locations on the new image where it will warp to and finding the corresponding points on the original.

Image Rectification

Using the above technique, I can rectify an image by finding the corners of the object and setting its correspondance points to be the corners of the desired shape. I then find the homography matrix and warp the image to the desired shape.

poster original
poster rectified (cropped)
art original
art rectified (cropped)

Blending and Mosaicing

Creating a mosaic of multiple images is similar to rectifying an image, with the difference being that instead of warping to a shape, I'm warping the image to another image. Now that I have both images placed appropriately, I can blend the images together to create the final mosaic.

winter original 1
winter original 2
winter mosaic
winter mosaic (cropped)
point reyes original 1
point reyes original 2
point reyes mosaic
point reyes mosaic (cropped)
hotel original 1
hotel original 2
hotel mosaic
hotel mosaic (cropped)

What I Learned

It is pretty amazing what we can do with multiple images and a bit of math. I think it's super cool that by just computing a homography matrix I can change the perspective of images as well as stitching images with different perspectives together into one mosaic.