skywrace

chore: Adjust pin group to set right bound

......@@ -44,6 +44,11 @@ def main():
pred = prob.argmax(axis=-1)
return True if pred[0] == 1 else False
def get_eye_open_dlib(frame, bound):
l, r = min(map(lambda x: x[0], bound)), max(map(lambda x: x[0], bound))
t, b = min(map(lambda x: x[1], bound)), max(map(lambda x: x[1], bound))
cv2.rectangle(frame, (l,t), (r,b), (0,255,0), 2)
while True:
frame = video.read()
frame = imutils.resize(frame, width=640)
......@@ -64,13 +69,12 @@ def main():
shape = predictor(gray, rect)
shape = face_utils.shape_to_np(shape)
r_eye = shape[36:43]
r_eye = shape[36:42]
l_eye = shape[42:48]
mouth = shape[48:69]
for (x, y) in l_eye:
cv2.circle(frame, (x, y), 2, (0, 255, 0), -1)
for (x, y) in r_eye:
cv2.circle(frame, (x, y), 2, (0, 255, 0), -1)
mouth = shape[48:]
get_eye_open_dlib(frame, r_eye)
get_eye_open_dlib(frame, l_eye)
for (x, y) in mouth:
cv2.circle(frame, (x, y), 2, (0, 255, 0), -1)
......