From 2825f20e49d416a8edbf582812978cc708b92d48 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Mon, 19 Dec 2022 20:21:23 +0100 Subject: Removing rotation matrix assertion. Using matrix transposition instead of inverse. --- src/argaze/ArUcoMarkers/ArUcoScene.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'src') diff --git a/src/argaze/ArUcoMarkers/ArUcoScene.py b/src/argaze/ArUcoMarkers/ArUcoScene.py index 2ca1542..3ea4b43 100644 --- a/src/argaze/ArUcoMarkers/ArUcoScene.py +++ b/src/argaze/ArUcoMarkers/ArUcoScene.py @@ -106,8 +106,6 @@ class ArUcoScene(): # Rotation matrix from A place to B place AB = B.dot(A.T) - #assert(self.__is_rotation_matrix(AB)) - # Calculate axis-angle representation of AB rotation matrix angle = numpy.rad2deg(numpy.arccos((numpy.trace(AB) - 1) / 2)) @@ -285,7 +283,7 @@ class ArUcoScene(): # RM = P M = numpy.array([marker_x_axis, marker_y_axis, marker_z_axis]) P = numpy.array([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]) - R = P.dot(numpy.linalg.inv(M)) + R = P.dot(M.T) marker = markers[name] @@ -294,12 +292,6 @@ class ArUcoScene(): except IOError: raise IOError(f'File not found: {obj_filepath}') - def __is_rotation_matrix(self, R): - """Checks if a matrix is a valid rotation matrix.""" - - I = numpy.identity(3, dtype = R.dtype) - return numpy.linalg.norm(I - numpy.dot(R.T, R)) < 1e-6 - def __normalise_marker_pose(self, place, R, T): # Transform marker rotation into scene rotation matrix @@ -366,8 +358,6 @@ class ArUcoScene(): # Rotation matrix from A marker to B marker AB = B_marker.rotation.dot(A_marker.rotation.T) - assert(self.__is_rotation_matrix(AB)) - # Calculate axis-angles representation of AB rotation matrix angle = numpy.rad2deg(numpy.arccos((numpy.trace(AB) - 1) / 2)) expected_angle = self.__angle_cache[A_name][B_name] -- cgit v1.1