These are the picture I shoted for this project. They are overlapping 50%- 70% with different views.
To compute the H, I just follow the steps below
I applied inverse warping to compute the transformation using the homography, similar to the approach I used in the previous project. However, instead of merging two images, the task here involved interpolating pixel values from a single image and mapping them onto a blank canvas.
Here are the examples of the rectified images. The first image is the original image, and the second image is the rectified image.
Fro this part, my approach to creating the mosaic was to first warp each image (except for the reference one) onto the reference image using the homography transformation. This results in a set of warped images, all aligned on the same plane but with the actual image content in different positions. To stitch all the iamges together, I used a distance transform-based blending technique. The idea is to compute how far each pixel is from the edge of its respective image (in the overlapping region), and use this information to weight the contributions of both images in the blending process.
To detect the the features in the iamges, we need to detect all the interest points in the images. The Harris Corner Detector is a method for detecting interest points (specifically, corners) in an image. Corners are areas in an image where intensity changes in multiple directions, making them distinctive and stable for tasks like feature matching and image stitching. Here, I didn't implement my own Harris Corner Detector. Instead, I used the code in the Harris.py file.
Since we do not need every interest points in the iamges, we should keep the most important ones. we will use a technique called non-maximum suppression to filter out the less important points. Adaptive Non-Maximal Suppression (ANMS) is a technique used to select a well-distributed set of strong interest points from a large set of detected corners or feature points. The goal of ANMS is to ensure that only the most distinctive and spatially diverse points are retained, which is especially useful for applications like feature matching in image stitching. images below are some examples of the ANMS results. Also, I selected 200 interesting points and robust is 0.9.
In order to get the information of the interesting points, we need to extract the feature descriptor. The reason why we need to extract the feature descriptor is that we need to match the interesting points in the two images. Here is the steps to extract the feature descriptor.
After extracting the feature descriptor, we need to match the interesting points in the two images. The matching process is to find the most similar feature points in the two images. To identify pairs of features that are likely to be strong matches. To do this, we use the threshold ratio (1-NN / 2-NN) as proposed by Lowe, which serves as a metric to assess the strength of each match. Here, 1-NN represents the nearest neighbor, while 2-NN denotes the second nearest neighbor. I chose a threshold ratio of 0.5 for comparison, meaning a match is accepted if the distance to the nearest neighbor is less than this.
The last step is to use RANSAC to find the best homography. RANSAC (Random Sample Consensus) is an iterative method used to estimate the parameters of a mathematical model from a set of observed data that contains outliers. Here are the steps to use RANSAC to find the best homography.
Note taht I choose the number of iterations to be 3000 and the threshold to be 8.
I learned that How the Harris Corner Detector works and how to implement it and how to use it to detect the interesting points in the images. Also, the RANSAC algorithm is a powerful tool for finding the best homography between two images.