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

Function warp_affine_joints

PATH/core/data/transforms/post_transforms.py:337–353  ·  view source on GitHub ↗

Apply affine transformation defined by the transform matrix on the joints. Args: joints (np.ndarray[..., 2]): Origin coordinate of joints. mat (np.ndarray[3, 2]): The affine matrix. Returns: matrix (np.ndarray[..., 2]): Result coordinate of joints.

(joints, mat)

Source from the content-addressed store, hash-verified

335
336
337def warp_affine_joints(joints, mat):
338 """Apply affine transformation defined by the transform matrix on the
339 joints.
340
341 Args:
342 joints (np.ndarray[..., 2]): Origin coordinate of joints.
343 mat (np.ndarray[3, 2]): The affine matrix.
344
345 Returns:
346 matrix (np.ndarray[..., 2]): Result coordinate of joints.
347 """
348 joints = np.array(joints)
349 shape = joints.shape
350 joints = joints.reshape(-1, 2)
351 return np.dot(
352 np.concatenate((joints, joints[:, 0:1] * 0 + 1), axis=1),
353 mat.T).reshape(shape)
354
355
356def _calc_distances(preds, targets, mask, normalize):

Callers 2

__call__Method · 0.90
__call__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected