From c3c8f592a548c8a48a10a8a84816c47a94631eea Mon Sep 17 00:00:00 2001 From: ck-zhang Date: Tue, 1 Oct 2024 23:16:44 +0800 Subject: [PATCH] Add roll --- gaze_estimator.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gaze_estimator.py b/gaze_estimator.py index 789e901..fa2e886 100644 --- a/gaze_estimator.py +++ b/gaze_estimator.py @@ -62,9 +62,9 @@ class GazeEstimator: right_eye_bottom, ) - yaw, pitch = self._calculate_head_orientation(landmarks) + yaw, pitch, roll = self._calculate_head_orientation(landmarks) - features = np.hstack([left_pupil_rel, right_pupil_rel, [yaw, pitch]]) + features = np.hstack([left_pupil_rel, right_pupil_rel, [yaw, pitch, roll]]) # Blink detection left_eye_width = np.linalg.norm(left_eye_outer - left_eye_inner) @@ -117,7 +117,10 @@ class GazeEstimator: yaw = nose_tip[0] - eye_center[0] pitch = nose_tip[1] - eye_center[1] - return yaw, pitch + eye_line_vector = right_eye_outer - left_eye_outer + roll = np.arctan2(eye_line_vector[1], eye_line_vector[0]) + + return yaw, pitch, roll def train(self, X, y, alpha=1.0, variable_scaling=None): """