From 2b5c1396705133f1fb9f3fe8227b703ede05b3e7 Mon Sep 17 00:00:00 2001 From: Sefik Ilkin Serengil Date: Sun, 24 Mar 2024 16:34:01 +0000 Subject: [PATCH] update alignment logic now, left eye is the one on the left with respect to the person instead of observer --- deepface/modules/detection.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deepface/modules/detection.py b/deepface/modules/detection.py index e3042e4..6089443 100644 --- a/deepface/modules/detection.py +++ b/deepface/modules/detection.py @@ -201,8 +201,8 @@ def align_face( Align a given image horizantally with respect to their left and right eye locations Args: img (np.ndarray): pre-loaded image with detected face - left_eye (list or tuple): coordinates of left eye with respect to the you - right_eye(list or tuple): coordinates of right eye with respect to the you + left_eye (list or tuple): coordinates of left eye with respect to the person itself + right_eye(list or tuple): coordinates of right eye with respect to the person itself Returns: img (np.ndarray): aligned facial image """ @@ -214,6 +214,6 @@ def align_face( if img.shape[0] == 0 or img.shape[1] == 0: return img, 0 - angle = float(np.degrees(np.arctan2(right_eye[1] - left_eye[1], right_eye[0] - left_eye[0]))) + angle = float(np.degrees(np.arctan2(left_eye[1] - right_eye[1], left_eye[0] - right_eye[0]))) img = np.array(Image.fromarray(img).rotate(angle)) return img, angle