aruco.detectMarkers - Expected Ptr<cv::aruco::Dictionary> for argument 'dictionary'

Please don’t edit with C++ code. This is Python, you are doing a disservice.

img = cv2.imread("test.jpg")
corners, ids, rejectedImgPoints = aruco.detectMarkers(img, aruco.DICT_4X4_1000)

Output every time:

Traceback (most recent call last):
  File "test.py", line 2, in <module>
    corners, ids, rejectedImgPoints = aruco.detectMarkers(img, aruco.DICT_4X4_1000)
cv2.error: OpenCV(4.5.2) :-1: error: (-5:Bad argument) in function 'detectMarkers'
> Overload resolution failed:
>  - Expected Ptr<cv::aruco::Dictionary> for argument 'dictionary'
>  - Expected Ptr<cv::aruco::Dictionary> for argument 'dictionary'

No idea what the error means and can’t find any info online.

you need to load a dictionary object first, and pass that to detectMarkers(), not the enum value.

c++ sample, have a look, anyway

1 Like

I’m not sure how that’s better to require, but thanks