1

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

NeilZgx
  • 11
  • 2
  • Please provide enough code so others can better understand or reproduce the problem. – Community Mar 07 '22 at 16:23
  • 1
    uninstall opencv-python, then install opencv-contrib-python, which contains the aruco submodule – berak Mar 07 '22 at 18:59
  • @berak I tried that before but doesn't work. I install a previous version (1.62.3) of VSCode and the Python entension in it. This solve the problem. – NeilZgx Mar 07 '22 at 22:46

1 Answers1

1

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.drawFrameAxes: https://docs.opencv.org/4.6.0/d9/d0c/group__calib3d.html#gab3ab7bb2bdfe7d5d9745bb92d13f9564

Compare cv2.drawFrameAxes in v4.6.0 with aruco.drawAxis from v4.1.2 (the version I was running before encontouring the error).

J3soon
  • 3,013
  • 2
  • 29
  • 49
critor
  • 173
  • 2
  • 11