A project for creating a panorama image from two images using SIFT, kNN, RANSAC, Homography and weighted filters.
I implemented a feature matching automatic image stitching algorithm. User inputs two images which have overlapped fields and program creates a wide panorama of both images.
- Firstly, we turn both images into gray scale and use SIFT (Scale-invariant Feature Transform) Method to detect their keypoints.
- Using kNN and brute force, we find the most similar keypoints and match them.
- We compute the homography matrix needed for matched points' transformation.
- Then we use RANSAC (Random Sample Consensus) we find the subset with most inliers and by doing so eliminate outliers.
- With homography matrix, we warp the images.
- Lastly, we use a weighted filter to make transition between both images seamless.
For a better optimization, I tried two different methods.
As we know which image is left and which image is right, we can only scan the right and left part of images by scaning %75 part of an image, program can work in a more optimized manner.
My test results showed that scanning only %75 of the images helps us save 2-3 seconds for each stitching and this value still can increase as we reduce the scan area without losing any details in panorama.
We can seperate our image into little rectangles and can only take some of those rectangles to save computing time. As these rectangles are homogenously disturbed through our image, precision of the stitching doesn't change.
My test results showed that using 50x50 mask of the images helps us save 4-5 seconds (which is very drastic) for each stitching and this value still can increase as we reduce the scan area without losing any details in panorama.