From dd9d080cda9a4454b43da3b0aa9d805a37c96d77 Mon Sep 17 00:00:00 2001 From: Aref Ariyapour Date: Wed, 22 Apr 2020 13:39:19 +0200 Subject: [PATCH] Fix exit key in blink detection example Set q for exiting the program. Move cv2.waitKey() outside the for loop that detects face landmarks. --- examples/blink_detection.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/blink_detection.py b/examples/blink_detection.py index dd7db2d..a6c3568 100644 --- a/examples/blink_detection.py +++ b/examples/blink_detection.py @@ -57,7 +57,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) @@ -80,6 +79,9 @@ def main(): closed_count = 0 process = not process + key = cv2.waitKey(1) & 0xFF + if key == ord("q"): + break def get_ear(eye): -- GitLab