从OpenCV中的findHomography中检测垃圾单应性? [英] Detecting garbage homographies from findHomography in OpenCV?

查看:81
本文介绍了从OpenCV中的findHomography中检测垃圾单应性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在点列表上使用findHomography并将结果发送到warpPerspective.

I'm using findHomography on a list of points and sending the result to warpPerspective.

问题在于,有时结果是完全的垃圾,结果图像由怪异的灰色矩形表示.

The problem is that sometimes the result is complete garbage and the resulting image is represented by weird gray rectangles.

如何检测findHomography何时给我发送不好的结果?

How can I detect when findHomography sends me bad results?

推荐答案

您可以对输出执行几种健全性测试.在我的头顶上:

There are several sanity tests you can perform on the output. On top of my head:

  1. 计算单应性的行列式,并查看它是否太接近零以至于舒适.
  2. 更好的是,计算其SVD并验证第一个到最后一个奇数的比率 值是理智的(不太高).两种结果都会告诉您矩阵是否接近 单数.
  3. 计算图像角及其中心的图像(即当 您将单应性应用于这些角和中心),并验证它们是否合理, 即它们是否在图像画布中(如果您希望它们在其中)?他们分开得好吗 彼此之间?
  4. 在matlab中绘制/八度拟合单应性的输出(数据)点,以及 使用单应性,将其与来自输入值的计算值进行比较,并验证它们是否正确 接近(即错误率低).
  1. Compute the determinant of the homography, and see if it's too close to zero for comfort.
  2. Even better, compute its SVD, and verify that the ratio of the first-to-last singular value is sane (not too high). Either result will tell you whether the matrix is close to singular.
  3. Compute the images of the image corners and of its center (i.e. the points you get when you apply the homography to those corners and center), and verify that they make sense, i.e. are they inside the image canvas (if you expect them to be)? Are they well separated from each other?
  4. Plot in matlab/octave the output (data) points you fitted the homography to, along with their computed values from the input ones, using the homography, and verify that they are close (i.e. the error is low).

一个导致垃圾结果的常见错误是输入和输出点列表的顺序不正确,这导致拟合例程使用错误的对应关系工作.检查索引是否正确.

A common mistake that leads to garbage results is incorrect ordering of the lists of input and output points, that leads the fitting routine to work using wrong correspondences. Check that your indices are correct.

这篇关于从OpenCV中的findHomography中检测垃圾单应性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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