Reputation: 21
I'm performing pedestrian detection on a video stream using haar cascadeclassifiers and I am trying to optimize the code by reducing the scale range of detection thanks to parameters minSize
and maxSize
in the detectMutliScale
function:
fullbodyCascade.detectMultiScale(image, found_pedestrian, 1.1, 3, 0, Size(20,60), Size(50,100));
It seems that the minSize
parameter is the only one taken into account while objects with greater size than maxSize
are still being detected.
Has anyone encountered this issue ?
Thanks in advance for your help
Ilou
Upvotes: 1
Views: 1343
Reputation: 21
The haar cascadeclassifier I am using is an old format file and the functions associated to this format do not seem to take maxSize into account. Therfore, I modified haar.cpp by adding :
if( winSize.width > maxSize.width || winSize.height > maxSize.height ) break;
right before lig. 1202 :
if( winSize.width < minSize.width || winSize.height < minSize.height )
{
if( findBiggestObject )
break;
continue;
}
There was probably a more clever way to fix this (using flags...?) but anyways,it works fine now.
Upvotes: 1