CS194-26 Project #6
Image Warping & Mosaicing

OVERVIEW

In this project we warp the perspective of various images by using linear algebra techniques to calculate a homography matrix. We start with some photographs and manually choose correspondence points between the two images. With this method, we are able to blend the images together to form a mosaic.


IMAGE RECTIFICATION

In this part, we warp the persepctive of various photos to a frontal-parallel plane. I chose 4 points that I wanted to be warped into a rectangular shape. I calculate H, the homography matrix by modeling it after the linear equation below:


Here are some examples of the warped photos, taken in various settings.

Before warp
After warp + crop
Before warp
After warp + crop

As you can see, the post-warp photos look like they were taken from eye-level, right in front of the object! (The resulting photo is not perfect because the points were selected by hand.)

IMAGE MOSAIC

Using the techniques explored above, we can extend this concept to create something really cool - a panorama! We are able to take multiple photos of the same setting taken from different perspectives, and blend them together to get a larger view of the scene as a whole.

Here we have two photos taken from slightly different angles. We compute the homography matrix and warp the left image to match the perspective of the right:

Then, we can blend them together. There are various methods one can use. The linear averaging is definitely the simplest method, but you can see the slight seam between the two blended images. I also tried using masks and the Gaussian blend method, which got rid of the appearance of the seam. It is interesting to note that the more correspondences you select, the sharper the result is, and any blurriness decreases as you got closer to the part of the image where the correspondence points were selected from. This makes sense, as that are of the photo will have the most accurate transformation.

Linear averaging
Gaussian blending

Another example, this time of London. We want to merge these two photos:

We warp and blend to form a mosaic.

1st photo is warped to the 2nd photo's perspective

Linear averaging
Gaussian blending

Here we merge together two photos of a set of cards:

Again, we warp and blend to form a mosaic.

1st photo is warped to the 2nd photo's perspective

Linear averaging
Gaussian blending

I learned that something as simple as linear algebra, combined with all the other image manipulation techniques we've learned in class, can create something as cool as a panorama! Now we know how our phones are able to stitch multiple photos together easily to produce a view of a much wider scene than one photo can encompass.