The purpose of this project is to explore Viola Jones object detection algorithms. Harr Cascade detection is used for this purpose and leverages pre-existing OpenCV algorithms. Facial recognition is used as the first study and later nested classifiers are used for eyes and glasses. Several facial types are considered under different conditions and the advantages and disadvantages to Viola Jones are discussed. Framework
The framework used for this project was OpenCV 3.0 compiled in Visual Studio 2013 and running on windows. Frame processing times were well under 15ms, even when many faces appeared in the frame at once, and the code ran smoothly on a modern laptop with an attached webcam. Training
The Cascade Classifier Training used by the Harr object detection functions were pre-built using the OpenCV opencv_traincascade function. Three classifiers were used, one for faces, one for eyes, and one for glasses. The eyes and glasses classifiers are used in a nested-cascade setup where the search space is inside the already detected face. Implementation
Once loading the desired classifier xml files, the OpenCV code enters a loop to pull frames from the attached camera and runs CascadeClassifier.detectMultiScale() on each frame. The results (faces in this case) are then passed to the nested classifier if one is chosen. For each feature found, a circle is drawn around that feature. Results
Following are screenshots of the results. Clearly having a large beard made detecting my own face more difficult, but surprisingly the Harr classifier did well. Testing on other faces worked almost always, with a few undetected faces and a few false positives. Figure 1 and 2: Single face detection, no nested classifiers
As can be seen in the above figures 3-6, several faces were not detected at oblique angles or because of obstructions. Also figure 3 has two false positives in the lower left, and the baby face was missed in fig. 6.