I am Pushpak.
I always wondered how panoramic images are captured in a smartphone and now I’ve finally implemented image stitching using opencv and python.
The above image is a panaroma of 3 different images. When I went to NYC I wanted to capture the New York stock exchange building but there is no space to get a perfect picture so I captured 3 different images and stitched them together to get the whole building into one frame.
I always wanted to capture the full view that I get from my balcony, but I was never able to so few days back while writing code for one of my assignments an idea came to my mind that I can use my daily view to complete some tasks so I captured 8 images and wrote a code that detects common points and stitched the together.
The above code check similarities using OpenCV and stitches them using an in-built function in OpenCV called stitcher
In phase 1, The program deterines key points and extracts local invariant descriptors from the two input images. It matched the descriptors between the two images as phase 2.
Using the RANSAC algorithm, the program estimated a homography matrix using our matched feature vectors. RANSAC is an iterative method to estimate parameters of a mathematical model from a set of observed data that contains outliers when outliers are to be accorded no influence on the values of the estimates. Therefore, it interprets as an outlier detection method. Homography has many practical applications, such as image rectification, image registration, or camera motion—rotation and translation—between two images. Once camera resectioning has been done from an estimated homography matrix, this information may be used for navigation, or to insert models of 3D objects into an image or video, so that they are rendered with the correct perspective and appear to have been part of the original scene
In the last step, opencv applies a wrapping transformation using the homography matrix obtained previously.
OpenCV has also encapsulated all four of these steps inside the code file.
The code won’t work if the images have nothing in common. I tried it on 3 different images and there was no output for it.