aboutsummaryrefslogtreecommitdiff
path: root/src/argaze.test/ArUcoMarkers/ArUcoScene.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/argaze.test/ArUcoMarkers/ArUcoScene.py')
-rw-r--r--src/argaze.test/ArUcoMarkers/ArUcoScene.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/argaze.test/ArUcoMarkers/ArUcoScene.py b/src/argaze.test/ArUcoMarkers/ArUcoScene.py
new file mode 100644
index 0000000..537469e
--- /dev/null
+++ b/src/argaze.test/ArUcoMarkers/ArUcoScene.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+
+import unittest
+import os
+import math
+
+from argaze.ArUcoMarkers import ArUcoScene
+
+import cv2 as cv
+import numpy
+
+class TestArUcoSceneClass(unittest.TestCase):
+ """Test ArUcoScene class."""
+
+ def test_new(self):
+ """Test ArUcoScene creation."""
+
+ # Edit file path
+ current_directory = os.path.dirname(os.path.abspath(__file__))
+ obj_filepath = os.path.join(current_directory, 'utils/scene.obj')
+
+ # Load file
+ aruco_scene = ArUcoScene.ArUcoScene(1, obj_filepath)
+
+ # Check ArUcoScene creation
+ self.assertEqual(len(aruco_scene.places), 2)
+ self.assertIsNone(numpy.testing.assert_array_equal(aruco_scene.identifiers, [0, 1]))
+
+ self.assertIsNone(numpy.testing.assert_array_equal(aruco_scene.places['DICT_ARUCO_ORIGINAL#0'].translation, [0.5, 0.5, 0.]))
+ self.assertIsNone(numpy.testing.assert_array_equal(aruco_scene.places['DICT_ARUCO_ORIGINAL#0'].rotation, [[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]))
+
+ self.assertIsNone(numpy.testing.assert_array_equal(aruco_scene.places['DICT_ARUCO_ORIGINAL#1'].translation, [10.5, 10.5, 0.]))
+ self.assertIsNone(numpy.testing.assert_array_equal(aruco_scene.places['DICT_ARUCO_ORIGINAL#1'].rotation, [[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]))
+
+
+if __name__ == '__main__':
+
+ unittest.main() \ No newline at end of file