CS194-26: Image Manipulation and Computational Photography


Project 6A: Image Warping and Mosaicing

1) Shoot and Digitize Pictures

Example 1

I took these pictures of Seattle from the top of the Space Needle this past summer. There is significant overlap between the pictures, and there are a lot of details that should be easy to align!


Example 2

I took these mountain pictures in Utah. The features of the mountain should provide good details to base correspondences off of.


Example 3

This, as you can tell, is the Golden Gate Bridge in San Francisco.


2) Recover Homographies

For this part of the project, we had to compute the homography between the two images. To do this, I chose corresponding points on each image, and then used Least-Squares to find the matrix that would most closely transform the points from image A into the corresponding points from image B.


3) Warp the Images

The next step for this project was using the homography to warp one image so that the corresponding points aligned. This was done by multiplying the pixels in one image by the homography matrix to get the resulting warped image.
To check that this process was working, I used the following photos (with clear square tiles) and warped the corners of the tiles to the corner of a square.

Example 1

For this example, I used the four corners of the blue mosaic square on the floor.

Example 2

For this example, I used the four corners of the tile behind my cat. As you can see, this warp had an unfortunate effect on my cat's head.

4) Blend Images into Mosaic

The next step for this project was blending the warped images into a panoramic. To accomplish this, I used the already calculated correspondences to determine how much to shift the warped image. Then, after the warped image was shifted, I used an alpha channel with linear feathering to blend the aligned images together, setting alpha to be one at the center of the image and decreasing until it reaches 0 at the edges of the images.

Example 1: Seattle, as seen from the top of the Space Needle



Example 2: Utah Mountains



Example 3: Golden Gate Bridge



I learned that creating mosaic panoramics is fun, and as usual, that small details can trip you up really easily!

Project 6B: Feature Matching for Autostitching

1) Detecting Corner Features

The first part of this project was to detect the Harris corners. This part was implemented for us. Below are the Harris corners overlaid on the original mosaic photos.




As you can see, this resulted in a lot of points. To filter the points to get a smaller and more useable set, we strategically picked what corners would be the best to keep. To pick the best corners, I implemented Adaptive Non-Maximal Suppression, or ANMS. I calculated r_i for each corner, where r_i is the suppression radius for that corner (defined in the MOPS paper). I then took the 500 points with the highest suppression radii (equivalent to starting the suppression radius at infinity and decreasing until you have 500 points). Here are the resultant corners I kept for each image:




2) Extracting Feature Descriptors

Now that we have the desired interest points, the next step was to describe the features for each point in a way that would be unique. To do this, I used the 40x40 pixel square around each interest point, blurred them to be 8x8, and normalized these squares.

3) Matching Features

Now that I had feature descriptors, I matched the features between the images. To find a feature match, I found the two features from the other image that have the smallest distances (where distance is defined in dist2), and considered the original feature and the feature with the smallest distance to be a match if the ratio of the two smallest distance features is less than the threshold, which I kept at .6.
Here are the points that remained:




4) RANSAC

Now that we have a set of possible corresponding points, it is time to compute the transformation to warp one image to the other. To do this, I implemented Random Sample Consensus, or RANSAC. I picked a random set of 4 points, computed the homography between the two sets of 4 points, and then computed the "inliers" under this homography, or the points that got correctly mapped under this transformation. After figuring out which homography had the largest amount of inliers, I used this homography to warp all points in the image.
Here are the inliers for each set of images:




5) Produce Mosaic

At this point, we use the homography to warp the image in the same way as part A, and follow the same steps to blend the images into a panoramic!
Below are the manually stitched panoramics (left) next to their automatically-rendered counterparts (right):


Example 1: Seattle, as seen from the top of the Space Needle



Example 2: Utah Mountains


Example 3: Golden Gate Bridge