diff --git a/modules/aruco/misc/python/test/test_aruco.py b/modules/aruco/misc/python/test/test_aruco.py index 9fb9675aa3d..6c76fb5ed92 100644 --- a/modules/aruco/misc/python/test/test_aruco.py +++ b/modules/aruco/misc/python/test/test_aruco.py @@ -64,6 +64,26 @@ def test_write_read_dict(self): if os.path.exists(filename): os.remove(filename) + def test_identify(self): + aruco_dict = cv.aruco.Dictionary_get(cv.aruco.DICT_4X4_50) + expected_idx = 9 + expected_rotation = 2 + bit_marker = np.array([[0, 1, 1, 0], [1, 0, 1, 0], [1, 1, 1, 1], [0, 0, 1, 1]], dtype=np.uint8) + + check, idx, rotation = aruco_dict.identify(bit_marker, 0) + + self.assertTrue(check, True) + self.assertEqual(idx, expected_idx) + self.assertEqual(rotation, expected_rotation) + + def test_getDistanceToId(self): + aruco_dict = cv.aruco.Dictionary_get(cv.aruco.DICT_4X4_50) + idx = 7 + rotation = 3 + bit_marker = np.array([[0, 1, 0, 1], [0, 1, 1, 1], [1, 1, 0, 0], [0, 1, 0, 0]], dtype=np.uint8) + dist = aruco_dict.getDistanceToId(bit_marker, idx) + + self.assertEqual(dist, 0) if __name__ == '__main__': NewOpenCVTests.bootstrap()