COSIE.image_preprocessing.transform_coordinates

transform_coordinates(coords, homography_matrix, transform_type='affine')[source]

Apply a geometric transformation matrix (e.g., from generate_homograph) to 2D coordinates.

Parameters

coordsnp.ndarray

Coordinates to be transformed, of shape (N, 2).

homography_matrixnp.ndarray

The transformation matrix. Shape must be (2, 3) for “rigid” or (3, 3) for “affine”.

transform_typestr, optional

The type of transformation to apply. Must be one of {“rigid”, “affine”}, and must match the shape of homography_matrix. Default is “affine”.

Returns

transformed_coordsnp.ndarray

Transformed 2D coordinates, with shape (N, 2).