使用OpenCV中的SURF进行模式识别的准确度测量 [英] Measure of accuracy in pattern recognition using SURF in OpenCV

查看:1642
本文介绍了使用OpenCV中的SURF进行模式识别的准确度测量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用OpenCV中的SURF进行模式识别。到目前为止我有什么:我写了一个程序在C#中,我可以选择一个源图像和模板,我想找到。之后,我将两个图片转移到一个C ++ - DLL中,我实现了一个程序使用OpenCV-SURFdetector,它返回所有的关键点,并匹配回我的C#程序,我试图画一个矩形围绕我的匹配。 p>



现在我的问题:模式识别中有常见的准确性度量吗?例如匹配的数量与模板中关键点的数量成比例?或者我的匹配矩形和原始大小的模板图像之间的大小差异?

编辑:为了使我的问题更清楚。我有一堆匹配点,已经阈值由minHessian和距离值。之后,我在我的比赛点画一个矩形,你可以看到在我的照片。这是我的MATCH。我怎么能告诉现在这个比赛有多好?我已经计算我的现在找到的匹配和我的模板之间的角度,大小和颜色差异。但我认为这太模糊了。

解决方案

我不是100%确定你真正要求什么,调用匹配是模糊的。但是既然你说你已经匹配了你的SURF点,并提到模式识别和使用模板,我假设,最终,你想要本地化模板在你的图像,你问的是一个本地化的分数来决定你是否找到图片中的模板。



这是一个具有挑战性的问题,我不知道一个好的,总是适当的解决方案。



但是,根据您的方法,您可以做的是分析图像中匹配点的密度:将局部或全局最大值视为模板的可能位置(全局if您知道您的模板在图像中只出现一次,如果它可以出现多次,则为本地),并使用密度阈值来决定是否显示模板。该算法的草图可以是这样的:


  1. 分配图像大小的浮点密度图

  2. 通过在每个匹配点的邻域中增加固定量的密度图来计算密度图(例如,对于每个匹配点,在每个匹配点添加固定值ε

  3. 查找密度图的全局或局部最大值(全局可以使用opencv函数MinMaxLoc找到,局部最大值可以使用morpho数学找到,例如如何在图像中找到局部最大值MATLAB?

  4. 对于获得的每个最大值,将相应的密度值与阈值<τ> tau 进行比较,以决定您的模板是否存在

如果您进入了resarch文章,您可以检查以下内容以改进此基本算法:





EDIT :解决问题的另一种方法是匹配点,以保持只有那些真正对应于您的模板图像。这可以通过强制在紧密匹配的点之间的一致性的约束来完成。以下研究文章提供了这样的方法:上下文相关的徽标匹配和检索,H.Sahbi,L.Ballan,G.Serra,A.Del Bimbo,2010 (然而,这可能需要一些背景知识...)。



希望这有助于。


I’m currently working on pattern recognition using SURF in OpenCV. What do I have so far: I’ve written a program in C# where I can select a source-image and a template which I want to find. After that I transfer both pictures into a C++-dll where I’ve implemented a program using the OpenCV-SURFdetector, which returns all the keypoints and matches back to my C#-program where I try to draw a rectangle around my matches.

Now my question: Is there a common measure of accuracy in pattern recognition? Like for example number of matches in proportion to the number of keypoints in the template? Or maybe the size-difference between my match-rectangle and the original size of the template-image? What are common parameters that are used to say if a match is a "real" and "good" match?

Edit: To make my question clearer. I have a bunch of matchpoints, that are already thresholded by minHessian and distance value. After that I draw something like a rectangle around my matchpoints as you can see in my picture. This is my MATCH. How can I tell now how good this match is? I'm already calculating angle, size and color differences between my now found match and my template. But I think that is much too vague.

解决方案

I am not 100% sure about what you are really asking, because what you call a "match" is vague. But since you said you already matched your SURF points and mentionned pattern recognition and the use of a template, I am assuming that, ultimately, you want to localize the template in your image and you are asking about a localization score to decide whether you found the template in the image or not.

This is a challenging problem and I am not aware that a good and always-appropriate solution has been found yet.

However, given your approach, what you could do is analyze the density of matched points in your image: consider local or global maximas as possible locations for your template (global if you know your template appears only once in the image, local if it can appear multiple times) and use a threshold on the density to decide whether or not the template appears. A sketch of the algorithm could be something like this:

  1. Allocate a floating point density map of the size of your image
  2. Compute the density map, by increasing by a fixed amount the density map in the neighborhood of each matched point (for instance, for each matched point, add a fixed value epsilon in the rectangle your are displaying in your question)
  3. Find the global or local maximas of the density map (global can be found using opencv function MinMaxLoc, and local maximas can be found using morpho maths, e.g. How can I find local maxima in an image in MATLAB?)
  4. For each maxima obtained, compare the corresponding density value to a threshold tau, to decide whether your template is there or not

If you are into resarch articles, you can check the following ones for improvement of this basic algorithm:

EDIT: another way to address your problem is to try and remove accidently-matched points in order to keep only those truly corresponding to your template image. This can be done by enforcing a constraint of consistancy between close matched points. The following research article presents an approach like this: "Context-dependent logo matching and retrieval", by H.Sahbi, L.Ballan, G.Serra, A.Del Bimbo, 2010 (however, this may require some background knowledge...).

Hope this helps.

这篇关于使用OpenCV中的SURF进行模式识别的准确度测量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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