1 | initial version |
There is no simple solution for this. You'll need to modify the source code in the place where CascadeClassifier::runAt method is called, I mean internals of the CascadeClassifier
. You can find the place where it is called, and try to add an if
statement for checking your mask. But this is not all, because CascadeClassifier
uses image pyramids, that means that you also need to scale your mask, so it correctly can be used for every scale.
So, it is not trivial, but feasible. But I can say that in our experiments the time we need for building the mask was larger than the time we were saving later. And if your mask is not good, you can loose some objects. Thus, I would suggest skipping frames and using some kind of tracking between detections. Check the DetectionBasedTracker
class as a simple example.