I trained a cascade-LBP to detect Lollipops with 1000 images, now I'm trying to "adapt" the openCV HAAR-Cascade example to use my LBP trained .xml but I'm not sure about the "HAAR_SCALE_IMAGE" flag, I read that optimizes the downscale to increase the HAAR features is it right to use it with LBP?

//-- Detect Lollipops lollipops_cascade.detectMultiScale( frame_gray, lollipops, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(30, 30) );

An example of imput image: Lollipops

For more info: http://docs.opencv.org/2.4/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.html


2 Answers 2


The OpenCV documentation suggests using CASCADE_SCALE_IMAGE when performing a detectMultiScale with LBP features.

lollipops_cascade.detectMultiScale(frame_gray, lollipops,1.1, 2, 0|CASCADE_SCALE_IMAGE, Size(30, 30));

Even though, it works perfectly with CV_HAAR_SCALE_IMAGE flag instead of CASCADE_SCALE_IMAGE.


According to EMGU, which is an .NET wrapper for OpenCV, and sometimes has way better documentation than OpenCV,

If it is set, the function uses Canny edge detector to reject some image regions that contain too few or too much edges and thus can not contain the searched object. The particular threshold values are tuned for face detection and in this case the pruning speeds up the processing

For each scale factor used the function will downscale the image rather than "zoom" the feature coordinates in the classifier cascade. Currently, the option can only be used alone, i.e. the flag can not be set together with the others

If it is set, the function finds the largest object (if any) in the image. That is, the output sequence will contain one (or zero) element(s)

It should be used only when CV_HAAR_FIND_BIGGEST_OBJECT is set and min_neighbors > 0. If the flag is set, the function does not look for candidates of a smaller size as soon as it has found the object (with enough neighbor candidates) at the current scale. Typically, when min_neighbors is fixed, the mode yields less accurate (a bit larger) object rectangle than the regular single-object mode (flags=CV_HAAR_FIND_BIGGEST_OBJECT), but it is much faster, up to an order of magnitude. A greater value of min_neighbors may be specified to improve the accuracy.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.