Fall 2020

CS 194-26

Project 5: Autostitching and Photo Mosaics

Gurmehar Kaur Somal



Part A: Image Warping and Mosaicing

The goal of this project is to take two or more photographs and create an image mosaic by registering, projective warping, resampling, and compositing them, while computing homographies and warping images.

Shooting the Photos

I selected 3 sets of photographs where each set is taken with the sam epoint of view but with different rotated directions with overlapping views. Then I used them to recover homographies and then perform a projective warp on the left or right images. Finally, I blend the images together to create a panorama.

Recover Homeographies

In order to recover the homographies, I used 15 corresponding points to perform a better transformation and used least squares to solve the correspondences. Let there be pairs of corresponding points for the first image and second image , we find such that the following least squares term is minimized.

We solve for using the following system of equations (matrix equation ) to recover .

Image Rectification

Here, I test whether the homography/warping is working by rectifying some sample images with some planar surfaces.

Original
Rectified
Original
Rectified

Blending into mosaic

Now that we have warped the images, we use different techniques to blend them. Here, I am showing the results for linear and laplacian blend.

Warped Image
Warped Image
Linear Blend
Laplacian Blend

Warped Image
Warped Image
Linear Blend
Laplacian Blend
Warped Image
Warped Image
Linear Blend
Laplacian Blend

Part B: Feature Matching and Autostitching

Detecting Harris Image Corners

I used the harris image corner detection function from the project spec to get the corners shown in the images below. I tuned the parameter in the given function to reduce the amount of corners and improve efficiency of the algorithm.

Adaptive Non-Maximal Supression

Here, I implemented the adaptive non-maximal suppression algorithm to reduce the amount of corners by choosing fewer corners that are evenly spaced out. I specifically used 150 corners, which proved to be most efficient.

Feature Matching

The next step was to perform feature matching by creating feature descriptors. I did this by sampling a region of 40x40 pixels around each ANMS harris corner point, and resized it to an 8x8 patch. Then, I matched the patches for all images using a 0.3 threshold for the ratio in the 'matching' function.

RANSAC and Autostitching

After performing feature matching, I used the RANSAC alogrithm to calculate the homography matrix that is robust to outliers. The RANSAC alogrithm sampled 4 different points (500 samples) and solved a simple system of linear equations and evaluated the matrix. I then used a specific value of epsilon to get matches after transforming the points in the feature set of the first and second image. I worked through 500 iterations to calculate the least squares value for the most optimal homography. Finally, I blended the images together using linear and laplacian blending algorithms and the best homography matrix from before.

Warped Image
Warped Image
Linear Blend
Laplacian Blend
Warped Image
Warped Image
Linear Blend
Laplacian Blend
Warped Image
Warped Image
Linear Blend
Laplacian Blend

My Learnings

It was extremely interesting to compare the different results for manual and automatic stitching of images and understand how to match each corner in the corresponding photos using feature matching.


Website inspiration- Charley Huang, acg.