MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / affine_align

Function affine_align

PATH/helper/align.py:5–20  ·  view source on GitHub ↗
(img, landmark=None, **kwargs)

Source from the content-addressed store, hash-verified

3from skimage import transform as trans
4
5def affine_align(img, landmark=None, **kwargs):
6 M = None
7 src = np.array([
8 [38.2946, 51.6963],
9 [73.5318, 51.5014],
10 [56.0252, 71.7366],
11 [41.5493, 92.3655],
12 [70.7299, 92.2041] ], dtype=np.float32 )
13 # src=src * 224 / 112
14
15 dst = landmark.astype(np.float32)
16 tform = trans.SimilarityTransform()
17 tform.estimate(dst, src)
18 M = tform.params[0:2,:]
19 warped = cv2.warpAffine(img, M, (112, 112), borderValue = 0.0)
20 return warped
21
22
23def kestrel_get_similar_matrix(src_points, dst_points):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected