如何应用具有超过4对点的透视变换? [英] How do I apply a perspective transform with more than 4 pairs of points?

查看:243
本文介绍了如何应用具有超过4对点的透视变换?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我拍了一些照片,试图将它们映射到Google Maps上的卫星图像上.通常,我只需要4对点就可以有效地应用透视变换.但是,由于两个原因,这在我的案例中没有用:

I took some photos that I am attempting to map/transform onto satellite images on Google Maps. Normally, I would need only 4 pairs of points to apply a perspective transform effectively. However, this is not useful in my case because of two reasons:

  1. 主要是因为Google卫星图像的分辨率较差(至少对我的应用程序而言差),这使得很难确定与照片上的点相对应的确切点.
  2. 我认为Google的卫星图像不太完美地缝合在一起,这意味着即使使用了完美选择的点对,我也可能会有些偏离,因为Google图像上的点本身略有偏离.

因此,我想使用4个以上的点对透视变换进行最小二乘估计,以便获得更好的拟合度.但是,我不知道该怎么做.

As a result, I would like to conduct a least-squares estimation of the perspective transform using more than 4 points, so that I can get a better fit. However, I have no idea how to do so.

为此,我正在使用带有PIL和/或OpenCV的Python ,因此使用这些库的解决方案会有所帮助.

I am using Python with PIL and/or OpenCV for this, so a solution using those libraries would be helpful.

推荐答案

Homography比仿射功能稍微强大一点(它不会保留平行线).它需要4分或更多( findHomography 使用RANSAC并使用线性解决方案选择其最佳内联集;然后在最小二乘意义上对距离残差进行非线性优化.您必须提供尽可能多的匹配项(> = 4),但要避免出现太多不正确的匹配项.

Homography is slightly more powerful than affine (it doesn’t preserve parallel lines). It requires 4 points or more (findHomography uses RANSAC and selects its best set of inliers using a linear solution; this is followed by non-linear optimization of distance residual in a least squares sense). You have to provide as many matches as you can (>=4) but try to avoid too many inaccurate matches.

最小二乘的原始统计模型是ML(最大似然),该模型在存在噪声的情况下找到最佳解决方案. RANSAC补偿异常值的存在.尽管算法中没有任何东西可以补偿系统偏差.如果不能将它们建模为噪声或离群值,则解决方案的定义不明确. (如果排除了离群值后)离群数少于4,则无法找到解决方案.

The original statistical model for least squares is ML (maximum likelihood) that finds an optimal solution in the presence of noise. RANSAC compensates for the presence of outliers. There is nothing in the algorithm though that compensates for systematic biases. If they cannot be modeled as noise or outliers a solution is not well defined. If the number of inliers (after rejecting outliers) is less than 4 the solution won’t be found.

这篇关于如何应用具有超过4对点的透视变换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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