
Michal Lohnicky
This example shows how to merge two photos using OpenCV. SURF features are used to find a homography to align the images and histogram matching with Bhattacharyya distance is used for merging them seamlessly.
Functions used: cv.CalcHist, cv.FindHomography, cv.CompareHist(…, CV_COMP_BHATTACHARYYA), cv.ExtractSURF
Inputs

The process
- Preprocessing
- Image registration
- Finding the correspondences between detected points
- Calculating the homography
- Histogram matching
- Creating the blurred stitching mask
The matching process is demonstrated on the following images:




Results
Python source code is provided