We first define correspondence between two images manually as shown by the red dots.
We then follow instruction in this link and solve the following system of equations using least squares:
We show the original images on the left and the rectified images on the right.
We show original images on the first row and blended image on the second row.
It was very interesting to learn how panorama are made!
Original image without black padding:
By running the Harris corner detector, we detect corners almost all over the image.
By running ANMS, we significantly reduce the number of corners detected, and these corners are distributed evenly across the image.
Around each detected corner, find a 40x40 patch around it, apply a Gaussian filter, and downsample it to an 8x8 feature descriptor.
Using the ratio between the error of nearest neighbor and the error of second nearest neighbor to match features across two images. We choose 0.2 as our threshold.
Apply RANSAC to compute a robust homography estimate.
We show manual mosaic on the left and automatic mosaic on the right. As well can see, automatic mosaic is more accurate for the first and third scene, but it is a bit off for the second scene.
It's really cool to implement autostitching!