CS 180 Project 4 –– [Auto]Stitching Photo Mosaics

Aarav Patel

Overview

In Project 4A, we explore image warping and moasicing. Specifically, we shoot and digitize pictures, recover homographies, warp the images, and finally blend them into a mosaic. In Project 4B, we explore feature matching and autostitching. Specifically, we automatically detect corner features in an image, extract a feature descriptor for each feature point, match the feature descriptors between two images, use RANSAC to compute a homography, and finally blend the images into a mosaic similar to Project 4A.

4A: Shooting and Digitizing Images

I choose 3 sets of images: 1) my living room at home, 2) the view from my balcony in Berkeley, 3) my kitchen at home.

Living Room #1

OG Cameraman

Living Room #2

dx cameraman 1

Living Room #3

OG Cameraman

Balcony View #1

OG Cameraman

Balcony View #2

dx cameraman 1

Balcony View #3

dx cameraman 1

Kitchen #1

OG Cameraman

Kitchen #2

dx cameraman 1

Kitchen #3

dx cameraman 1

4A: Recovering Homographies

In order to recover the homography matrix H between two images, I had to define the correspondence points. For this task, I used the tool provided in Project 3. For our system, we only required 4 points to solve through least-squares. However, I used 8 points to yield an over-determined system and protect against instability. I solved the least-squares problem using SVD. I then normalized the solution and returned H.

4A: Warping the Images

In this part, I wrote the image warping function. It first determines the new image corner positions, then calculates the bounding box of the warped image, and finally uses inverse warping to map pixels from the warped image back to the original space. Below, I've applied my warp function for rectification. In the first case, I'm rotating my laptop screen towards the viewer. In the second case, I'm rotating the "I love CS 180" sign on my desk so it is readable by the viewer.

Orignal

OG Cameraman

Rectified

dx cameraman 1

Orignal

OG Cameraman

Rectified

dx cameraman 1

4A: Blending

In this part, I warped and then blended the images in every set to create a mosaic with the manual correspondences. Here are my results.

Living Room Result, Manual

OG Cameraman

Balcony View Result, Manual

dx cameraman 1

Kitchen Result, Manual

dx cameraman 1

4B: Detecting corner features in an image

Here, I used the Harris Interest Point Detector to detect the corner points in each image of each set. Here are my results.

Living Room #1, Harris Interest Points

dx cameraman 1

Living Room #2, Harris Interest Points

dx cameraman 1

Living Room #3, Harris Interest Points

dx cameraman 1

Balcony View #1, Harris Interest Points

dx cameraman 1

Balcony View #2, Harris Interest Points

dx cameraman 1

Balcony View #3, Harris Interest Points

dx cameraman 1

Kitchen #1, Harris Interest Points

dx cameraman 1

Kitchen #2, Harris Interest Points

dx cameraman 1

Kitchen #3, Harris Interest Points

dx cameraman 1

I then applied Adaptive Non-Maximal Supression to filter the number of points and ensure they are uniformly distributed over the image.

4B: Extracting a Feature Descriptor for each feature point

In this part, I extracted a feature descriptor for each feature point that was left after Adaptive Non-Maximal Supression. This is done by first observing a 40x40 window and then sampling an 8x8 feature descriptor.

4B: Matching these feature descriptors between two images

Here, I implemented feature matching between the descriptors of two images by thresholding on a Lowe's ratio of 0.6. Here are the potential matches. Please note that there are still some outliers–– which will be dealt with by RANSAC in the next part.

Living Room, Potential Matches

dx cameraman 1

Balcony View, Potential Matches

dx cameraman 1

Kitchen, Potential Matches

dx cameraman 1

4B: Use a robust method (RANSAC) to compute a homography

Here I implemented 4-point RANSAC as described in class to compute the most likely homography. I then blended the image sets to form mosaics and comapred to the results from Project 4A.

Living Room, 4A, Manual

dx cameraman 1

Living Room, 4B, Automatic

dx cameraman 1

Balcony View, 4A, Manual

dx cameraman 1

Balcony View, 4B, Automatic

dx cameraman 1

Kitchen, 4A, Manual

dx cameraman 1

Kitchen, 4B, Automatic

dx cameraman 1

Overall, the coolest thing I learned from this project was automatic feature matching. It was mind-blowing to see how realtively simple methods can be used to autostitch images together. These methods were developed before the days of deep learning, which I also found very interesting.