AttributeError: 'module' object has no attribute 'cv'
Forums:
I just installed OpenCV (libopencv-dev python-opencv) and monster_self_drive. When running MonsterAuto.py I get the following error:
pi@raspberrypi:~/monster-self-drive $ ./MonsterAuto.py
Libraries loaded
Running script in directory "."
TEST MODE: Skipping board setup
Setup camera input
Traceback (most recent call last):
File "./MonsterAuto.py", line 91, in
Settings.capture.set(cv2.cv.CV_CAP_PROP_FRAME_WIDTH, Settings.imageWidth);
AttributeError: 'module' object has no attribute 'cv'
Change the code in doesn't help:
Settings.capture.set(cv2.CV_CAP_PROP_FRAME_WIDTH, Settings.imageWidth);
or
Settings.capture.set(cv2.CAP_PROP_FRAME_WIDTH, Settings.imageWidth);
What can I do?
piborg
Tue, 06/16/2020 - 09:41
Permalink
MonsterAuto.py with recent versions of Raspbian
Recent versions of Raspbian have updated versions of OpenCV and numpy. The MonsterAuto.py script is based on older versions that were slightly different. There are a few changes you will need to make to get the script to work properly.
AttributeError: 'module' object has no attribute 'cv'
This can be fixed by changing these lines:
to these ones:
on lines 91-93 in MonsterAuto.py.
Use a.any() or a.all() error
You can fix this by changing the line
to
on line 122 in MonsterAuto.py.
AttributeError: 'module' object has no attribute 'CV_AA'
You can fix this by changing the three instances of
to
on lines 278, 281, and 283 in ImageProcessor.py.
Laure-Anne Jacobs
Tue, 06/16/2020 - 13:36
Permalink
Thanks. It's working.
Thanks.
It's working.