|There are, of course, other methods of implementation for face detection.
The first involves the use of classifier files. A classifier file is essentially a database, consisting of the possible objects you want should be detected in an image. In our case, it is the human face. In order to create a classifier file, you can use OpenCV's classifier creation utility. It begins by selecting two sets of images - positive samples and negative samples. The positive samples, by definition, consist of all the possible images of the objects in question. The negative samples tell the classifier what not to detect ,i.e. the background. With this information in hand, the object samples are superimposed on the background images in many possible locations and angles by the utility. Then it generates and 'trains' a classifier file on the basis of this data - much like a police dog is trained to detect certain things. The training often involves two or more stages. After the training process, the classifier file is ready.
Of course, the success rate of the classifier file depends on the quality and quantity of the sample set. The more, the better. I myself tried to create a classifier file based on all the images of classrooms we had taken, but when I applied it to test images, its detection rate was quite poor. OpenCV itself provides a set of classifier files, called Haar Classifier files, specifically meant for face detection. Its detection rate, though better, was not enough to use it outright in our software.
The second method was one devised by yours truly. I scanned the image from top to bottom in sets of small rectangular search areas. Now if a person is further from the camera, his image in the overall picture will be smaller. Therefore the initial area of the rectangles was small. This area progressively increased as more of the image was scanned. An area was said to be marked if its average pixel value was above a certain threshold. Then , 2-4 adjacent rectangles were assumed to have detected a person.
Obviously, due to its crude nature, its success rate was also poor, but with some refinement it can be bettered.