Blink counter based on OpenCV development

 A free source code download link is provided at the end of the article

In this tutorial, we will see how to create an eye blink detector/counter using Dlib, Python and OpenCV.

We will first use Dlib's face detector to detect faces in the video. Then we'll use the shape predictor in Dlib to determine where the eyes are on the face.

Finally, we'll use the eye's landmarks to calculate the eye's aspect ratio, and use that to determine if the person is blinking.

The aspect ratio is equal to A/B in the picture above. When the eyes are closed, the aspect ratio approaches zero, and when the eyes are open, the aspect ratio remains approximately constant. Therefore, we can compare the eye aspect ratio with a predefined threshold to detect eye blinks.

Guess you like

Origin blog.csdn.net/tianqiquan/article/details/131525003