Here are the pictures we'll be using for rectification/mosaicing. All shot with the same center of projection but rotating the axis slightly.
|
|
|
|
|
|
We compute homographies by selecting pairs of points (at least 4 pairs) between the two images and solving for Ah=b where h is a vector holding the 8 unknown entries of H. If we pick more than 4 points, we use least squares to find the best homography for the points.
I used inverse warping to get a final image from a warped source image, and just used integer coordinates instead of interp2d to avoid aliasing.
|
|
|
|
Here we use the previous parts to blend images into a mosaic! I tried both not blending at all (simple binary mask) and alpha blending using a gaussian mask on the binary mask. Looks like not blending at all sometimes works better.
|
|
|
|
|
|
|
|
|
|
|
|
We use the starter code to detect Harris corners. I set min_distance to 5 since with the default value of 1 the dots were way too concentrated.
|
|
I didn't get around to implementing ANMS, so I just hand selected points on the images.
|
|
Now for each corner, we get the 41x41 pixel square around it, blur and scale it down to and 8x8 patch. We also normalize by taking
(patch - min(patch))/(max(patch - min(patch)))
|
|
For each of our features patches, calculate the SSD to each of the other feature patches. If the ratio of
smallestSSD / secondSmallestSSD
is under a threshhold we set (.3 for examples below), we consider the feature patches to be a match, and pair them up as such.
|
|
Perform ransac algorithm described here to get our final homography
|
|
You'll notice that I lost one of my correspondences, since that point ended up not being in the maximal inlier set.
Here's a side by side for the final stitchings. Manual on left, automatic on right.
|
|
|
|
|
|
I think this project as a whole touched on some really cool concepts. My favorite topics were automatic corner detection and creating feature patches. RANSAC is also a pretty cool algorithm.