未验证 提交 186d64dc 编写于 作者: A Adam Geitgey 提交者: GitHub

Merge pull request #1118 from ariyapour/blink-detection-fix

Blink detection fix
......@@ -15,7 +15,6 @@ import face_recognition
import cv2
import time
from scipy.spatial import distance as dist
import keyboard as kb
EYES_CLOSED_SECONDS = 5
......@@ -57,7 +56,6 @@ def main():
cv2.rectangle(small_frame, left_eye[0], right_eye[-1], color, thickness)
cv2.imshow('Video', small_frame)
cv2.waitKey(1)
ear_left = get_ear(left_eye)
ear_right = get_ear(right_eye)
......@@ -75,11 +73,15 @@ def main():
while (asleep): #continue this loop until they wake up and acknowledge music
print("EYES CLOSED")
if (kb.is_pressed('space')):
if cv2.waitKey(1) == 32: #Wait for space key
asleep = False
print("EYES OPENED")
closed_count = 0
process = not process
key = cv2.waitKey(1) & 0xFF
if key == ord("q"):
break
def get_ear(eye):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册