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

Function affine_transform

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

Apply an affine transformation to the points. Args: pt (np.ndarray): a 2 dimensional point to be transformed trans_mat (np.ndarray): 2x3 matrix of an affine transform Returns: np.ndarray: Transformed points.

(pt, trans_mat)

Source from the content-addressed store, hash-verified

247
248
249def affine_transform(pt, trans_mat):
250 """Apply an affine transformation to the points.
251
252 Args:
253 pt (np.ndarray): a 2 dimensional point to be transformed
254 trans_mat (np.ndarray): 2x3 matrix of an affine transform
255
256 Returns:
257 np.ndarray: Transformed points.
258 """
259 assert len(pt) == 2
260 new_pt = np.array(trans_mat) @ np.array([pt[0], pt[1], 1.])
261
262 return new_pt
263
264
265def _get_3rd_point(a, b):

Callers 2

__call__Method · 0.90
__call__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected