System Information
OpenCV 4.8.0
Ubuntu 22.04
Python 3.10.6
Detailed description
In OpenCV 4.7.0 you could separately detect two ChArUco boards visible in a single image:
dict_type = aruco.DICT_6X6_250
squares = (5, 7)
square_length_mm = 20.0
marker_length_mm = 10.0
aruco_dict = aruco.getPredefinedDictionary(dict_type)
board0 = aruco.CharucoBoard(squares, square_length_mm,
marker_length_mm, aruco_dict, np.arange(17)) # There are 17 white squares, provide 17 markers with ids [0..16]
detector = aruco.CharucoDetector(board0)
charuco_corners, charuco_ids, marker_corners, marker_ids = detector.detectBoard(image)
aruco.drawDetectedCornersCharuco(image, charuco_corners, charuco_ids, (255, 0, 0))
board1 = aruco.CharucoBoard(squares, square_length_mm,
marker_length_mm, aruco_dict, np.arange(17) + 17) # 17 markers with ids [17..33]
detector = aruco.CharucoDetector(board1)
charuco_corners, charuco_ids, marker_corners, marker_ids = detector.detectBoard(image)
aruco.drawDetectedCornersCharuco(image, charuco_corners, charuco_ids, (0, 255, 0))

In OpenCV 4.8.0, the second detectBoard does not return any ChArUco corners. charuco_cornersand charuco_ids are both None.
The markers are still returned, so it is not a detection issue.
Sample code and sample image (see below) return under 4.7.0:
Running OpenCV 4.7.0
board0
charuco ids 0..23 (24)
marker ids 0..33 (34)
board1
charuco ids 0..23 (24)
marker ids 0..33 (23)
and SAME code under OpenCV 4.8.0:
Running OpenCV 4.8.0
board0
charuco ids 0..23 (24)
marker ids 0..33 (34)
board1
no charuco ids
marker ids 0..33 (23)
Steps to reproduce
import numpy as np
import cv2
import cv2.aruco as aruco
if __name__ == '__main__':
# Load image
image = cv2.imread('image.png')
# Generate Aruco boards
dict_type = aruco.DICT_6X6_250
squares = (5, 7)
square_length_mm = 20.0
marker_length_mm = 10.0
aruco_dict = aruco.getPredefinedDictionary(dict_type)
board0 = aruco.CharucoBoard(squares, square_length_mm,
marker_length_mm, aruco_dict, np.arange(17))
board1 = aruco.CharucoBoard(squares, square_length_mm,
marker_length_mm, aruco_dict, np.arange(17) + 17)
print(f'Running OpenCV {cv2.__version__}')
detector = aruco.CharucoDetector(board0)
charuco_corners, charuco_ids, marker_corners, marker_ids = detector.detectBoard(image)
print('board0')
if charuco_ids is None:
print(' no charuco ids')
else:
print(f' charuco ids {np.min(charuco_ids)}..{np.max(charuco_ids)} ({len(charuco_ids)})')
aruco.drawDetectedCornersCharuco(image, charuco_corners, charuco_ids, (255, 0, 0))
print(f' marker ids {np.min(marker_ids)}..{np.max(marker_ids)} ({len(marker_ids)})')
detector = aruco.CharucoDetector(board1)
charuco_corners, charuco_ids, marker_corners, marker_ids = detector.detectBoard(image)
print('board1')
if charuco_ids is None:
print(' no charuco ids')
else:
print(f' charuco ids {np.min(charuco_ids)}..{np.max(charuco_ids)} ({len(charuco_ids)})')
aruco.drawDetectedCornersCharuco(image, charuco_corners, charuco_ids, (0, 255, 0))
print(f' marker ids {np.min(marker_ids)}..{np.max(marker_ids)} ({len(marker_ids)})')
cv2.imshow(f'charuco ids with OpenCV {cv2.__version__}', image)
cv2.waitKey(0)
cv2.destroyAllWindows()

Issue submission checklist
System Information
OpenCV 4.8.0
Ubuntu 22.04
Python 3.10.6
Detailed description
In OpenCV 4.7.0 you could separately detect two ChArUco boards visible in a single image:
In OpenCV 4.8.0, the second
detectBoarddoes not return any ChArUco corners.charuco_cornersandcharuco_idsare bothNone.The markers are still returned, so it is not a detection issue.
Sample code and sample image (see below) return under 4.7.0:
and SAME code under OpenCV 4.8.0:
Steps to reproduce
Issue submission checklist