使用 opencv 过滤目标检测的误报

发布于 2024-11-28 03:12:19 字数 262 浏览 0 评论 0原文

我使用 opencv 的 HaarDetectObjects(...) 来检测图像中的对象。该函数返回图像中可能包含该对象的区域的坐标,问题是我只想检测图像中该对象的单个实例,并且我无法知道该函数返回的结果中的哪个是“最好的”。有没有一种方法可以让结果按实际包含该对象的概率排序?或者也许定义结果必须通过的某种阈值?基本上,我需要一种过滤掉误报的方法。

我不限于使用 opencv 或 HaarDetectObjects,如果有人对其他库或其他对象检测方法有建议,欢迎。

谢谢。

im using opencv's HaarDetectObjects(...) to detect an object in an image. The function returns the coordinates of areas in the image that might contain the object, the problem is i only want to detect a single instance of the object in the image and i have no way of knowing which of the results returned by the function is the "best". is there a way i could get the results sorted by their probability of actually containing the object ? or maybe define some sort of threshold the results must pass ? basically, i need a way of filtering out the false positives.

i am not restricted to using opencv or HaarDetectObjects, if anyone has a suggestion for another library or another object detection method, it is welcome.

thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦回梦里 2024-12-05 03:12:19

您可以利用任何特定领域的知识吗?

如果预计对象具有特定大小或最有可能处于特定位置,您可以定义一个非常简单的索引来测量每次检测与该大小/位置的距离,这就是您的概率检测实际上是对象。

它预计具有某种颜色吗?您可以获取样本对象的颜色直方图。然后,您可以使用距离函数将 HaarDetectObjects 返回到此示例直方图的每个检测进行比较(对于距离函数,我的脑海中会弹出名称“Bhattacharyya distance”和“Mahalanobis distance”,但我不能声称任何专业知识OpenCv 确实支持 直方图,但包括 CompareHist 函数)。

关于物体的轮廓、纹理、几何形状……你有什么可以说的吗?任何可以简化为数字并与“基本值”进行比较的东西都可以有所帮助。

当然,所有这些都受到处理限制。其中一些建议在计算时间方面可能会或可能不会有点昂贵。这可能会也可能不会影响您的应用程序,具体取决于您是否有硬件或实时限制。

Is there any domain specific knowledge you can take advantage of?

If the object is expected to be of a certain size or is most likely to be in certain position, you can define a very simple index that measures how far each detection is from being that size/position, so that would be your probability of a detection actually being the object.

Is it expected to be of certain color? You can take the color histogram of a sample object. Then, you could compare each detection that HaarDetectObjects has returned to this sample histogram using a distance function (for the distance function, the names "Bhattacharyya distance" and "Mahalanobis distance" pop up in my mind, but I can't claim any expertise on this. OpenCv does have support for histograms, though, including a CompareHist function).

Is there anything you can say about the object's contours, texture, geometry...? Anything that can be reduced to numbers and compared to a "ground value" can be of help.

All of this, of course, is subject to processing constraints. Some of these suggestions might or might not be a bit expensive in terms of computation time. And this might or might not affect your application, depending of whether you have hardware or real time constraints.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文