Image alignment in opencv

I have images of the same scene focused at different distances. I want to align the images so that each function is in the same position in each image. How can I do this using opencv?

+8
image-processing opencv
source share
4 answers

First you defined the conversion between your images. It can be as simple as shear or complexity as non-linear deformation. The focusing operation can not only shift, but also slightly scale and even shift the image. In this case, you need to use homography to match them.

Secondly, the easiest way you should try is to manually select at least 4 pairs of corresponding points, write down their coordinates and pass them to findHomography () . The resulting 3x3 transformation can be used in warpPerspective () to match the images. If the result is good, you can automate the matching process by using, say, SURF points and matching their descriptors.

Finally, if the result is unsatisfactory, you should have a more general transformation than homography. I would try a piece of Affinity, trying to match the individual parts of the images. In any case, more detailed information about your contribution and ultimate goal will help to solve the problem correctly.

+8
source share

You can use image stitching or the mock function of openCV algorithms.

The main stages of mapping functions:

  • Extract functions (SURF or SIFT or others ...)
  • Combine functions (FLANN or BruteForce ...) and filter matches
  • Find a geometric transformation (RANSAC or LMeds ...)
+4
source share

The main idea is to rotate the images in the plane and their 2D shift in the X and Y directions based on their coincident function points.

Check out Image Alignment Algorithms , where you can find two approaches for this using OpenCV (with code).

+3
source share

Check out these links:

Image Alignment (ECC) in OpenCV (C ++ / Python) is slow, but it works: http://www.learnopencv.com/image-alignment-ecc-in-opencv-c-python/

Homography Examples Using OpenCV (Python / C ++) http://www.learnopencv.com/homography-examples-using-opencv-python-c/

Github Code: https://github.com/spmallick/learnopencv/tree/master/Homography

+2
source share

All Articles