Skip to content

aartighatkesar/Image-Mosaicing

Repository files navigation

Image-Mosaicing

Description:

This project generates an image mosaic/ panorama from images. The following are the sequence of steps of the process

0. Click pictures such that adjacent pictures have atleast 40% overlap. Order the pictures from left to right
1. Generate SIFT features among images
2. Establish correspondence between features
3. Apply RANSAC (Random Sampling and Consensus) to get rid of outliers
4. Generate initial estimate of Homography using inlier correspondence points obtained in step 4
5. Refine the Homography estimate using Levenberg- Marquardt optimization
6. Repeat the above steps for each of the adjacent image pairs 
7. After obtaining Homographies for each of the picture pairs, get the homographies with respect to the central image
8. Project all images (using inverse warping) on to a blank canvas. Use bilinear interpolation

Refer here for technical explanation

Dependencies

  • OpenCV
  • NumPy
  • SciPy (if you want to compare results from Levenberg-Marquardt implementation in SciPy)

Scripts

  • image_mosiac.py: MAIN file to run. Pass the correct parent folder and image list in the script. Result folder with all intermediate images and final panorama are generated in /<parent_folder>/results
python image mosaic.py
Supporting scripts
  • match_features.py: Script to generate SIFT features and establish correspondence between features of two images
  • ransac.py: RANSAC algorithm to obtain inliers and discard outliers among correspondences
  • optimize_fcn.py: Levenberg-Marquardt algorithm for optimization. Generic script and can be used for any Non-Linear Least Squares Estimation
  • estimate_homography.py: Helper functions which help in bilinear interpolation and projecting images to a canvas using Homography matrix

Results

Inputs

|1.jpg 1.jpg |2.jpg 2.jpg |3.jpg 3.jpg |4.jpg 4.jpg |5.jpg 5.jpg |

Intermediate results
  • All SIFT feature correspondence for img 2 and 3

  • Inliers from RANSAC for img 2 and 3

  • Outliers from RANSAC for img 2 and 3

Go here for more intermediate results for all image pairs

Final Image Mosaic

Inputs
  • 1.jpg

1.jpg

  • 2.jpg

2.jpg

  • 3.jpg

3.jpg

  • 4.jpg

4.jpg

  • 5.jpg

5.jpg

Intermediate results
  • All SIFT feature correspondence for img 2 and 3

  • Inliers from RANSAC for img 2 and 3

  • Outliers from RANSAC for img 2 and 3

Go here for more intermediate results for all image pairs

Final Image Mosaic