-
-
Notifications
You must be signed in to change notification settings - Fork 56.6k
Description
System Information
OpenCV python version: 4.7.0.68
Operating System / Platform: Windows 11
Python version: 3.10.9
Detailed description
I am porting code from 4.6.0.66 to 4.7.0.68. Aruco has moved from contrib to the main package, and some functions have been renamed. One of these is the constructor for an aruco board. It has been renamed from cv2.aruco.Board_create to cv2.aruco.Board. Its input arguments have not changed.
However, i am no longer able to call it with the same input arguments as in 4.6.0.66. Even though i put in a list of points and a list of ids of the same size, it always gives me an error that they are not the same length.:
cv2.error: OpenCV(4.7.0) D:\a\opencv-python\opencv-python\opencv\modules\objdetect\src\aruco\aruco_board.cpp:160: error: (-215:Assertion failed) ids.size() == objPoints.size() in function 'cv::aruco::Board::Board'
Since the signature has not changed, i assume this is some error in the python wrapper or some change internal to the function?
Steps to reproduce
Code that worked with 4.6.0.66:
# boardCornerPoints is a list of 4x2 float32 matrices, e.g.:
# boardCornerPoints[0] ->
# array([[-178.05125, -151.86725],
# [-136.15675, -151.86725],
# [-136.15675, -109.97275],
# [-178.05125, -109.97275]], dtype=float32)
boardCornerPoints = np.dstack(boardCornerPoints) # list of 2D arrays -> 3D array
boardCornerPoints = np.rollaxis(boardCornerPoints,-1) # 4x2xN -> Nx4x2
boardCornerPoints = np.pad(boardCornerPoints,((0,0),(0,0),(0,1)),'constant', constant_values=(0.,0.)) # Nx4x2 -> Nx4x3
cv2.aruco.Board_create(boardCornerPoints, self.aruco_dict, np.array(ids))For 4.7.0.68, the last line should be changed to:
cv2.aruco.Board(boardCornerPoints, self.aruco_dict, np.array(ids))That however does not work, see error above.
Issue submission checklist
- I report the issue, it's not a question
- I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- I updated to the latest OpenCV version and the issue is still there
- There is reproducer code and related data files (videos, images, onnx, etc)