关键点描述符匹配:如何计算每个模板的拟合优度? [英] Keypoint Descriptor Matching: How to calculate a goodness-of-fit per template?

查看:144
本文介绍了关键点描述符匹配:如何计算每个模板的拟合优度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定这是否属于 stackoverflow 或其他 stackexchange 站点 - 非常欢迎在这里输入.

我使用 python OpenCV 将目标图像的 BRISK 关键点描述符与三个不同的模板相匹配.

I have used python OpenCV to match a target image's BRISK keypoint descriptors to - in turn - three different templates.

确定哪个模板最合适的实用、稳健、统计合理的方法是什么?

What is a practical, robust, statistically-sound way to decide which template is the best-fitting one?

现在我计算 cv2.findHomography 返回的 cv2.RANSAC 内点的数量(顺便说一下,它不返回拟合优度统计数据)并取编号最大的模板.

Right now I calculate the number of cv2.RANSAC inliers returned by cv2.findHomography (which incidentally doesn't return a goodness-of-fit statistic) and take the template that has the highest number.

我查看了描述符距离的直方图,它们似乎总是以高斯为中心(奇怪地)大约为 105(单位?).

I have looked at histograms of descriptor distances, which always seem to be gaussians centred (weirdly) at about 105 (units?).

https://en.wikipedia.org/wiki/Random_sample_consensus 似乎非常有用.

非常感谢指导 - 谢谢!

Guidance much appreciated - thanks!

推荐答案

这开始是一个评论,但有点太长了.

This started as a comment but was getting a bit too long.

确实,OpenCV 会在内部计算重投影误差并且不会返回它.但是一旦你获得单应性,你可以自己做同样的事情,不是吗?事实上,该算法最小化了所有点上的重投影误差的总和.OpenCV 文档

Indeed OpenCV computes the reprojection error internally and does not return it. But you could do the same by yourself once you obtain the homography, no? As a matter of fact the algorithm minimizes the sum of the reprojection error over all the points. A quite complete description of the process is in the OpenCV docs

因为你有匹配(因此有源点和模板点的图像坐标).您可以计算每个模板的平均重投影误差,可能仅使用被视为内点的点,并选择最低的一个.

Since you have the matches (hence the image coordinates of both source and template points). You can compute the average reprojection error, possibly only using points that are treated as inliers, for each of the templates and choose the lowest one.

来自 另一个网站上的类似答案:

computed_pt = H * source_pt
error_pt = sqrt( (computed_pt.x - dst_pt.x)*(computed_pt.x - dst_pt.x) + (computed_pt.y - dst_pt.y)*(computed_pt.y - dst_pt.y) )

计算两点之间的欧几里德距离.

to compute the euclidean distance between the two points.

这篇关于关键点描述符匹配:如何计算每个模板的拟合优度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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