简体   繁体   English

当使用rejectLevels和levelWeights调用重载时,DetectMultiScale永远不会返回

[英]DetectMultiScale never returns when calling overload with rejectLevels and levelWeights

I am trying to modify my OpenCV-based code to get confidences along with each detected object from a cascade classifier. 我正在尝试修改基于OpenCV的代码,以便与级联分类器中的每个检测到的对象放在一起。 When I call the overload of the CascadeClassifier 's detectMultiScale method which takes out parameters for rejectLevels and levelWeights (and pass true for outputRejectLevels ), the call never completes. 当我调用CascadeClassifierdetectMultiScale方法的重载时 ,该方法取出了rejectLevelslevelWeights参数(并为true传递了outputRejectLevels ),该调用从未完成。 Internally, the call to detectMultiScaleNoGrouping finishes quickly but returns millions of objects. 在内部,对detectMultiScaleNoGrouping的调用detectMultiScaleNoGrouping完成,但返回数百万个对象。 When I don't pass either of the extra out parameters and set outputRejectLevels to false, that same call returns 60 object and the rest of the function works fine. 当我不传递任何额外的out参数,并将outputRejectLevels设置为false时,该调用将返回60个对象,而该函数的其余部分都可以正常工作。

Am I not supposed to call this overload? 我不应该称这种超载吗? Or is there a different reason that it is returning so many values that the function never finishes? 还是有另一个原因导致它返回的值太多,以至于函数无法完成? How can I do this correctly? 如何正确执行此操作?

Note: I see another question that appears to be referencing the same problem, but it does not include much information about the problem itself and hasn't gotten any answers. 注意:我看到另一个问题似乎是在参考相同的问题,但是它没有包含有关该问题本身的太多信息,也没有得到任何答案。

It turns out that this has been fixed in OpenCV's master branch, but not released yet (as of April 18, 2016). 事实证明,此问题已在OpenCV的master分支中修复,但尚未发布(截至2016年4月18日)。 I have confirmed that manually applying the patch and rebuilding fixes the problem. 我已经确认手动应用补丁并重建可以解决该问题。

The relevant discussion is here and the PR that must be included to fix the problem is this one . 有关的讨论在这里 ,解决这个问题必须包括的PR就是这个 It is a one-line change, so it should be easy to manually implement until they release an official build with the change included. 这是一个单行的更改,因此在发布包含此更改的正式版本之前,应该易于手动实施。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM