문제

everyone, I have trained my own classifier in Opencv and when I run it a get kind of bad results. My goal is to use the Haar features as a guideline so I'd like to view the positives not after the entire cascade classifier has been executed but in each step, after every feature. Is it then, possible to tell the detector to stop at that feature or do I have to manually truncate the xml file containing the features thresholds? Thank you

도움이 되었습니까?

해결책

It is possible. Just check how CascadeClassifier::detectMultiScale works. In this function you can check this->data.stages.size(), it will show you how many stages there are in cascade.

In particular detectMultiScale calls detectSingleScale, then it calls CascadeClassifierInvoker's operator(), and we see there int result = classifier->runAt(evaluator, Point(x, y), gypWeight); line.

Thus if result is greater than zero, this means classification succeded and went through all stages. Otherwise (if i'm not mistaken) result will be equal to -[number of stage] classifier failed at. So you can see the exact stage classifier failed to pass.

Also if you use old-style cascades pay attention that detectMultiScale calls cvHaarDetectObjectsForROC, not detectSingleScale, but essentialy it does the same thing.

Good luck.

And yes, this means you're going to modify sources.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top