CS 194 Project 6 Part 1: Image Warping and Mosaicing - Evan Sheng

Introduction

For this project, I took pictures of a couple different scense with lots of overlapping content, and used a projective transformation to rectify them or stitch them together to form a mosaic

The results are shown below

Original Images

First, I went to shoot the images. It was very important to keep the center of projection the same for all images, so I tried to rotate the camera around the lens.

Interior of my Friend's Apartment
My Kitchen

Recovering Homographies

Next I needed to recover the homographies between the images. A homography has eight parameters we can solve for and is the transformation which transforms one image into the image plane of another. I first solved the equations below before continuing. To compute the matrix, I supplied a list of correspondance points for each image that I manually picked, and then used a least squares solver to find the homography. We were given that for points (x,y) in one image, and (x', y') in the target image, that:

By matrix multiplication, we have:

By solving for x' and y', we get the following:

Putting this back into matrix multiplcation form where h is a 1 dimensional vector, we get:

We solve this for every pair of correspondance points, and use the built in numpy least square solver to recover h.

Rectifying Images

Now that we've solved for the homography, we can warp images from one viewpoint to annother. First, we calculate the bounding box of the resultant image by using the homography matrix on each of the corners, and keeping track of the max and min width and heights. Then, we use the matrix to fill the pixels of the resulting image to create the warp. Here are a couple examples:

Original Image Rectified to TV plane facing us
Original Image Rectified to painting plane facing us

Blening Images to Mosaic

After rectifying, the next task was to actually blend two images together into a mosaic. I warped one image into the plane of another and then blended the result together at the corresponding levels to create a panorama. \n Three results are shown below:

Original Images
Left and Center Mosaic Center and Right Mosaic
Original Images
Resultant Kitchen Mosaic