简体   繁体   中英

Module 'cv2.cv2' has no attribute 'aruco'

My Python script uses aruco library in opencv-contrib-python to detect ArUco code in the image. 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

dictionary = cv2.aruco.getPredefinedDictionary(cv2.aruco.DICT_4X4_100)

AttributeError: module 'cv2.cv2' has no attribute 'aruco'

ERROR conda.cli.main_run:execute(33): Subprocess for 'conda run ['python', 'j:/Neil/colorimetric/patterns/detect_track_guide.py']' command failed. (See above for error)'

I use VSCode and the opencv is up-to-date. I only install opencv-contrib-python. I tried many ways, like reinstalling or installing both opencv-contrib-python and opencv-contrib. But no one works for me.

I also have a c++ version code for my IOS APP which still works well.

pip list

It's not clear what version of OpenCV you were running when you encountered the error.

It seems that aruco.drawAxis was replaced with 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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM