1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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()
|