如何检查获得的单应性矩阵是否好? [英] How to check if obtained homography matrix is good?

查看:824
本文介绍了如何检查获得的单应性矩阵是否好?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题已经提出,但我还是不明白。我通过从一组点调用 cv :: findHomography 获得单应性矩阵。我需要检查它是否相关。
建议的方法是计算内点的最大重投影误差,并将其与阈值进行比较。但是在这样的过滤后,我继续获得疯狂的变换,对象边界框转换为几乎直线或一些奇怪的非凸四边形,具有自交集等。
可以使用什么约束来检查单应性矩阵本身是否足够?

This question was already asked, but I still don't get it. I obtain a homography matrix by calling cv::findHomography from a set of points. I need to check whether it's relevant or not.
The proposed method is to calculate maximum reprojection error for inliers and compare it with a threshold. But after such filtration I keep getting insane transformations with object bounding box transforming to almost a straight line or some strange non-convex quadrangle, with self-intersections etc.
What constraints can be used to check if the homography matrix itself is adequate?

推荐答案

您的问题是数学的。给定3x3的矩阵决定它是否表示良好的刚性变换。
很难定义什么是好,但这里有一些线索可以帮助你

Your question is mathematical. Given a matrix of 3x3 decide whether it represents a good rigid transformation. It is hard to define what is "good" but here are some clues that can help you


  1. 同位素应保留方向的多边形点。设计一个简单的测试。点(0,0),(imwidth,0),(width,height),(0,height)表示具有顺时针排列的点的四边形。在这些点上应用单应性,看看它们是否仍然顺时针排列,如果他们成逆时针您的单应性正在翻转(镜像)的图像,有时仍然确定。但如果你的分数不符合你的坏单数的话。

  2. 单应性不会改变对象的比例。例如,如果你期望它缩小或放大图像的因子高达X,只需检查这个规则。使用单应性变换4点(0,0),(imwidth,0),(width-1,height),(0,height),并计算四边形面积(opencv计算多边形面积的方法)的区域太大(或太小),您可能会有错误。

  3. 良好的单应性通常使用低透明度值。通常,如果图像的大小是〜1000×1000像素,那些值应该是〜0.005-0.001。高透视率将导致巨大的扭曲,这可能是一个错误。如果你不知道这些值的位置,请阅读我的帖子:
    试图理解仿射变换
    。它解释了仿射变换数学,其他2个值是透视参数。

  1. Homography should preserve the direction of polygonal points. Design a simple test. points (0,0), (imwidth,0), (width,height), (0,height) represent a quadrilateral with clockwise arranged points. Apply homography on those points and see if they are still clockwise arranged if they become counter clockwise your homography is flipping (mirroring) the image which is sometimes still ok. But if your points are out of order than you have a "bad homography"
  2. The homography doesn't change the scale of the object too much. For example if you expect it to shrink or enlarge the image by a factor of up to X, just check this rule. Transform the 4 points (0,0), (imwidth,0), (width-1,height), (0,height) with homography and calculate the area of the quadrilateral (opencv method of calculating area of polygon) if the ratio of areas is too big (or too small), you probably have an error.
  3. Good homography is usually uses low values of perspectivity. Typically if the size of the image is ~1000x1000 pixels those values should be ~0.005-0.001. High perspectivity will cause enormous distortions which are probably an error. If you don't know where those values are located read my post: trying to understand the Affine Transform . It explains the affine transform math and the other 2 values are perspective parameters.

我认为如果你检查上述3条件2是最重要的)你将能够检测到大部分的问题。
祝好运

I think that if you check the above 3 condition (condition 2 is the most important) you will be able to detect most of the problems. Good luck

这篇关于如何检查获得的单应性矩阵是否好?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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