66
77from .coordinates import (
88 Cartesian ,
9+ HomographyMatrix ,
910 cartesian_to_legacy_polar ,
1011 cartesian_to_spherical ,
1112)
@@ -44,6 +45,13 @@ def from_apriltag_detection(
4445
4546 pixel_corners = [PixelCoordinate (* l ) for l in apriltag_detection .p ]
4647
48+ homography_matrix = HomographyMatrix (np .reshape (
49+ [apriltag_detection .H .data [i ] for i in range (9 )],
50+ (3 , 3 ),
51+ ).tolist ())
52+ # The homography matrix is a 2D transformation of a unit square to the
53+ # co-ordinates of the marker in the image
54+
4755 marker_id = apriltag_detection .id
4856
4957 # *************************************************************************
@@ -54,12 +62,9 @@ def from_apriltag_detection(
5462 id = marker_id ,
5563 certainty = apriltag_detection .goodness ,
5664 )
57- arr = [apriltag_detection .H .data [x ] for x in range (9 )]
58- homography = np .reshape (arr , (3 , 3 ))
59-
60- instance .update_pixel_coords (
65+ instance .update_2D_transforms (
6166 pixel_corners = pixel_corners ,
62- homography_matrix = homography ,
67+ homography_matrix = homography_matrix ,
6368 )
6469
6570 # We don't set coordinates in the absence of a camera model.
@@ -81,11 +86,11 @@ def from_apriltag_detection(
8186 return instance
8287
8388 # noinspection PyAttributeOutsideInit
84- def update_pixel_coords (
89+ def update_2D_transforms (
8590 self ,
8691 * ,
8792 pixel_corners : List [PixelCoordinate ],
88- homography_matrix
93+ homography_matrix : HomographyMatrix
8994 ):
9095 """Set the pixel coordinate information of the Token."""
9196
0 commit comments