Ask Your Question
0

CascadeClassifier::detectMultiScale alogical influence of minSize parameter

asked 2016-02-11 05:48:20 -0600

Andyrey gravatar image

updated 2016-02-11 06:23:20 -0600

I work with OpenCV 2.4.9. When I downsize whole image with, lets say, k=0.6 koefficient (both width and height reduced proportionally), I do the same with parameter minSize=minSize(minSize_original_width x k, minSize_original_height x k), the same with maxSize.

I visualize detecting result. The detection rate of bigger objects stay the same in reduced image, but smaller objects are not detected anymore as they were in the original, larger image.

Is there any other, hidden constraint, which I don't know? I use pre-trained model.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

answered 2016-02-11 06:30:26 -0600

Well what is happening can be explained quite straightforward. Each cascade classifier is trained with a -w and a -h parameter, which can be retrieved from the xml model. It defines the dimensions of the object model. For a multiscale detection an image is scaled down from the original size by -scaleFactor step by step and then the original model size is used to perform detections.

However this means that the model dimensions immediatly define the minimum dimensions an object should have. You can avoid this by initially upscaling the image. BUT this comes with a price, upscaling introduces noise and errors in the image, the more you upscale, the more these can influence the model evaluation. So at a certain point developers decided that the downsides of upscaling did not overcome the benefits. And thus it is left to the user to decide.

I am pretty sure that if you count the number of pixels for the width and height that they will be smaller than the model size for the object not detected.

edit flag offensive delete link more

Comments

So, my image consecutively shrinks by detecMultiScale function (not enlarged) and detection happens in step when object in image becomes equal to model's size, which is fixed. Thus, minSize and maxSize together with -scaleFactor define only number of steps in this loop, not actual minimum (or maximum) possible object size?

Andyrey gravatar imageAndyrey ( 2016-02-11 08:50:04 -0600 )edit

Well minSize and maxSize do define the object dimensions, but minSize is internally cut off at the models dimensions and thus it will never get smaller.

StevenPuttemans gravatar imageStevenPuttemans ( 2016-02-11 09:05:16 -0600 )edit
2

Thank you for the answers, Steven. So far, there is no sense to set minSize less then model's size.

Andyrey gravatar imageAndyrey ( 2016-02-11 10:25:21 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-02-11 05:48:20 -0600

Seen: 921 times

Last updated: Feb 11 '16