首页 > 解决方案 > Debian 9.5 上 Aruco 库的问题 - OpenCV

问题描述

我正在尝试在 Debian 9.5 上使用 OpenCV for Python 2.7 通过我的相机检测 Aruco 标记,但由于处理cv2.aruco.detectMarkers(). 在 Windows 上运行它,它没有任何问题。特别是,我在我的代码中写道:

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

其中camera_matrixcamera_distortion分别是我通过相机校准得到的相机矩阵和相机畸变参数。

更准确地说,错误表明 function 没有cameraMatrix输入参数cv2.aruco.detectMarkers。我该如何解决这个问题?非常感谢您提前。

标签: pythonpython-2.7opencvdebian

解决方案


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.


推荐阅读