Mohido / Image_Stitcher

This is a simple Homography matrix creator. It creates the homography (Image to Image transformation matrix) and stitch images accordingly.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Image_Stitcher

Stitching 2 or more images to each other to form a larger image is done through a transformation matrix that projects (Transforms) 1 image plane into the other plane. This transformation matrix is called the "Homography" matrix in the world of Computer Vission. You phone probably uses this technique when you shoot a panoramic scene (photo). This repository is my code and solution for an assignment that was given to us in the course of Computer vission at ELTE. Note that some of the file paths are written statically. So if you are using this code, make sure to read through it if I am using a static file path and such. However, the Homography files don't contain such a thing. They are very independent.

Files Structure:

  1. main.cpp : Here the task solutions takes place. This is a very dependent code to the given problem. Here we load the images from the directory. The task explanation is given there as well. And the macros are defining the structure of the program (From visualizing the feature points, to creating the stitched images using a certain homography).
  2. functions.h : Contain all the help funcitons that might be used during the whole program. Such as loading images, saving images and such. It also contains the feature points struct, which uses OpenCV ORB feature matching to extract the feature points between 2 images.
  3. homography.h : is an interface (abstract class) which all the different kind of homographies classes will inherit from. Each of the homography classes demonstrates a certain way of homography matrix estimation. The most robust one is the RANSAC Normalized Homography estimator class. Check the results in the directory with the corresponding name.
  4. ....

Running the project:

  1. first of all make sure to have opencv installed on your machine. You can follow how to set up with Visual Studio 19 on the "Bouncing Ball" Game on my github account. Read the README.md file to understand how to setup opencv with Visual Studio.
  2. after setting up openCV, you can run the project normal. The project main.cpp is task dependent. Thereofre, it will load the files from the the "./res" directory. If you want a different behavior you neeed to change that static part in the code
  3. finally you can set the macros that you want to see. Define them by uncomment them and the results will output on the same directory of the project. You will see something like "Homography_n".

Examples:

Non-Normalized Homography Estimator:

2 desired images:

Stitched Image




Normalized Homography Estimator:

2 desired images:

Stitched Image




RANSAC Normalized Homography Estimator:

2 desired images:

2 desired images:




About

This is a simple Homography matrix creator. It creates the homography (Image to Image transformation matrix) and stitch images accordingly.

License:MIT License


Languages

Language:C++ 100.0%