在opencv中对齐图像 [英] Align images in opencv

查看:177
本文介绍了在opencv中对齐图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有相同场景的图像聚焦在不同的距离。我想对齐图像,使每个特征在每个图像中都处于完全相同的位置。如何使用opencv执行此操作?

I have images of same scene focused at different distances. I want to align the images such that every feature is in exactly same position in every image. How can i do this using opencv?

推荐答案

首先,您已确定图像之间的转换。它可以像移位一样简单,也可以像非线性翘曲一样复杂。聚焦操作不仅可以移动,而且可以略微缩放甚至剪切图像。在这种情况下,您必须使用Homography来匹配它们。

First you have determine the transformation between your images. It can be as simple as shift or as complex as non-linear warping. Focusing operation can not only shift but also slightly scale and even shear the images. In this case you have to use Homography to match them.

其次,您必须尝试的最简单方法是手动选择至少4个对应点的巴黎,记录它们的坐标并将它们输入 findHomography()函数。得到的3x3转换可用于 warpPerspective()匹配图像。如果结果良好,您可以通过使用SURF点并匹配其描述符来自动查找对应关系的过程。

Second, a simplest way that you have to try is to manually select at least 4 paris of corresponding points, record their coordinates and feed them into findHomography() function. The resulting 3x3 transformation can be used in warpPerspective() to match the images. If the outcome is good you can automate the process of finding correspondences by using, say, SURF points and matching their descriptors.

最后,如果结果不理想,你必须进行比单应性更一般的转换。我会尝试分段试图分别匹配图像。无论如何,有关您的输入和最终目标的更多信息将有助于正确解决问题。

Finally, if the result is unsatisfactory you have to have a more general transformation than homography. I would try a piece-wise Affine trying to match pieces of images separately. Anyway, more info about your input and a final goal will help to solve the problem properly.

这篇关于在opencv中对齐图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆