@@ -76,7 +76,9 @@ def detect_faces(
76
76
77
77
- img (np.ndarray): The detected face as a NumPy array.
78
78
79
- - facial_area (FacialAreaRegion): The facial area region represented as x, y, w, h
79
+ - facial_area (FacialAreaRegion): The facial area region represented as x, y, w, h,
80
+ left_eye and right eye. left eye and right eye are eyes on the left and right
81
+ with respect to the person instead of observer.
80
82
81
83
- confidence (float): The confidence score associated with the detected face.
82
84
"""
@@ -123,13 +125,11 @@ def detect_faces(
123
125
img = img , left_eye = left_eye , right_eye = right_eye
124
126
)
125
127
rotated_x1 , rotated_y1 , rotated_x2 , rotated_y2 = rotate_facial_area (
126
- facial_area = (x , y , x + w , y + h ),
127
- angle = angle ,
128
- size = (img .shape [0 ], img .shape [1 ])
128
+ facial_area = (x , y , x + w , y + h ), angle = angle , size = (img .shape [0 ], img .shape [1 ])
129
129
)
130
130
detected_face = aligned_img [
131
- int (rotated_y1 ) : int (rotated_y2 ),
132
- int ( rotated_x1 ) : int ( rotated_x2 ) ]
131
+ int (rotated_y1 ) : int (rotated_y2 ), int ( rotated_x1 ) : int ( rotated_x2 )
132
+ ]
133
133
134
134
result = DetectedFace (
135
135
img = detected_face ,
@@ -143,9 +143,7 @@ def detect_faces(
143
143
144
144
145
145
def rotate_facial_area (
146
- facial_area : Tuple [int , int , int , int ],
147
- angle : float ,
148
- size : Tuple [int , int ]
146
+ facial_area : Tuple [int , int , int , int ], angle : float , size : Tuple [int , int ]
149
147
) -> Tuple [int , int , int , int ]:
150
148
"""
151
149
Rotate the facial area around its center.
0 commit comments