Visualizing the features that Haar-based face detection programs use to find faces.
When you use face detection in Processing and OpenFrameworks you’re using an algorithm developed in 2001 called the Viola-Jones method. Though seemingly old, it’s still a robust and efficient way to detect faces in real time. It works great in Java, C++ and even Flash as you can see from these examples in Processing, OpenFrameworks, and Flash.
The algorithm looks at the image (or video) and tries to match the Haar features (in black and white) to features of the image. The more features match, the more likely it is that the image contains a face. As its name implies, a cascade is made of a series of feature-tests. For a face to be detected, the algorithm must match a cascade or series of features in the expected locations. The examples above and below show the Haar features from the cascade files that ship with OpenCV. For more information on how face detection works, I recommend starting with a 2007 article from Servo magazine about how face detection works.
To do: Find the order and weight of the trees in the cascade to determine which are the most and least important features. (NB: the image of Lena is popular test image for face detection.)
Tweet