Skip to content

Commit

Permalink
new: transform a single point
Browse files Browse the repository at this point in the history
  • Loading branch information
yxlao committed Apr 23, 2024
1 parent d679c12 commit 7e343a3
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions camtools/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,22 @@ def transform_points(points, transform_mat):
points_transformed = convert.from_homo(points_transformed)

return points_transformed


def transform_point(point, transform_mat):
"""
Transform a single point by a 4x4 matrix via homogenous coordinates projection.
Args:
point: (3,) array.
mat: (4, 4) array, the transformation matrix.
Returns:
(3,) array, the transformed point.
"""
sanity.assert_shape_3(point, name="point")
sanity.assert_shape_4x4(transform_mat, name="mat")

point_transformed = transform_points(point[None], transform_mat)[0]

return point_transformed

0 comments on commit 7e343a3

Please sign in to comment.