if ear < EYE_AR_THRESH:
COUNTER += 1
if COUNTER >= EYE_AR_CONSEC_FRAMES:
alarm_sound.play()
else:
COUNTER = 0
if distance > MAR:
current_time = time.time()
if current_time - start_time <= 20:
yawn_counter += 1
cv2.putText(frame, f"Yawn count: {yawn_counter:.2f}", (10, 60),
cv2.FONT_HERSHEY_SIMPLEX, 0.7, (0, 0, 255), 2)
else:
if yawn_counter >= YAWN_COUNTER_THRESHOLD:
alarm_sound.play()
cv2.putText(frame, "YAWN ALERT!", (10, 30),
cv2.FONT_HERSHEY_SIMPLEX, 0.7, (0, 0, 255), 2)
yawn_counter = 0
start_time = time.time()
This is my code I want to implement gaze tracking but can't do the code. I could not figure out how to implement the code and as well as the code.