From 9414d3c1bb47b81d2b7a2c1eb4697d4f106bc9fc Mon Sep 17 00:00:00 2001 From: ck-zhang Date: Thu, 27 Feb 2025 09:06:07 +0800 Subject: [PATCH] Rotation as feature --- gaze_estimator.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gaze_estimator.py b/gaze_estimator.py index c852478..c31e8d8 100644 --- a/gaze_estimator.py +++ b/gaze_estimator.py @@ -105,6 +105,11 @@ class GazeEstimator: eye_landmarks = rotated_points[subset_indices] features = eye_landmarks.flatten() + yaw = np.arctan2(R[1, 0], R[0, 0]) + pitch = np.arctan2(-R[2, 0], np.sqrt(R[2, 1] ** 2 + R[2, 2] ** 2)) + roll = np.arctan2(R[2, 1], R[2, 2]) + features = np.concatenate([features, [yaw, pitch, roll]]) + # Blink detection left_eye_inner = np.array([landmarks[133].x, landmarks[133].y]) left_eye_outer = np.array([landmarks[33].x, landmarks[33].y]) @@ -126,6 +131,7 @@ class GazeEstimator: EAR = (left_EAR + right_EAR) / 2 blink_detected = EAR < 0.2 + return features, blink_detected def train(self, X, y, alpha=1.0, variable_scaling=None):