skywrace

feat: Check able to detect mouth

......@@ -10,6 +10,7 @@ import pygame
def main():
leye = cv2.CascadeClassifier('pre_trained/haarcascade_lefteye_2splits.xml')
reye = cv2.CascadeClassifier('pre_trained/haarcascade_righteye_2splits.xml')
mouth_class = cv2.CascadeClassifier('pre_trained/haarcascade_mcs_mouth.xml')
model = load_model('model/eyes_weight.h5')
pygame.mixer.init()
warning_sound = pygame.mixer.Sound('asset/windsheld.mp3')
......@@ -47,9 +48,14 @@ def main():
L, gray = lr.light_removing(frame)
left_eye = leye.detectMultiScale(gray)
right_eye = reye.detectMultiScale(gray)
mouth = mouth_class.detectMultiScale(gray)
left_eye_open = get_eye_open(frame, left_eye)
right_eye_open = get_eye_open(frame, right_eye)
# print mouth bound
for (x,y,w,h) in mouth:
cv2.rectangle(frame, (x,y), (x+w,y+h), (0,255,0), 2)
both_eyes_closed = False
if left_eye_open != None or right_eye_open != None:
both_eyes_closed = not left_eye_open and not right_eye_open
......
This diff could not be displayed because it is too large.