Project 6 part 1: IMAGE WARPING and MOSAICING

By Seunghwan Choi(cs194-26-acf)

Overview and Explanation

Part 1 requires you to take pictures of an object in different aspects, warp the images with apparently a "cool" application called image mosaicing.


So I first, using ginput from numpy, picked the correspondeces that I need to "flatten" the image. For both images, I chose the tilted rectangular as points1, regular rectangular that I hand-calculated as points2. Then I computed homographies using least squares method. Then using the inverse homographies, I transformed each point from the target image, to the interpolated original images.


First Picture and the Result


Second Picture and the Result


Project 6 part 2: FEATURE MATCHING for AUTOSTITCHING

Detecting Corners

This is the original picture



Using Harris Interest Point Detector, I got all the "edges" points.



Then I used thresh hold(value=0.01) to cut some of the edges.



Then, I used Adaptive Non-Maximal Suppression to spread out "edge" points. ANMS calculates minimum radius from each point to the other points such that corner_harris that other point multiplied by C constant is greater than the corner_harris of the original point. Then I sorted the points by its radius, select the largest 500 of them.



Feature Descriptor and Feature matching

These are the left and right original pictures



For each "edge" point, I found a 40 by 40 window of the picture with the edge point at the center. Then using imresize, I downsampled it to 8 by 8 and bias/gain normalized it.

Then each of these window was compared to all others using SSD. Then if ratio of the 1-NN dist / 2-NN dist was smaller than the thresh hold(value=0.6), I called it as a "matching pair".


Matching Points and their descriptors

Ransac

In order to recover a robust homography, I used an algorithm called RANSAC. For each iteration, 4 random pairs of matched points were chosen, get a homography out of these points, then using this h, map all of matched points of image1 to the other. Then use SSD and save all the points whose SSD's result was smaller than a thresh hold(value=10). After 10000 iterations, I found the largest inliers, and computed a robust homography.

before warping(left and right)
warped picture using RANSAC H

Notice how when I warped the left one to the right one, the resulted image perfectly fits the right side, hence the warping worked

Another example: original (left, right)
warped picture using RANSAC H

Reflection

I learned how to compute homographies and the difference between Affine and Perspective warping. Also, I learned how to automatically find edges, compute descriptor on an edge point, match by feature, and run RANSAC to find a robust homography. Unfortunately, I wasn't able to create mosaics out of them but it was a fun project overall.