Ask Your Question
2

cascade classifier - very few haar cascades are working?

asked 2012-11-28 17:22:06 -0600

KatieM gravatar image

updated 2012-11-29 14:15:09 -0600

Hi everyone,

I have spent the past 3 or so hours trying to figure out what is wrong with my introductory attempts at getting haar cascades to detect facial features. I am just beginning to explore this topic so I am essentially just running the example code found here

http://docs.opencv.org/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.html#cascade-classifier

The problem is it doesn't detect my face or eyes! I have tried a few different cascades and the only one that detected anything was the lbpcascade_frontalface. Other than that I am getting zero results. Are these haar cascades highly unreliable or am I (more likely) doing something wrong in my code? My code is exactly what is found in the example.

Would love any thoughts people have and/or pointing me in the direction of basic examples of haar cascades would be helpful - it's very hard to find anything beyond the example I posted above.

The .xml files are in the correct place (as I mentioned I AM getting results for one lbpcascade) so I don't believe that is the problem.

Thanks!

UPDATE: Something worth noting is that when I use any of the haarcascades the data after the cascade is loaded is all null pointers except for a category "Old style cascade" which does have data. could this be the source of my problem? When I use the lbpcascade the data that is loaded does not have null pointers.

edit retag flag offensive close merge delete

Comments

Same problem, and also, it looks like here: http://answers.opencv.org/question/2673/changes-in-haar-detection-between-opencv-20-and/ the guy has also met this problem.

Lockywolf gravatar imageLockywolf ( 2012-12-21 06:04:05 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2012-11-29 02:21:50 -0600

elmiguelao gravatar image

You've got to be careful with the lightning conditions, haar classifiers are sensitive to this. Besides, there are two parameters, the pyramid iteration scaling (think 1.1 in the example you mention), and, more importantly, the minimum detected size (cvRect(30,30) in the example). The minimum size should ideally be different from eyes and face, and even related to each other. Try just reducing it substantially and see if you get better results. Finally, I recall a while ago figuring out that the Haar classifier does not take into account ROI, keep that in mind if you want to use the classification in real time apps, i.e. you'd need to implement that part with a bit of IplImage manipulation.

edit flag offensive delete link more

Comments

Thanks for your response. I've played around with the parameters quite a bit (and with the help of some researchers that use openCV all the time) and it hasn't helped. I'm thinking the error is the with the xml file (see my update above) though I don't really understand what exactly.

KatieM gravatar imageKatieM ( 2012-11-29 14:36:27 -0600 )edit

Question Tools

Stats

Asked: 2012-11-28 17:22:06 -0600

Seen: 3,555 times

Last updated: Nov 29 '12