CharucoDetector.detectBoard returns NoneType

When using the detectBoard function the aruco codes are recognized but the charuco corners are returned as none type.

I am using opencv 4.8.1. My code looks like this:

dictionary = cv2.aruco.getPredefinedDictionary(cv2.aruco.DICT_4X4_50)
board = cv2.aruco.CharucoBoard((10,7),0.0297,0.0218,dictionary)
detector = cv2.aruco.CharucoDetector(board)

img = cv2.imread("/path/to/img")
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

charuco_corners, charuco_ids, marker_corners, marker_ids = detector.detectBoard(gray)

print(type(charuco_corners)) # NoneType
print(type(charuco_ids)) # NoneType

marker_img = cv2.aruco.drawDetectedMarkers(img, marker_corners, marker_ids)
cv2.imwrite('markers.png', marker_img)

Am I missing something?

I can also upload the input image if required. As I am a new user I cannot do it in one post.

yes, someone completely redefined how “charuco” boards are laid out in opencv. that broke everyone’s setup.

make sure you read up on what in the docs, and find the flag for “legacy” boards. make sure you generate your boards with that in mind.

I tried enabling legacy pattern but it still returns None. I also generated a new board using with the same opencv version. Still in both cases it returns None :frowning: