Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

stitching aerial images

I am trying to stitch 2 aerial images together with very little overlap, probably <500 px of overlap. These images have 3600x2100 resolution. I am using the OpenCV library to complete this task.

Here is my approach:

1. Find feature points and match points between the two images.
2. Find homography between two images
3. Warp one of the images using the homgraphy
4. Stitch the two images

Right now I am trying to get this to work with two images. I am having trouble with step 3 and possibly step 2. I used findHomography() from the OpenCV library to grab my homography between the two images. Then I called warpPerspective() on one of my images using the homgraphy.

The problem with the approach is that the transformed image is all distorted. Also it seems to only transform a certain part of the image. I have no idea why it is not transforming the whole image.

Can someone give me some advice on how I should approach this problem?
Thanks

like image 275
Hien Avatar asked Oct 12 '22 01:10

Hien


2 Answers

In the results that you have posted, I can see that you have at least one keypoint mismatch. If you use findHomography(src, dst, 0), it will mess up your homography. You should use findHomography(src, dst, CV_RANSAC) instead.

You can also try to use warpAffine instead of warpPerspective.

Edit: In the results that you posted in the comments to your question, I had the impression that the matching worked quite stable. That means that you should be able to get good results with the example as well. Since you mostly seem to have to deal with translation you could try to filter out the outliers with the following sketched algorithm:

  1. calculate the average (or median) motion vector x_avg
  2. calculate the normalized dot product <x_avg, x_match>
  3. discard x_match if the dot product is smaller than a threshold
like image 65
bjoernz Avatar answered Nov 02 '22 23:11

bjoernz


To make it work for images with smaller overlap, you would have to look at the detector, descriptors and matches. You do not specify which descriptors you work with, but I would suggest using SIFT or SURF descriptors and the corresponding detectors. You should also set the detector parameters to make a dense sampling (i.e., try to detect more features).

You can refer to this answer which is slightly related: OpenCV - Image Stitching

like image 39
KMS Avatar answered Nov 03 '22 00:11

KMS