We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 923f2cf commit d0ffc1bCopy full SHA for d0ffc1b
deepface/detectors/DetectorWrapper.py
@@ -164,11 +164,13 @@ def rotate_facial_area(
164
"""
165
166
# Normalize the witdh of the angle so we don't have to
167
- # worry about rotations greater than 360 degrees
168
- angle = angle % 360
+ # worry about rotations greater than 360 degrees.
+ # We workaround the quirky behavior of the modulo operator
169
+ # for negative angle values.
170
+ direction = (1, -1)[angle < 0]
171
+ angle = abs(angle) % 360
172
if angle == 0:
- return facial_area # No rotation needed
- direction = 1 if angle > 0 else -1
173
+ return facial_area
174
175
# Angle in radians
176
angle = angle * np.pi / 180
0 commit comments