def draw_eye_region(img: np.ndarray, face: c.Face): # left eye region x_l = face.get_left_eye().get_pos_eye().get_upper_left_corner().x y_l = face.get_left_eye().get_pos_eye().get_upper_left_corner().y cv2.rectangle(img, (x_l, y_l), (x_l + face.get_left_eye().get_pos_eye().width, y_l + face.get_left_eye().get_pos_eye().height), cons.COLOR_EYE_IND) # right eye region x_r = face.get_right_eye().get_pos_eye().get_upper_left_corner().x y_r = face.get_right_eye().get_pos_eye().get_upper_left_corner().y cv2.rectangle(img, (x_r, y_r), (x_r + face.get_right_eye().get_pos_eye().width, y_r + face.get_right_eye().get_pos_eye().height), cons.COLOR_EYE_IND)
def update_calibrate(self, face: m.Face): self.face = face if face.get_right_eye() and face.get_pos_outer_right_eye_corner(): if face.get_left_eye() and face.get_pos_outer_left_eye_corner(): self.find_vectors() if self.get_number_of_data() == cons.NUMBER_CALLIBRATE_DATA: self.mean_eye_vector = self.calculate_mean(self.eye_vector)
def draw_eye_pupils(img: np.ndarray, face: c.Face): c_l = face.get_left_eye().getPupil().getGlobalPosition() cv2.circle(img, (c_l.x, c_l.y), cons.RADIUS_PUPIL_IND, cons.COLOR_PUPIL_IND) c_r = face.get_right_eye().get_pupil().get_global_position_center() cv2.circle(img, (c_r.x, c_r.y), cons.RADIUS_PUPIL_IND, cons.COLOR_PUPIL_IND)