The program for detecting the eyes and smile is called SmilingFace.cpp, and you can download it from the Chapter08 folder of this book's GitHub repository.
Detecting the eyes and smile
Detecting the eyes
The SmilingFace.cpp program is basically an extension of the FaceDetection.cpp program, meaning that we will first find the region of interest, which is the face. Next, using the Haar CascadeClassifier for the eyes, we will detect the eyes and then draw circles around them.
Before writing the program, let's first understand the different eye CascadeClassifier that are available. OpenCV 4.0 has three main eye cascade classifiers:
- haarcascade_eye.xml: This classifier will detect both of the eyes simultaneously
- haarcascade_lefteye_2splits...