拼接航拍图像

发布于 2024-11-07 15:10:08 字数 570 浏览 7 评论 0原文

我正在尝试将 2 张航拍图像拼接在一起,重叠很少,重叠可能小于 500 像素。这些图像的分辨率为 3600x2100。我正在使用 OpenCV 库来完成此任务。

这是我的方法:

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

现在我正在尝试让它与两个图像一起使用。我在执行步骤 3 和步骤 2 时遇到问题。我使用 OpenCV 库中的 findHomography() 来获取两个图像之间的单应性。然后我使用 homography 在我的一张图像上调用了 warpPerspective()

该方法的问题在于变换后的图像全部扭曲。而且它似乎只改变了图像的某一部分。我不知道为什么它没有改变整个图像。

有人可以给我一些关于如何解决这个问题的建议吗?
谢谢

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

執念 2024-11-14 15:10:08

在您发布的结果中,我可以看到您至少有一个关键点不匹配。如果你使用findHomography(src, dst, 0),它会弄乱你的单应性。您应该使用 findHomography(src, dst, CV_RANSAC) 来代替。

您还可以尝试使用 warpAffine 而不是 warpPerspective

编辑:在您在问题评论中发布的结果中,我的印象是匹配工作相当稳定。这意味着您也应该能够通过该示例获得良好的结果。由于您似乎主要需要处理平移,因此您可以尝试使用以下草图算法过滤掉异常值:

  1. 计算平均(或中值)运动向量x_avg
  2. 计算归一化点积< ;x_avg, x_match>
  3. 如果点积小于阈值,则丢弃 x_match

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
鹤仙姿 2024-11-14 15:10:08

为了使其适用于重叠较小的图像,您必须查看检测器、描述符和匹配项。您没有指定使用哪些描述符,但我建议使用 SIFT 或 SURF 描述符以及相应的检测器。您还应该设置检测器参数以进行密集采样(即尝试检测更多特征)。

您可以参考这个稍微相关的答案:OpenCV - 图像拼接

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

待天淡蓝洁白时 2024-11-14 15:10:08

要使用单应性拼接图像,最重要的是找到两个图像中的对应点。对应点中的异常值越少,生成的单应性越好。
使用稳健的技术,例如 RANSAC 以及 OpenCV 的 FindHomography() 函数(使用 CV_RANSAC 作为选项)仍然会生成合理的单应性,前提是内部值的百分比大于异常值的百分比。还要确保传递给 FindHomography 函数的对应点中至少有 4 个内点。

To stitch images using Homography, the most important thing that should be taken care of is finding of correspondence points in both the images. Lesser the outliers in the correspondence points, the better is the generated homography.
Using robust techniques such as RANSAC along with FindHomography() function of OpenCV(Use CV_RANSAC as option) will still generate reasonable homography provided percentage of inliers is more than percentage of outliers. Also make sure that there are at-least 4 inliers in the correspondence points that passed to the FindHomography function.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文