Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
fixed face jitter
Browse files Browse the repository at this point in the history
  • Loading branch information
iperov committed Mar 18, 2020
1 parent 8a62242 commit 9b070e1
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions facelib/LandmarksProcessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,15 @@ def get_transform_mat (image_landmarks, output_size, face_type, scale=1.0):

# calc 3 points in global space to estimate 2d affine transform
if not remove_align:
l_t = np.array( [ np.round( g_c - tb_diag_vec*mod ),
np.round( g_c + bt_diag_vec*mod ),
np.round( g_c + tb_diag_vec*mod ) ] )
l_t = np.array( [ g_c - tb_diag_vec*mod,
g_c + bt_diag_vec*mod,
g_c + tb_diag_vec*mod ] )
else:
# remove_align - face will be centered in the frame but not aligned
l_t = np.array( [ np.round( g_c - tb_diag_vec*mod ),
np.round( g_c + bt_diag_vec*mod ),
np.round( g_c + tb_diag_vec*mod ),
np.round( g_c - bt_diag_vec*mod ),
l_t = np.array( [ g_c - tb_diag_vec*mod,
g_c + bt_diag_vec*mod,
g_c + tb_diag_vec*mod,
g_c - bt_diag_vec*mod,
] )

# get area of face square in global space
Expand All @@ -299,9 +299,9 @@ def get_transform_mat (image_landmarks, output_size, face_type, scale=1.0):
side = np.float32(math.sqrt(area) / 2)

# calc 3 points with unrotated square
l_t = np.array( [ np.round( g_c + [-side,-side] ),
np.round( g_c + [ side,-side] ),
np.round( g_c + [ side, side] ) ] )
l_t = np.array( [ g_c + [-side,-side],
g_c + [ side,-side],
g_c + [ side, side] ] )

# calc affine transform from 3 global space points to 3 local space points size of 'output_size'
pts2 = np.float32(( (0,0),(output_size,0),(output_size,output_size) ))
Expand Down

0 comments on commit 9b070e1

Please sign in to comment.