1adrianb / face-alignment

:fire: 2D and 3D Face alignment library build using pytorch
https://www.adrianbulat.com
BSD 3-Clause "New" or "Revised" License
6.88k stars 1.33k forks source link

Detect eye blink? #345

Open zhu2bowen opened 11 months ago

zhu2bowen commented 11 months ago

Are the ret landmarks suitable to compute EAR? more see https://pyimagesearch.com/2017/04/24/eye-blink-detection-opencv-python-dlib/ def eye_aspect_ratio(eye):

compute the euclidean distances between the two sets of

# vertical eye landmarks (x, y)-coordinates
A = dist.euclidean(eye[1], eye[5])
B = dist.euclidean(eye[2], eye[4])

# compute the euclidean distance between the horizontal
# eye landmark (x, y)-coordinates
C = dist.euclidean(eye[0], eye[3])

# compute the eye aspect ratio
ear = (A + B) / (2.0 * C)

# return the eye aspect ratio
return ear