aboutsummaryrefslogtreecommitdiff
path: root/src/argaze.test/ArUcoMarkers/ArUcoTracker.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/argaze.test/ArUcoMarkers/ArUcoTracker.py')
-rw-r--r--src/argaze.test/ArUcoMarkers/ArUcoTracker.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/argaze.test/ArUcoMarkers/ArUcoTracker.py b/src/argaze.test/ArUcoMarkers/ArUcoTracker.py
index 67bbef9..acc0000 100644
--- a/src/argaze.test/ArUcoMarkers/ArUcoTracker.py
+++ b/src/argaze.test/ArUcoMarkers/ArUcoTracker.py
@@ -4,7 +4,7 @@ import unittest
import os
import math
-from argaze.ArUcoMarkers import ArUcoMarkersDictionary, ArUcoCamera, ArUcoTracker
+from argaze.ArUcoMarkers import ArUcoMarkersDictionary, ArUcoCamera, ArUcoTracker, ArUcoBoard
import cv2 as cv
import numpy
@@ -32,7 +32,7 @@ class TestArUcoTrackerClass(unittest.TestCase):
# Load picture Full HD to test ArUcoMarker tracking
current_directory = os.path.dirname(os.path.abspath(__file__))
- frame = cv.imread(os.path.join(current_directory, 'utils/full_hd.png'))
+ frame = cv.imread(os.path.join(current_directory, 'utils/full_hd_marker.png'))
# Check ArUcoMarker tracking
aruco_tracker.track(frame)
@@ -58,6 +58,25 @@ class TestArUcoTrackerClass(unittest.TestCase):
self.assertEqual(track_count, 1)
self.assertEqual(markers_count[0], 1)
+ def test_track_board(self):
+ """Test track board method."""
+
+ aruco_dictionary = ArUcoMarkersDictionary.ArUcoMarkersDictionary('DICT_ARUCO_ORIGINAL')
+ aruco_board = ArUcoBoard.ArUcoBoard(aruco_dictionary, 7, 5, 5, 3)
+ aruco_camera = ArUcoCamera.ArUcoCamera()
+ aruco_tracker = ArUcoTracker.ArUcoTracker(aruco_dictionary, 3, aruco_camera)
+
+ # Load picture Full HD to test ArUcoMarker board tracking
+ current_directory = os.path.dirname(os.path.abspath(__file__))
+ frame = cv.imread(os.path.join(current_directory, 'utils/full_hd_board.png'))
+
+ # Check ArUcoMarker board tracking
+ aruco_tracker.track_board(frame, aruco_board, aruco_board.markers_number)
+
+ self.assertEqual(aruco_tracker.board_corners_number, aruco_board.corners_number)
+ self.assertEqual(len(aruco_tracker.board_corners), 24)
+ self.assertEqual(len(aruco_tracker.board_corners_identifier), 24)
+
if __name__ == '__main__':
unittest.main() \ No newline at end of file