CS194 Project 6: Image Warping and Mosaicing
Matthew Waliman, cs194-26-afq



In this assignment we warp images into mosaics to generate panoramas. There are two main parts: 1. Image Rectification, the core utility to image stitching, and 2. Blending to create mosaics.

In order to align the images we have take into account that the camera looks at the same scene from different perspectives, in essence taking a project transform of the scene. A Homography is a projective mapping between two planes with the same center of projection, the camera axis. A projective transform allows mapping between any pairs of quadrilaterals. It does not preserve parallel lines but does straight lines. The projective matrix His below.

We have 8 unknowns. Now it becomes clear why we needed 4 pairs of points in order to solve for h or H. We then plug A and b into a leasr squares solver to recover an H that best fits the specified points.

Here are the images I will be using to demonstrate rectification.

First I chose the 4 corners of objects I knew the geometry for. Here, I chose the slide and a face of the paper bag. Then I just 4 arbitrary correspnding target points at right angles in the rectified canvas space. Then I image warped using the bilinear interpolation we used back in project 4. These are the results. One thing to note is that the transform will match the four points to the four specified target points, however the rest of the image will be projectively transformed in different directions, almost always verging into the negative axes. In order to account for this in the future, we apply shifts into the positive quadrant so that we are able to view more of the image.

There were a few challenges to applying multiple projective transforms and combining them. The first was where the each transformed image should go in the final image. In all panoramas shown I warped one image into the plane of the other. Then I chose a canvas approximately 3 times the size of the base image and applied the transforms. Finally, blending the two images proved more difficult than I originally imagined. I ended up using linear blending. I calculated the overlapping areas of each image and calculated the distance from each respective image center. This became a scaled alpha, with which to blend each image. The respective "masks" for the overlapping region are shown.


No Blending
Linear Blending


This project was a lot of fun. I learned yet another applicatin of linear algebra.