Project 6: Image Warping and Mosaicing (Part 1)

Project Overview

In this project I take several overlapping photos, alter one of them, then stitch them together into a panorama. While this alteration may seem very complex, it turns out that it is as simple as multiplying by a matrix. Below, I explain it.

By stacking other points in the first matrix, there is a good chance the equation will be overdetermined. Therefore, to solve for the homography matrix, you must take the least squares solution to the above equation.

Image Rectification

I took 2 pictures from different angles of this artsy painting at some hotel in LA. Here, I rectify them so that they appear to be seen head-on.

Image Warping and Mosaicing

Overview

Now instead of choosing a square, we choose points on 2 images that correspond with each other. Then we warp 1 of the images onto the points of the other image. Here's 2 photos I took of my favorite building on campus, Hearst Memorial Mining Building.

I then selected pairs of points in the 2 images and warped the first image to the 2nd image. Here is the result:

Next, I line up this warped image with the un-warped image. Without any blending, this is what it looks like:

Notice that the seams are still slightly visible because of color differences in the 2 images and the points being slightly off from optimal. Now, I use alpha blending (weighted averaging) to fix this.

Notice now that the seams are completely gone, and the only remaining artifacts are some slight blurring around details like the railing. Much better!

Other results

 Original photo Original photo
 Warped image
 Mosaic, no blending
 Mosaic, with blending

 Original photo Original photo
 Warped image
 Mosaic, no blending
 Mosaic, with blending

Reflections

Before this project, I never knew that you could warp an image onto a different plane by simply multiplying it by a matrix. It definitely helped de-mystify how cameras take panoramas. I also did not realize how important blending was, because I had thought that it would not be necessary. However, tiny differences in camera position and lightning make a big difference in lining them up. While selecting points, I also learned that choosing a variety of points spread out across the image results in the best mosaic.