This example shows you the CascadeClassifier class to detect objects in a video stream. Facial features detection using cascadeclassifiers
But I prefer using more robust methods to locate facial features. For example:
- You can use this paper to locate the position of the eyes. Bolme, D.S. "Average of Synthetic Exact Filters", IEEE Conference on Computer Vision and Pattern Recognition, 2009. CVPR 2009. PDF - Source Code
- You can also use a facial landmark detector. It will return you the four corner points of the eyes, corner of mouth, center of nose, and center of face. It does however require you to give it a bounding box of the face. Project page - PDF - Source Code