Hello,
Sorry if the title is not clear enough, I will try to explain it better. I have a picture and I know there is only one face inside, i would like to know the best way to find that face. For the moment, I'm doing this :

faceClassifier.detectMultiScale(img, faces, 1.2, 1, Objdetect.CASCADE_FIND_BIGGEST_OBJECT | Objdetect.CASCADE_DO_ROUGH_SEARCH, new Size(img.rows()/5, img.cols()/5), new Size(img.rows(), img.cols()));


But with this, I'm not getting the "best" face, but the bigger one, and I think it could result in an oversized rectangle around the face.
I could set minNeighbors to a high value, but sometimes, the face won't be good enough to be well detected, so i should not discard any candidate, because I should always find one !

Florian

edit retag close merge delete

Sort by » oldest newest most voted

I am just throwing this out there without any real science behind it but... how about setting the number of minNeighbors to a high value and, if you don't find a face, iteratively reduce the number of minNeighbors until you find one?

more

Thanks, it could work of course, but performance will be a pain... I've simplified my problem, but i'm building a real-time application on Android, so it's not really possible to do that... I'm going to look around the grouping function, because I can get every rectangle by setting minNeighbors to 0, and maybe I can make my own grouping function, remembering how many rectangles were merged to build a rectangle...

( 2012-11-14 03:26:41 -0500 )edit

Hi, I think what the algorithm does is it finds the first response of the face and returns you the bounding box. So one approach to get a better localization would be to use the first returned bounding box, and then use this region of interest ROI to localize it better using a proper search. Hope this could reduce the time consumed to detect a face.

If the face is big in size that you want to detect then setting to 1.3 instead of 1.2 could also help a bit. I donot know for what application (Face recognition) that you are going to use it for, so it might depend on that finally, if you want to have better localization or just know that there is a face. Thanks

more

Official site

GitHub

Wiki

Documentation