only 1 on 2 camera working
hi guys I am new with opencv and i am trying to take a video image from a dual stereo camera module.
CAMERA : ELP 1.0 Megapixel Dual Lens Usb Camera Module with Two Megapixel Lens SOFTWARE : opencv 3.4
the module has 2 cameras and one usb door. when i run the code, it open 2 windows, but i receive only the output from one camera.
i am sure the camera are working because with an other software i was able to choose the camera i wanted use and it worked.
With videocapture (0) i got the image from camera module with videocapture (1) i got from my laptop camera with videocapture (2) it open the laptot camera again with videocapture (3) no more frame using 2 times videocapture (0) i got output from the same camera
the code is the following.
import cv2
left = cv2.VideoCapture(0)
right = cv2.VideoCapture(1)
while(True):
if not (left.grab() and right.grab()):
print("No more frames")
break
_, leftFrame = left.retrieve()
_, rightFrame = right.retrieve()
cv2.imshow('left', leftFrame)
cv2.imshow('right', rightFrame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
left.release()
right.release()
cv2.destroyAllWindows()
you could try with:
thanks for your reply. i tried with yours script but i just received 2 output from the same camera.
for the moment i solved running:
and one time identified the door i have decrease cam resolution because i had usb problems