1 | initial version |
It seems that you're confused by the meaning of min and max sizes, but may be I'm wrong. Why do you provide 4 cv::Size instead of just 2? Do you think that these are positions, aka ROI where the algorithm should detect objects?
Your call should look something like this:
//my call
body.detectMultiScale( gray, bodies, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, cv::Size(30,30),cv::Size(480,480));
That will mean that the algorithm will search the entire image for objects which are larger than 30x30 pixels, but smaller than 480x480. Please also note that it can't improve the quality of your algorithm, it is just a method to improve your performance. minSize
allows you to greatly reduce the detection time, make it as large as you can. In fact providing these sizes may improve your quality, but only by reducing the number of false positives, because you don't even search for too small and too large objects.
And finally I'm not sure that maxSize will work for Haar-cascade, it may be a limitation of the current implementation. But minSize should work and give you some visible speedup.
In order to limit the search space you should create a submatrix and run the detection on it.