mirror of
https://github.com/iperov/DeepFaceLive
synced 2025-07-15 09:33:45 -07:00
_
This commit is contained in:
parent
2c61f5225b
commit
081dde23c7
1 changed files with 7 additions and 3 deletions
|
@ -22,6 +22,10 @@ class Affine2DMat(np.ndarray):
|
||||||
def __init__(self, values):
|
def __init__(self, values):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def identity():
|
||||||
|
return Affine2DMat([[1,0,0],[0,1,0]])
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def umeyama(src, dst, estimate_scale=True):
|
def umeyama(src, dst, estimate_scale=True):
|
||||||
"""
|
"""
|
||||||
|
@ -156,6 +160,9 @@ class Affine2DUniMat(Affine2DMat):
|
||||||
same as Affine2DMat but for transformation of uniform coordinates
|
same as Affine2DMat but for transformation of uniform coordinates
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def identity(): return Affine2DMat.identity().as_uni_mat()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def umeyama(src, dst, estimate_scale=True): return Affine2DMat.umeyama(src, dst, estimate_scale=estimate_scale).as_uni_mat()
|
def umeyama(src, dst, estimate_scale=True): return Affine2DMat.umeyama(src, dst, estimate_scale=estimate_scale).as_uni_mat()
|
||||||
|
|
||||||
|
@ -188,11 +195,8 @@ class Affine2DUniMat(Affine2DMat):
|
||||||
src_pts = np.float32([(0,0),(1,0),(0,1)])
|
src_pts = np.float32([(0,0),(1,0),(0,1)])
|
||||||
dst_pts = self.transform_points(src_pts)
|
dst_pts = self.transform_points(src_pts)
|
||||||
src_pts += (utw, uth)
|
src_pts += (utw, uth)
|
||||||
|
|
||||||
return Affine2DUniMat.from_3_pairs(src_pts, dst_pts)
|
return Affine2DUniMat.from_3_pairs(src_pts, dst_pts)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def to_exact_mat(self, sw : float, sh: float, tw: float, th: float) -> 'Affine2DMat':
|
def to_exact_mat(self, sw : float, sh: float, tw: float, th: float) -> 'Affine2DMat':
|
||||||
"""
|
"""
|
||||||
calculate exact Affine2DMat using provided source and target sizes
|
calculate exact Affine2DMat using provided source and target sizes
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue