As part of your OpenCV setup, you probably have a directory called haarcascades
. It contains cascades that are trained for certain subjects using tools that come with OpenCV. The directory's full path depends on your system and method of setting up OpenCV, as follows:
<unzip_destination>/data/haarcascades
<unzip_destination>/data/haarcascades
/opt/local/share/OpenCV/haarcascades
haarcascades
file is not included; to get it, download the source archivehaarcascades
file is not included; to get it, download the source archiveIf you cannot find haarcascades
, then download the source archive from http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.3/OpenCV-2.4.3.tar.bz2/download (or the Windows self-extracting ZIP from http://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.4.3/OpenCV-2.4.3.exe/download), unzip it, and look for <unzip_destination>/data/haarcascades
.
Once you find haarcascades
, create a directory called cascades
in the same folder as cameo.py
and copy the following files from haarcascades
into cascades
:
haarcascade_frontalface_alt.xml haarcascade_eye.xml haarcascade_mcs_nose.xml haarcascade_mcs_mouth.xml
As their names suggest, these cascades are for tracking faces, eyes, noses, and mouths. They require a frontal, upright view of the subject. We will use them later when building a high-level tracker. If you are curious about how these data sets are generated, refer to Appendix B, Generating Haar Cascades for Custom Targets. With a lot of patience and a powerful computer, you can make your own cascades, trained for various types of objects.