Showing
2 changed files
with
6 additions
and
0 deletions
... | @@ -10,6 +10,7 @@ import pygame | ... | @@ -10,6 +10,7 @@ import pygame |
10 | def main(): | 10 | def main(): |
11 | leye = cv2.CascadeClassifier('pre_trained/haarcascade_lefteye_2splits.xml') | 11 | leye = cv2.CascadeClassifier('pre_trained/haarcascade_lefteye_2splits.xml') |
12 | reye = cv2.CascadeClassifier('pre_trained/haarcascade_righteye_2splits.xml') | 12 | reye = cv2.CascadeClassifier('pre_trained/haarcascade_righteye_2splits.xml') |
13 | + mouth_class = cv2.CascadeClassifier('pre_trained/haarcascade_mcs_mouth.xml') | ||
13 | model = load_model('model/eyes_weight.h5') | 14 | model = load_model('model/eyes_weight.h5') |
14 | pygame.mixer.init() | 15 | pygame.mixer.init() |
15 | warning_sound = pygame.mixer.Sound('asset/windsheld.mp3') | 16 | warning_sound = pygame.mixer.Sound('asset/windsheld.mp3') |
... | @@ -47,9 +48,14 @@ def main(): | ... | @@ -47,9 +48,14 @@ def main(): |
47 | L, gray = lr.light_removing(frame) | 48 | L, gray = lr.light_removing(frame) |
48 | left_eye = leye.detectMultiScale(gray) | 49 | left_eye = leye.detectMultiScale(gray) |
49 | right_eye = reye.detectMultiScale(gray) | 50 | right_eye = reye.detectMultiScale(gray) |
51 | + mouth = mouth_class.detectMultiScale(gray) | ||
50 | 52 | ||
51 | left_eye_open = get_eye_open(frame, left_eye) | 53 | left_eye_open = get_eye_open(frame, left_eye) |
52 | right_eye_open = get_eye_open(frame, right_eye) | 54 | right_eye_open = get_eye_open(frame, right_eye) |
55 | + # print mouth bound | ||
56 | + for (x,y,w,h) in mouth: | ||
57 | + cv2.rectangle(frame, (x,y), (x+w,y+h), (0,255,0), 2) | ||
58 | + | ||
53 | both_eyes_closed = False | 59 | both_eyes_closed = False |
54 | if left_eye_open != None or right_eye_open != None: | 60 | if left_eye_open != None or right_eye_open != None: |
55 | both_eyes_closed = not left_eye_open and not right_eye_open | 61 | both_eyes_closed = not left_eye_open and not right_eye_open | ... | ... |
This diff could not be displayed because it is too large.
-
Please register or login to post a comment