Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top