fix assert, add test

pull/23399/head
Alex 2 years ago
parent a4ff46aab7
commit 02bdc10062
  1. 11
      modules/objdetect/misc/python/test/test_objdetect_aruco.py
  2. 1
      modules/objdetect/src/aruco/aruco_board.cpp

@ -11,6 +11,17 @@ from tests_common import NewOpenCVTests
class aruco_objdetect_test(NewOpenCVTests):
def test_board(self):
p1 = np.array([[0, 0, 0], [0, 1, 0], [1, 1, 0], [1, 0, 0]], dtype=np.float32)
p2 = np.array([[1, 0, 0], [1, 1, 0], [2, 1, 0], [2, 0, 0]], dtype=np.float32)
objPoints = np.array([p1, p2])
dictionary = cv.aruco.getPredefinedDictionary(cv.aruco.DICT_4X4_50)
ids = np.array([0, 1])
board = cv.aruco.Board(objPoints, dictionary, ids)
np.testing.assert_array_equal(board.getIds().squeeze(), ids)
np.testing.assert_array_equal(np.ravel(np.array(board.getObjPoints())), np.ravel(np.concatenate([p1, p2])))
def test_idsAccessibility(self):
ids = np.arange(17)

@ -157,7 +157,6 @@ Board::Board():
Board::Board(InputArrayOfArrays objPoints, const Dictionary &dictionary, InputArray ids):
Board(new Board::Impl(dictionary)) {
CV_Assert(ids.size() == objPoints.size());
CV_Assert(objPoints.total() == ids.total());
CV_Assert(objPoints.type() == CV_32FC3 || objPoints.type() == CV_32FC1);

Loading…
Cancel
Save