简体   繁体   English

OpenCV (Python) 中 cv2.findHomography 的输出

[英]Output of cv2.findHomography in OpenCV (Python)

I'm using OpenCV's findHomography function (with RANSAC) in Python to find the transformation between two sets of points.我在 Python 中使用 OpenCV 的 findHomography 函数(带有 RANSAC)来查找两组点之间的转换。

Looking at the documentation , the output is a mask and a transformation matrix.查看文档,输出是一个掩码和一个转换矩阵。

The documentation is not clear about what the mask represents, and how the matrix is structured.文档不清楚掩码代表什么,以及矩阵的结构。

Is a 1 in the output mask a point that fits the found transformation or a point that was ignored?输出掩码中的 1 是适合找到的变换的点还是被忽略的点? And could you explain the makeup of the 3x3 output transformation matrix?你能解释一下 3x3 输出变换矩阵的构成吗?

Thanks in advance and sorry if I missed some documentation which explains this.提前致谢,如果我错过了一些解释这一点的文档,我深表歉意。

Based on my limited search, 'mask' returned by findHomography() has status of inliers and outliers.根据我有限的搜索, findHomography() 返回的 'mask' 具有 inliers 和 outliers 的状态。 Meaning, it's a matrix representing matches after finding the homography of an object.意思是,它是找到对象的单应性表示匹配的矩阵。

This answer addresses your first question.这个答案解决了你的第一个问题。

This answer addresses what a mask is and what are it's dimensions. 这个答案解决了面具是什么以及它的尺寸是什么。

Well what do you need to do with the mask?那么你需要用面具做什么? Because that field is not needed so you don't have to put any mask.因为不需要该字段,所以您不必放置任何掩码。

As for the resulting matrix.至于结果矩阵。 It is called a homography matrix, or H matrix and it represents the transformation of one point in an image plane to the same point in another image plane.它被称为homography矩阵或H矩阵,它表示图像平面中的一个点到另一个图像平面中的同一点的变换。

 X1 = H * X2

The point X1 is the same point ( X2 ) in a different plane.X1是不同平面中的相同点 ( X2 )。

So the H matrix is basically the description of how one point in, lets say, image 1 matches 1 point in image2.因此,H 矩阵基本上是对图像 1 中的一个点如何匹配图像 2 中的 1 个点的描述。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM