aboutsummaryrefslogtreecommitdiff
path: root/src/argaze.test/ArUcoMarkers/ArUcoDetector.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/argaze.test/ArUcoMarkers/ArUcoDetector.py')
-rw-r--r--src/argaze.test/ArUcoMarkers/ArUcoDetector.py34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/argaze.test/ArUcoMarkers/ArUcoDetector.py b/src/argaze.test/ArUcoMarkers/ArUcoDetector.py
index 403d1a6..06c56f5 100644
--- a/src/argaze.test/ArUcoMarkers/ArUcoDetector.py
+++ b/src/argaze.test/ArUcoMarkers/ArUcoDetector.py
@@ -51,8 +51,8 @@ class TestArUcoDetectorClass(unittest.TestCase):
self.assertEqual(aruco_detector.dictionary.name, 'DICT_ARUCO_ORIGINAL')
self.assertEqual(aruco_detector.marker_size, 3)
self.assertIsNone(numpy.testing.assert_array_equal(aruco_detector.optic_parameters.dimensions, [0, 0]))
- self.assertEqual(aruco_detector.detected_markers_number, 0)
- self.assertEqual(aruco_detector.detected_markers, {})
+ self.assertEqual(aruco_detector.detected_markers_number(), 0)
+ self.assertEqual(aruco_detector.detected_markers(), {})
aruco_dictionary = ArUcoMarkersDictionary.ArUcoMarkersDictionary('DICT_APRILTAG_16h5')
aruco_detector = ArUcoDetector.ArUcoDetector(aruco_dictionary, 5.2)
@@ -61,8 +61,8 @@ class TestArUcoDetectorClass(unittest.TestCase):
self.assertEqual(aruco_detector.dictionary.name, 'DICT_APRILTAG_16h5')
self.assertEqual(aruco_detector.marker_size, 5.2)
self.assertIsNone(numpy.testing.assert_array_equal(aruco_detector.optic_parameters.dimensions, [0, 0]))
- self.assertEqual(aruco_detector.detected_markers_number, 0)
- self.assertEqual(aruco_detector.detected_markers, {})
+ self.assertEqual(aruco_detector.detected_markers_number(), 0)
+ self.assertEqual(aruco_detector.detected_markers(), {})
def test_from_json(self):
"""Test ArUcoDetector creation."""
@@ -94,24 +94,24 @@ class TestArUcoDetectorClass(unittest.TestCase):
# Check ArUcoMarker detection
aruco_detector.detect_markers(image)
- self.assertEqual(aruco_detector.detected_markers_number, 1)
+ self.assertEqual(aruco_detector.detected_markers_number(), 1)
- self.assertEqual(aruco_detector.detected_markers[0].dictionary, aruco_detector.dictionary)
- self.assertEqual(aruco_detector.detected_markers[0].identifier, 0)
- self.assertEqual(aruco_detector.detected_markers[0].size, 3)
+ self.assertEqual(aruco_detector.detected_markers()[0].dictionary, aruco_detector.dictionary)
+ self.assertEqual(aruco_detector.detected_markers()[0].identifier, 0)
+ self.assertEqual(aruco_detector.detected_markers()[0].size, 3)
# Check corner positions with -/+ 10 pixels precision
- self.assertIsNone(numpy.testing.assert_almost_equal(aruco_detector.detected_markers[0].corners[0][0].astype(int), numpy.array([3823, 2073]), decimal=-1))
- self.assertIsNone(numpy.testing.assert_almost_equal(aruco_detector.detected_markers[0].corners[0][1].astype(int), numpy.array([4177, 2073]), decimal=-1))
- self.assertIsNone(numpy.testing.assert_almost_equal(aruco_detector.detected_markers[0].corners[0][2].astype(int), numpy.array([4177, 2427]), decimal=-1))
- self.assertIsNone(numpy.testing.assert_almost_equal(aruco_detector.detected_markers[0].corners[0][3].astype(int), numpy.array([3823, 2427]), decimal=-1))
+ self.assertIsNone(numpy.testing.assert_almost_equal(aruco_detector.detected_markers()[0].corners[0][0].astype(int), numpy.array([3823, 2073]), decimal=-1))
+ self.assertIsNone(numpy.testing.assert_almost_equal(aruco_detector.detected_markers()[0].corners[0][1].astype(int), numpy.array([4177, 2073]), decimal=-1))
+ self.assertIsNone(numpy.testing.assert_almost_equal(aruco_detector.detected_markers()[0].corners[0][2].astype(int), numpy.array([4177, 2427]), decimal=-1))
+ self.assertIsNone(numpy.testing.assert_almost_equal(aruco_detector.detected_markers()[0].corners[0][3].astype(int), numpy.array([3823, 2427]), decimal=-1))
# Check marker pose estimation
aruco_detector.estimate_markers_pose([0])
# Check marker translation with -/+ 0.1 cm precision and rotation with -/+ 0.001 radian precision
- self.assertIsNone(numpy.testing.assert_almost_equal(aruco_detector.detected_markers[0].translation, numpy.array([33.87, 19.05, 0.]), decimal=1))
- self.assertIsNone(numpy.testing.assert_almost_equal(aruco_detector.detected_markers[0].rotation, numpy.array([[1., 0., 0.], [0., -1., 0.], [0., 0., -1.]]), decimal=3))
+ self.assertIsNone(numpy.testing.assert_almost_equal(aruco_detector.detected_markers()[0].translation, numpy.array([33.87, 19.05, 0.]), decimal=1))
+ self.assertIsNone(numpy.testing.assert_almost_equal(aruco_detector.detected_markers()[0].rotation, numpy.array([[1., 0., 0.], [0., -1., 0.], [0., 0., -1.]]), decimal=3))
# Check detect metrics
detect_count, markers_count = aruco_detector.detection_metrics
@@ -131,9 +131,9 @@ class TestArUcoDetectorClass(unittest.TestCase):
# Check ArUcoMarker board detection
aruco_detector.detect_board(image, aruco_board, aruco_board.markers_number)
- self.assertEqual(aruco_detector.board_corners_number, aruco_board.corners_number)
- self.assertEqual(len(aruco_detector.board_corners), 24)
- self.assertEqual(len(aruco_detector.board_corners_identifier), 24)
+ self.assertEqual(aruco_detector.board_corners_number(), aruco_board.corners_number)
+ self.assertEqual(len(aruco_detector.board_corners()), 24)
+ self.assertEqual(len(aruco_detector.board_corners_identifier()), 24)
if __name__ == '__main__':