The program for turning LEDs on/off and tracking a human face is called Facetrackingrobot.cpp, and you can download it from the Chapter08 folder of this book's GitHub repository.
In the Facetrackingrobot program, we will first detect the face, and then the left eye, right eye, and smile. Once the eyes and smile are detected, we will turn the LEDs on/off. After this, we will create a small dot in the center of the face rectangle, and then use this dot as a reference to move our robot.