Ask Your Question

Revision history [back]

You probably have to use facial landmark detection (try google it to have some more info). One of the libraries known to work well with OpenCV is Dlib. You could find an example of the face detection with a webcam here. There is plenty of other libraries, most of them easily compatible with OpenCV.

If you are interested to understand how to train these detectors, or create your own, the book: Mastering OpenCV with Practical Computer Vision Projects on the chapter 7 offers a good introduction to it. You could also have a look at the chapter 6 that could be of interest.