Home > Net >  Problems with Aruco library on Debian 9.5 - OpenCV
Problems with Aruco library on Debian 9.5 - OpenCV

Time:10-30

I am trying to detect Aruco markers through my camera using OpenCV for Python 2.7 on Debian 9.5, but I can't run my code because of an errore dealing with cv2.aruco.detectMarkers(). Running it on Windows, it does not have any problem. In particular, I wrote in my code:

cv2.aruco.detectMarkers(image=gray, dictionary=aruco_dict, parameters=parameters, 
                         cameraMatrix=camera_matrix, distCoeff=camera_distortion)   

where camera_matrix and camera_distortion are respectively the camera matrix and the camera distortion parameters I got by camera calibration.

More precisely, the error says that there's no cameraMatrix input parameter for the function cv2.aruco.detectMarkers. How do I fix this problem? Thank you very much in advance.

CodePudding user response:

Maybe your error is due to your opencv version. Check it with:

 cv2.__version__

Older versions of opencv (such as 3.2.0, that is maybe your default version for Debian 9) do not have cameraMatrix or distCoeff as input parameters of cv2.aruco.detectMarkers function.

If you are interested in getting newer versions of opencv for your OS (such as 4.1.0.25), you have to do:

sudo pip install opencv-contrib-python==4.1.0.25

If you are not, just remove cameraMatrix and distCoeff from your inputs, it would run anyway.

  • Related