Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to align multiple camera images using opencv

Imagine someone taking a burst shot from camera, he will be having multiple images, but since no tripod or stand was used, images taken will be slightly different.

How can I align them such that they overlay neatly and crop out the edges

I have searched a lot, but most of the solutions were either making a 3D reconstruction or using matlab.

e.g. https://github.com/royshil/SfM-Toy-Library

Since I'm very new to openCV, I will prefer a easy to implement solution

I have generated many datasets by manually rotating and cropping images in MSPaint but any link containing corresponding datasets(slightly rotated and translated images) will also be helpful.

EDIT:I found a solution here http://www.codeproject.com/Articles/24809/Image-Alignment-Algorithms which gives close approximations to rotation and translation vectors.

How can I do better than this?

like image 364
rockstarjindal Avatar asked Mar 09 '14 06:03

rockstarjindal


1 Answers

It depends on what you mean by "better" (accuracy, speed, low memory requirements, etc). One classic approach is to align each frame #i (with i>2) with the first frame, as follows:

  1. Local feature detection, for instance via SIFT or SURF (link)
  2. Descriptor extraction (link)
  3. Descriptor matching (link)
  4. Alignment estimation via perspective transformation (link)
  5. Transform image #i to match image 1 using the estimated transformation (link)
like image 130
BConic Avatar answered Nov 09 '22 23:11

BConic