[英]Module 'cv2.cv2' has no attribute 'aruco'
My Python script uses aruco library in opencv-contrib-python to detect ArUco code in the image.我的 Python 脚本使用 opencv-contrib-python 中的 aruco 库来检测图像中的 ArUco 代码。 It has worked well for nearly one year, but suddenly start to pop this error in last week.
它已经运行了将近一年,但在上周突然开始出现此错误。
Traceback (most recent call last):回溯(最近一次通话最后):
File "j:/Neil/colorimetric/patterns/detect_track_guide.py", line 586, in文件“j:/Neil/colorimetric/patterns/detect_track_guide.py”,第 586 行,在
dictionary = cv2.aruco.getPredefinedDictionary(cv2.aruco.DICT_4X4_100)
AttributeError: module 'cv2.cv2' has no attribute 'aruco' AttributeError:模块'cv2.cv2'没有属性'aruco'
ERROR conda.cli.main_run:execute(33): Subprocess for 'conda run ['python', 'j:/Neil/colorimetric/patterns/detect_track_guide.py']' command failed.错误 conda.cli.main_run:execute(33): 'conda run ['python', 'j:/Neil/colorimetric/patterns/detect_track_guide.py']' 命令的子进程失败。 (See above for error)'
(见上面的错误)'
I use VSCode and the opencv is up-to-date.我使用 VSCode 并且 opencv 是最新的。 I only install opencv-contrib-python.
我只安装 opencv-contrib-python。 I tried many ways, like reinstalling or installing both opencv-contrib-python and opencv-contrib.
我尝试了很多方法,例如重新安装或安装 opencv-contrib-python 和 opencv-contrib。 But no one works for me.
但是没有人为我工作。
I also have a c++ version code for my IOS APP which still works well.我还有一个适用于我的 IOS APP 的 c++ 版本代码,它仍然可以正常工作。
It's not clear what version of OpenCV you were running when you encountered the error.当您遇到错误时,尚不清楚您运行的是哪个版本的 OpenCV。
It seems that aruco.drawAxis
was replaced with cv2.drawFrameAxis
: https://docs.opencv.org/4.6.0/d9/d0c/group__calib3d.html#gab3ab7bb2bdfe7d5d9745bb92d13f9564似乎
aruco.drawAxis
被替换为cv2.drawFrameAxis
: https ://docs.opencv.org/4.6.0/d9/d0c/group__calib3d.html#gab3ab7bb2bdfe7d5d9745bb92d13f9564
Compare cv2.drawFrameAxis
in v4.6.0 with aruco.drawAxis
from v4.1.2 (the version I was running before encontouring the error).将
cv2.drawFrameAxis
中的 cv2.drawFrameAxis 与aruco.drawAxis
中的 aruco.drawAxis 进行比较(我在排除错误之前运行的版本)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.