mirror of
https://github.com/serengil/deepface.git
synced 2025-06-08 20:45:22 +00:00
Amend quirk behavior of mod operator
This commit is contained in:
parent
923f2cfb4c
commit
d0ffc1bfde
@ -164,11 +164,13 @@ def rotate_facial_area(
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# Normalize the witdh of the angle so we don't have to
|
# Normalize the witdh of the angle so we don't have to
|
||||||
# worry about rotations greater than 360 degrees
|
# worry about rotations greater than 360 degrees.
|
||||||
angle = angle % 360
|
# We workaround the quirky behavior of the modulo operator
|
||||||
|
# for negative angle values.
|
||||||
|
direction = (1, -1)[angle < 0]
|
||||||
|
angle = abs(angle) % 360
|
||||||
if angle == 0:
|
if angle == 0:
|
||||||
return facial_area # No rotation needed
|
return facial_area
|
||||||
direction = 1 if angle > 0 else -1
|
|
||||||
|
|
||||||
# Angle in radians
|
# Angle in radians
|
||||||
angle = angle * np.pi / 180
|
angle = angle * np.pi / 180
|
||||||
|
Loading…
x
Reference in New Issue
Block a user