findHomography,getPerspectiveTransform和& getAffineTransform [英] findHomography, getPerspectiveTransform, & getAffineTransform

查看:243
本文介绍了findHomography,getPerspectiveTransform和& getAffineTransform的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题与OpenCV函数findHomographygetPerspectiveTransform& getAffineTransform

This question is on the OpenCV functions findHomography, getPerspectiveTransform & getAffineTransform

  1. findHomographygetPerspectiveTransform有什么区别?我从文档中了解到,getPerspectiveTransform使用4个对应关系(这是计算单应性/透视变换的最低要求)来计算变换,其中findHomography会计算该变换,即使您提供了4个以上的对应关系(大概使用了某种东西)像最小二乘法一样?). 这样对吗? (在这种情况下,OpenCV仍然继续支持getPerspectiveTransform的唯一原因应该是遗留的吗?)

  1. What is the difference between findHomography and getPerspectiveTransform?. My understanding from the documentation is that getPerspectiveTransform computes the transform using 4 correspondences (which is the minimum required to compute a homography/perspective transform) where as findHomography computes the transform even if you provide more than 4 correspondencies (presumably using something like a least squares method?). Is this correct? (In which case the only reason OpenCV still continues to support getPerspectiveTransform should be legacy? )

我的下一个担心是,我想知道是否有与findHomography等效的计算仿射变换?即使用最小二乘法或等效鲁棒方法进行计算和仿射变换的函数. 根据文档,getAffineTransform仅接受3个对应关系(这是计算仿射变换所需的最小值).

My next concern is that I want to know if there is an equivalent to findHomography for computing an Affine transformation? i.e. a function which uses a least squares or an equivalent robust method to compute and affine transformation. According to the documentation getAffineTransform takes in only 3 correspondences (which is the min required to compute an affine transform).

最好

推荐答案

Q#1 :对,findHomography试图在两组点之间找到最佳变换.它使用比最小二乘法更聪明的东西称为RANSAC,它具有剔除离群值的能力-如果您的数据点中至少有50%+ 1可以,则RANSAC会尽力找到它们,并建立可靠的转换.

Q #1: Right, the findHomography tries to find the best transform between two sets of points. It uses something smarter than least squares, called RANSAC, which has the ability to reject outliers - if at least 50% + 1 of your data points are OK, RANSAC will do its best to find them, and build a reliable transform.

getPerspectiveTransform有很多有用的理由可以保留-它是findHomography的基础,并且在许多只有4个点并且知道它们是正确点的情况下很有用. findHomography通常与自动检测到的点集一起使用-您可以找到许多点,但置信度较低.当您确定要确定四个角(例如手动标记或矩形的自动检测)时,getPerspectiveTransform很好.

The getPerspectiveTransform has a lot of useful reasons to stay - it is the base for findHomography, and it is useful in many situations where you only have 4 points, and you know they are the correct ones. The findHomography is usually used with sets of points detected automatically - you can find many of them, but with low confidence. getPerspectiveTransform is good when you kn ow for sure 4 corners - like manual marking, or automatic detection of a rectangle.

Q#2 :仿射变换没有等效项.您可以使用findHomography,因为仿射变换是单应性的子集.

Q #2 There is no equivalent for affine transforms. You can use findHomography, because affine transforms are a subset of homographies.

这篇关于findHomography,getPerspectiveTransform和& getAffineTransform的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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