diff options
Diffstat (limited to 'src/argaze.test/ArFeatures.py')
-rw-r--r-- | src/argaze.test/ArFeatures.py | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/src/argaze.test/ArFeatures.py b/src/argaze.test/ArFeatures.py deleted file mode 100644 index 765e9cf..0000000 --- a/src/argaze.test/ArFeatures.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env python - -""" """ - -__author__ = "Théo de la Hogue" -__credits__ = [] -__copyright__ = "Copyright 2023, Ecole Nationale de l'Aviation Civile (ENAC)" -__license__ = "BSD" - -import unittest -import os - -from argaze import ArFeatures - -import numpy - -class TestArEnvironmentClass(unittest.TestCase): - """Test ArEnvironment class.""" - - def test_from_json(self): - """Test ArEnvironment creation from json file.""" - - # Edit test environment file path - current_directory = os.path.dirname(os.path.abspath(__file__)) - json_filepath = os.path.join(current_directory, 'utils/environment.json') - - # Load test environment - ar_environment = ArFeatures.ArEnvironment.from_json(json_filepath) - - # Check environment meta data - self.assertEqual(ar_environment.name, "TestEnvironment") - - # Check ArUco detector - self.assertEqual(ar_environment.aruco_detector.dictionary.name, "DICT_ARUCO_ORIGINAL") - self.assertEqual(ar_environment.aruco_detector.marker_size, 3.0) - self.assertEqual(ar_environment.aruco_detector.parameters.cornerRefinementMethod, 3) - self.assertEqual(ar_environment.aruco_detector.parameters.aprilTagQuadSigma, 2) - self.assertEqual(ar_environment.aruco_detector.parameters.aprilTagDeglitch, 1) - - # Check ArUco detector optic parameters - self.assertEqual(ar_environment.aruco_detector.optic_parameters.rms, 1.0) - self.assertIsNone(numpy.testing.assert_array_equal(ar_environment.aruco_detector.optic_parameters.dimensions, [1920, 1080])) - self.assertIsNone(numpy.testing.assert_array_equal(ar_environment.aruco_detector.optic_parameters.K, [[1.0, 0.0, 1.0], [0.0, 1.0, 1.0], [0.0, 0.0, 1.0]])) - self.assertIsNone(numpy.testing.assert_array_equal(ar_environment.aruco_detector.optic_parameters.D, [-1.0, -0.5, 0.0, 0.5, 1.0])) - - # Check environment scenes - self.assertEqual(len(ar_environment.scenes), 2) - self.assertIsNone(numpy.testing.assert_array_equal(list(ar_environment.scenes.keys()), ["TestSceneA", "TestSceneB"])) - - # Load test scene - ar_scene = ar_environment.scenes["TestSceneA"] - - # Check Aruco scene - self.assertEqual(len(ar_scene.aruco_scene.places), 2) - self.assertIsNone(numpy.testing.assert_array_equal(ar_scene.aruco_scene.places[0].translation, [1, 0, 0])) - self.assertIsNone(numpy.testing.assert_array_equal(ar_scene.aruco_scene.places[0].rotation, [[1.,0.,0.],[0.,1.,0.],[0.,0.,1.]])) - self.assertEqual(ar_scene.aruco_scene.places[0].marker.identifier, 0) - - self.assertIsNone(numpy.testing.assert_array_equal(ar_scene.aruco_scene.places[1].translation, [0, 1, 0])) - self.assertIsNone(numpy.testing.assert_array_almost_equal(ar_scene.aruco_scene.places[1].rotation, [[0.,0.,1.],[0., 1.,0.],[-1.,0.,0.]])) - self.assertEqual(ar_scene.aruco_scene.places[1].marker.identifier, 1) - - # Check AOI scene - self.assertEqual(len(ar_scene.aoi_scene.items()), 1) - self.assertEqual(ar_scene.aoi_scene['Test'].points_number, 4) - self.assertIsNone(numpy.testing.assert_array_equal(ar_scene.aoi_scene['Test'].size, [1., 1., 0.])) - - # Check ArScene - self.assertEqual(ar_scene.angle_tolerance, 1.0) - self.assertEqual(ar_scene.distance_tolerance, 2.0) - - -if __name__ == '__main__': - - unittest.main()
\ No newline at end of file |