IMAGE WARPING and MOSAICING Part 1

By Cameron Hui, chui3@berkeley.edu

Overview

This project focuses on warping multiple images with the same center into a mosaic panorama.

Shoot the Pictures

Here are the pictures and the points I've chosen for them.

Corresponding points in two images
Corresponding points in two images
Corresponding points in two images

Recovering Homographies

This part of the project focused on finding the homography matrix that matches hand-selected points on corresponding pictures. The resulting matrix would be used to perspective warp the input images so that they would match.

The H matrix is derived by creating a system of equations with 8 unknowns, and using corresponding points between two images. Taking corresponding points between both images creates two sets of coefficients for a system of equations, where (xi, yi) and (x'i, y'i) are the coordinates of two points:



Stacking these row vectors for each of the four corresponding points I've chosen forms the P matrix. The P matrix multiplied by the vector h of 8 unknowns are then set to 0 to solve for h - this is the equation Ph = 0. I used least squares to solve for h, added a 1 at the end (for scale factor) and reshaped the vector for a final 3x3 square matrix H.

Images of equations taken from this website.
Least squares calculation from course slides

Warp the Images

Here, I apply the h matrix calculated in the previous step to warp one of the images.

Before and after of warp
Before and after of warp
Before and after of warp

Image Rectification

By calculating corresponding points on my image where there has been a perspective warp, I can create a set of rectangular points that I can warp the image to, straightening the image properly.


Before and after of rectified image, with specified points

Blend the images into a mosaic

I didn't have enough time to properly calcuate the blend - I added a weighted average of the second image warped to the first.

Image mosaic fail

Most important thing learned

The biggest thing I learned from this project was how to determine the warping matrix for a perspective warp between two images. By figuring out the homographies of two images, I can generate the image at most angles, or at least generate what patterns might look like when theyre flattened. Sorry for submitting this so late, I had a bunch of job interviews + projects for my job/internship and was really overwhelmed :(