Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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()

click to hide/show revision 2
None

updated 2018-04-23 05:51:27 -0600

berak gravatar image

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

cv2 left = cv2.VideoCapture(0) right = cv2.VideoCapture(1)

cv2.VideoCapture(1) while(True): if not (left.grab() and right.grab()): print("No more frames") break

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()

left.release() right.release() cv2.destroyAllWindows()