Face Detection
Simple Face Detection:
Face Detection with Eye Detection using CvHaarDetect:
For face detection I modified the official code from openCV, which can be found here:
http://opencv.willowgarage.com/wiki/FaceDetection
One of the problems I ran into when porting the code was that tekkotsu uses YUV images like this:
I had to convert them to RGB using an openCV method.
The code for face detection is pretty straight forward. It uses the Viola-Jones algorithm to detect facial features in an image using a Haar cascade file. My description of the algorithm is taken from here: http://twoday.tuwien.ac.at/EmotionDetection/
The Viola-Jones algorithm uses white and black rectangles, where the sum of the pixels in the white rectangle are subtracted from the sum of the pixels in the black rectrangle. The differences are then used to detect "features" in the image. A cascade classifier is then used to reject all sub-rectangles that do not match by using negative examples (eg for faces this would include a house or a tree) and finally accepting those instances which match. Below is an example of the first two features selected for face recognition: