Code Monkey home page Code Monkey logo

panorama-image-stitching's Introduction

Image Stitching OpenCV

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.

Algorithm

  • 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.

Optimization

For a better optimization, I tried two different methods.

Rectangle Masking with Percentage

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.

Screen Shot 2022-08-18 at 11 00 38

Bucketing

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.

Screen Shot 2022-08-18 at 11 34 24

Sample

Input Images

imageLeft imageRight

SIFT and kNN Matches

Screen Shot 2022-08-11 at 14 50 16

Weighted Filter

Screen Shot 2022-08-11 at 11 20 57

Output

Panorama_Final

panorama-image-stitching's People

Contributors

aserman01 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.