0

I have a bunch of aerial images and I want to stitch them together (I don't want to rely on orthomap software such as ODM).

I am following this methodology: Stitch multiple images using OpenCV (Python)

To find the matching points between two close images (based on GPS), I use SIFT features:

Once I have the set of points matching the two images, I find a transform with cv2.findHomography() and I apply this transform with cv2.warpPerspective().

The problem is that once I start to add more and more images, the perspective becomes worse and worse. Are there similar functions to findHomography and warpPerspective that do not use perspective?

I saw affineTransform but I'm not sure how to use and if it's appropriate here.

Here is the result I get at the moment:

Stitching aerial images

Philippe Remy
  • 2,967
  • 4
  • 25
  • 39
  • 1
    Yes, the reason why it gets progressively worse is because you are propagating the errors further down the line. The homographies you calculated are only pairwise consistent and so as you find the transform between the first two images, the errors in the stitch get transferred over to the second image, which then get transferred to the third image, fourth image etc. Have a look at OpenCV's actual stitching module which globally ensures the stitch and matches are consistent. Good tutorial: https://www.pyimagesearch.com/2018/12/17/image-stitching-with-opencv-and-python/ – rayryeng Sep 17 '20 at 14:28
  • Thanks @rayryeng will have a look! – Philippe Remy Sep 17 '20 at 14:31
  • there is a function "estimateRigidTransform" where you can choose whether you want to use affine parameters or not. For warping you can either extend the transformation to 3x3 or use warpAffine – Micka Sep 17 '20 at 19:13
  • 1
    @Micka thanks a lot will try `estimateRigidTransform` and let the SO users if it solved my problem ;) – Philippe Remy Sep 18 '20 at 00:49
  • abother thing: Did you calibrate your camera? If there is lens distortion, the ground might not be projected planar enough for a suitable perspective transform. – Micka Sep 18 '20 at 02:52
  • 1
    @Micka camera was mounted on a drone and I think the calibration was done. – Philippe Remy Sep 18 '20 at 03:58
  • So the function `estimateAffine2D` coupled with `H = np.concatenate((H, [[0, 0, 1]]))` solved my problem. Thanks!!! – Philippe Remy Sep 19 '20 at 04:27
  • cf. https://stackoverflow.com/questions/23373077/using-estimaterigidtransform-instead-of-findhomography – Philippe Remy Sep 19 '20 at 04:35
  • Because estimateRigidTransform is deprecated: https://stackoverflow.com/questions/55757977/how-to-use-estimaterigidtransform-in-opencv-3-0-or-higher-is-there-any-other-al – Philippe Remy Sep 19 '20 at 04:36

0 Answers0