Flags parameter in the detectMultiScale function

asked 2016-07-11 07:10:13 -0600

Kelvin gravatar image

updated 2017-11-13 12:08:10 -0600

Can someone explain to me what does the flags parameter do in the detectMultiScale function?

For example:

face = faceCascade.detectMultiScale(
    scaleFactor = scaleFactor,
    minNeighbors = min_neighbors,
    minSize = (min_size, min_size),
    flags = cv2.CASCADE_SCALE_IMAGE

I could not find the flags in the documentation.

Note: I'm using OpenCV 3.1.0.


edit retag flag offensive close merge delete


What don't you understand in doc (C++) ?

LBerger gravatar imageLBerger ( 2017-11-13 11:52:43 -0600 )edit

It is not used for a new cascade.

sturkmen gravatar imagesturkmen ( 2017-11-13 11:56:41 -0600 )edit

It only says:

flags Parameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.

Which flags can I use? What does each flag do?

Kelvin gravatar imageKelvin ( 2017-11-13 12:00:40 -0600 )edit

@sturkmen, what is a 'new cascade'? I don't get it.

Kelvin gravatar imageKelvin ( 2017-11-13 12:01:47 -0600 )edit

I understand that you can set this value to 0 if you use a new format for cascade classifier. I think source code is here

Flags for old cascade classifier are here

LBerger gravatar imageLBerger ( 2017-11-13 12:14:02 -0600 )edit

Ok, I see that the flags parameter is only being used by the Old Format Cascade, but I still don't know if I'm using the 'old format cascade' or the 'new format cascade'. I'm using OpenCV 3.1.0 with Python 2.7. Thanks for the help.

Kelvin gravatar imageKelvin ( 2017-11-13 12:29:27 -0600 )edit

you can find old format cascades here. you can use them if you want and with those cascades flags are still meaningful. but with new cascades flags change nothing.

sturkmen gravatar imagesturkmen ( 2017-11-13 12:44:22 -0600 )edit

Thanks @sturkmen, so, these are the 'new format cascades'?

Kelvin gravatar imageKelvin ( 2017-11-13 12:55:37 -0600 )edit