matchTemplate找到合适的匹配 [英] matchTemplate finding good match

查看:69
本文介绍了matchTemplate找到合适的匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用答案并编写了自己的程序,但是我有特定的问题.如果没有对象,则matchTemplate不会给出错误,并且我不知道有任何方法可以检查matchTemplate是否找到对象,任何人都可以给我建议,或者说要检查它的函数名称.

Hi I use this answer and write my own program, but I have specific problem. If there is not the object, matchTemplate do not gives an error, and I do not know any method to check if matchTemplate find the object or not, can anyone give me advice, or say me function name which check it.

推荐答案

matchTemplate()返回一个矩阵,该矩阵的值指示您的对象位于该像素中心的概率.如果您知道有一个对象(只有一个对象),那么您要做的就是寻找最大值的位置.

matchTemplate() returns a matrix whose values indicate the probability that your object is centered in that pixel. If you know the object (and only one object) is there, all you have to do is look for the location of the maximum value.

如果您不知道,则必须找到最大值,并且如果该最大值超过某个阈值,则您的对象应该在那里.

If you don't know, you have to find the max value, and if it is above a certain threshold, your object should be there.

现在,选择该阈值非常棘手-由您自己决定专门针对您的应用的良好阈值.当然,您会有一些误报(当没有对象时,但最大值大于阈值),还有一些误报(您的对象不会产生足够大的峰值)

Now, selection of that threshold is tricky - it's up to you to find the good threshold specifically for your app. And of course you'll have some false positives (when there is no object, but the max is bigger than threshold), and some false negatives (your object does not create a big enough peak)

选择阈值的方法是收集一个相当大的图像数据库,其中包含和不包含您的对象,并统计对象内部时的峰值是多少,而当对象不在内部时,峰值是多少,然后选择最能区分这两个类别的阈值

The way to choose the threshold is to collect a fairly large database of images with and without your object inside, and make a statistic of how big is the peak when object is inside, and how big is when it isn't, and choose the threshold that best separates the two classes

这篇关于matchTemplate找到合适的匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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