aboutsummaryrefslogtreecommitdiff
path: root/src/argaze.test/ArUcoMarkers/ArUcoScene.py
diff options
context:
space:
mode:
authorThéo de la Hogue2023-03-14 17:51:17 +0100
committerThéo de la Hogue2023-03-14 17:51:17 +0100
commitec6030d79f044a35d0bef0fdfb25e56a9c2e29b1 (patch)
tree78ef58201e1089eeb505e12ac543760dbcc7bec7 /src/argaze.test/ArUcoMarkers/ArUcoScene.py
parentcb74bbc61e64c4971a61a8a1328bd62418244795 (diff)
downloadargaze-ec6030d79f044a35d0bef0fdfb25e56a9c2e29b1.zip
argaze-ec6030d79f044a35d0bef0fdfb25e56a9c2e29b1.tar.gz
argaze-ec6030d79f044a35d0bef0fdfb25e56a9c2e29b1.tar.bz2
argaze-ec6030d79f044a35d0bef0fdfb25e56a9c2e29b1.tar.xz
Changing and testing ArUcoScene class.
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