aboutsummaryrefslogtreecommitdiff
path: root/src/argaze.test/ArUcoMarkers
diff options
context:
space:
mode:
Diffstat (limited to 'src/argaze.test/ArUcoMarkers')
-rw-r--r--src/argaze.test/ArUcoMarkers/ArUcoCamera.py7
-rw-r--r--src/argaze.test/ArUcoMarkers/ArUcoTracker.py23
-rw-r--r--src/argaze.test/ArUcoMarkers/utils/tracker.json5
3 files changed, 33 insertions, 2 deletions
diff --git a/src/argaze.test/ArUcoMarkers/ArUcoCamera.py b/src/argaze.test/ArUcoMarkers/ArUcoCamera.py
index 7e50e8c..ef78b04 100644
--- a/src/argaze.test/ArUcoMarkers/ArUcoCamera.py
+++ b/src/argaze.test/ArUcoMarkers/ArUcoCamera.py
@@ -18,7 +18,10 @@ class TestArUcoCameraClass(unittest.TestCase):
# Check ArUco camera
self.assertEqual(aruco_camera.rms, 0.0)
- self.assertIsNone(numpy.testing.assert_array_equal(aruco_camera.dimensions, numpy.array([0, 0])))
+
+ #self.assertEqual(type(aruco_camera.K), numpy.array)
+
+ self.assertIsNone(numpy.testing.assert_array_equal(aruco_camera.dimensions, [0, 0]))
self.assertIsNone(numpy.testing.assert_array_equal(aruco_camera.K, ArUcoCamera.K0))
self.assertIsNone(numpy.testing.assert_array_equal(aruco_camera.D, ArUcoCamera.D0))
@@ -33,7 +36,7 @@ class TestArUcoCameraClass(unittest.TestCase):
# Check ArUco camera
self.assertEqual(aruco_camera.rms, 1.0)
- self.assertIsNone(numpy.testing.assert_array_equal(aruco_camera.dimensions, numpy.array([1920, 1080])))
+ self.assertIsNone(numpy.testing.assert_array_equal(aruco_camera.dimensions, [1920, 1080]))
self.assertIsNone(numpy.testing.assert_array_equal(aruco_camera.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(aruco_camera.D, [-1.0, -0.5, 0.0, 0.5, 1.0]))
diff --git a/src/argaze.test/ArUcoMarkers/ArUcoTracker.py b/src/argaze.test/ArUcoMarkers/ArUcoTracker.py
index acc0000..87373ea 100644
--- a/src/argaze.test/ArUcoMarkers/ArUcoTracker.py
+++ b/src/argaze.test/ArUcoMarkers/ArUcoTracker.py
@@ -9,6 +9,29 @@ from argaze.ArUcoMarkers import ArUcoMarkersDictionary, ArUcoCamera, ArUcoTracke
import cv2 as cv
import numpy
+class TestTrackingDataClass(unittest.TestCase):
+ """Test TrackingData class."""
+
+ def test_from_json(self):
+ """Test TrackingData creation from json file."""
+
+ # Edit traking data file path
+ current_directory = os.path.dirname(os.path.abspath(__file__))
+ json_filepath = os.path.join(current_directory, 'utils/tracker.json')
+
+ # Load project
+ tracking_data = ArUcoTracker.TrackingData.from_json(json_filepath)
+
+ # Check data
+ self.assertEqual(tracking_data.cornerRefinementMethod, 3)
+ self.assertEqual(tracking_data.aprilTagQuadSigma, 2)
+ self.assertEqual(tracking_data.aprilTagDeglitch, 1)
+
+ # Check bad data access fails
+ with self.assertRaises(AttributeError):
+
+ tracking_data.unknown_data = 1
+
class TestArUcoTrackerClass(unittest.TestCase):
"""Test ArUcoTracker class."""
diff --git a/src/argaze.test/ArUcoMarkers/utils/tracker.json b/src/argaze.test/ArUcoMarkers/utils/tracker.json
new file mode 100644
index 0000000..d26a3fa
--- /dev/null
+++ b/src/argaze.test/ArUcoMarkers/utils/tracker.json
@@ -0,0 +1,5 @@
+{
+ "cornerRefinementMethod": 3,
+ "aprilTagQuadSigma": 2,
+ "aprilTagDeglitch": 1
+} \ No newline at end of file