I'm looking for a robust face detection algorithm/library, preferably in C (C++ is okay too; other languages I can port if necessary). I've used OpenCV's implementation in the past, but I don't think it's invariant to rotation. Doesn't need to be real-time, but it shouldn't be horrendously slow either (maybe one or two seconds per photo is fine). Looking for high reliability, and not a lot of false positives. Does anyone know of any good implementations?
The only thing I've worked with is Visionics FaceIt. It worked rather well, but last I knew was very, very, very far from being free (either as in beer or as in speech).
You could try taking a look at this library:
http://vasc.ri.cmu.edu/NNFaceDetector/
It shows in one of the test cases faces that are rotated. As you can see, it was done as a dissertation, so you can also read that paper as well, if you like.
Over on Code Project, someone posted a detailed description of a project for facial recognition as well as some C++ source code for the project and links to the libraries he used. His algorithm focuses on using color differences to find patches of skin and then testing to see if 19x19 pixel pictures match faces. I'm not familiar with all the libraries for facial recognition but reading through some of his code, many of methods and functions have CV in the name, so he may be using the OpenCV library but I'm not familiar with it so I'm not 100% sure. However, he does provide lots of explanation about his application and the source files so it may be a good starting point.
Check out this page on OpenCV Wiki about face detection using Haar-like features.
@floppydisk: The same guy posted another project implementing these Haar-like features for face detection.
The concept is not hard to understand and you could even implement it by yourself. Perhaps the most difficult part is constructing the cascade of boosted classifiers (but openCV has all of that readily implemented!)
Some other methods that can be used in face detection which can be made invariant to affine transformations include:
- Eigenfaces with SVD/PCA
- Fourier descriptors
- Statistical shape models (this paper in particular)
I haven't used Haar features for face detection, but from what I remember it might be more effective at detecting a face than eigenfaces/pca.
I have run into the issue about the rotation issues with the face. My thought is maybe you could try shape matching and attempt to correct the object. Try and oriented it for the normal head aspect ratio. I never got that far in my project with Eigenface, but let me know how that works out. That should be easy in matlab. :P