mirror of
https://github.com/iperov/DeepFaceLive
synced 2025-08-14 10:47:00 -07:00
FaceAligner: added 'head_mode', can be used with HEAD models.
This commit is contained in:
parent
96931d6619
commit
72166cc190
11 changed files with 177 additions and 40 deletions
|
@ -1,7 +1,23 @@
|
|||
import math
|
||||
|
||||
import numpy as np
|
||||
import numpy.linalg as npla
|
||||
|
||||
|
||||
def rotation_matrix_to_euler(R : np.ndarray) -> np.ndarray:
|
||||
sy = math.sqrt(R[0,0] * R[0,0] + R[1,0] * R[1,0])
|
||||
singular = sy < 1e-6
|
||||
if not singular :
|
||||
x = math.atan2(R[2,1] , R[2,2])
|
||||
y = math.atan2(-R[2,0], sy)
|
||||
z = math.atan2(R[1,0], R[0,0])
|
||||
else :
|
||||
x = math.atan2(-R[1,2], R[1,1])
|
||||
y = math.atan2(-R[2,0], sy)
|
||||
z = 0
|
||||
return np.array([x, y, z])
|
||||
|
||||
|
||||
def segment_length(p1 : np.ndarray, p2 : np.ndarray):
|
||||
"""
|
||||
p1 (2,)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue