我正在嘗試在 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_matrix和camera_distortion分別是我通過相機標定得到的相機矩陣和相機畸變引數。
更準確地說,錯誤表明cameraMatrix函式沒有輸入引數cv2.aruco.detectMarkers。我該如何解決這個問題?非常感謝您提前。
uj5u.com熱心網友回復:
也許您的錯誤是由于您的opencv版本。檢查它:
cv2.__version__
舊版本opencv(例如 3.2.0,這可能是 Debian 9 的默認版本)沒有cameraMatrix或distCoeff作為cv2.aruco.detectMarkers函式的輸入引數。
如果您有興趣opencv為您的作業系統獲取更新版本(例如 4.1.0.25),您必須執行以下操作:
sudo pip install opencv-contrib-python==4.1.0.25
如果不是,只需從您的輸入中洗掉cameraMatrix和distCoeff,它無論如何都會運行。
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/344568.html
標籤:Python python-2.7 opencv Debian
上一篇:將時間格式從一種更改為另一種
