So, I printed OpenCV2 version, and what happened is quite funny:
I basically coded that print(cv2.__version__)
into my code you can find in my previous comment (before opening cam1 and cam2.
From terminal, when I run python camera_test.py
the output is: 3.2.0. When I run python3 camera_test.py
the output is 4.5.1 instead. I’m pretty sure I did something very wrong with OpenCV, which is causing all those problems.
I also tried to set sensor_mode = 2 in dual_camera.py
, obtaining the same error when I run the code through python dual_camera.py
or python3 dual_camera.py
:
Unable to open any cameras
Traceback (most recent call last):
File "dual_camera.py", line 193, in <module>
start_cameras()
File "dual_camera.py", line 174, in start_cameras
_ , left_image=left_camera.read()
File "dual_camera.py", line 88, in read
frame = self.frame.copy()
AttributeError: 'NoneType' object has no attribute 'copy'