CS194-26 Project 4: Part B


Feature Matching for Autostitching


Sean Kwan, Fall 2021

Original Images

Here are the original images that I will be using for feature matching for autostitching.

Deteting Corner Features in an image

Using Harris Corners and the started code from harris.py we are able to detect corner features from the images.

Adaptive Non-Maximal Suppression

However, it is very obvious from the above image that there are way too many corner points. In order to limit the number of coordinates, and find the most evenly space points we turn to Adaptive Non-Maximal Suppression (ANMS). This orders the points by the minimum radius based on the metric:

This lets us have evenly spaced points, with high corner strength and leads us to keep the following points.

Extracting a Feature Descriptor for each feaure point

For each Harris Point that we found in the images, we needed to extract feature descriptors from them. This consisted of first applying a Gaussian filter on the image to get the low frequencies of the image, then subsampling a 40x40 patch around the Harris coordinates and then downsampling to an 8x8 patch to get the feature descriptor.

Matching these feature descriptors between two images

To further find better points for our Homography transformation, we need to match the feature descriptors between the two images. In order to do this, I used the SSD error in order to compare pairs of feature descriptors between the two images. By comparing these errors between every pair, we're able to find the first nearest neighbor and the second nearest neighbor. Using Lowes we threshold on the ratio between the error of the first nearest neighbor and the second nearest neighbor. This lets us find the matching features.

RANSAC

In order to further the limit the points needed to compute the Homography matrix H, I used RANSAC to find the correspondences necessary:

This is the result of RANSAC ran on the images:

Final Mosaics

This is the result of feature matching for autostitching mosaics. On the left is the manually selected correspondence points and on the right is the automatic stitching.

This is the result of feature matching for autostitching mosaics on a new pair of images.

The reason why I did not include the third nature image from my original Part A is because the homography transformation did not work. I believe it's because I took a photo of trees, so the feature descriptors that were created and matched all looked pretty similar, so the autostitching was unable to find a good set of correspondences.

What I learned

The coolest thing I learned from this project is how we can automate the selection of points using Harris corners, ANMS and RANSAC. I found the simplicity and powerfulness of RANSAC to be especially interesting.