Hi,
We are able to open two USB cameras with the python code:
import sys
import cv2
def read_cam():
cap = cv2.VideoCapture("v4l2src device=/dev/video0 ! video/x-raw, width=640, height=480 ! videoconvert ! video/x-raw,format=BGR ! appsink ")
cap1 = cv2.VideoCapture("v4l2src device=/dev/video1 ! video/x-raw, width=640, height=480 ! videoconvert ! video/x-raw,format=BGR ! appsink ")
if cap.isOpened() and cap1.isOpened():
cv2.namedWindow("demo", cv2.WINDOW_AUTOSIZE)
cv2.namedWindow("demo1", cv2.WINDOW_AUTOSIZE)
while True:
ret_val, img = cap.read();
ret_1, img1 = cap1.read();
cv2.imshow('demo',img)
cv2.imshow('demo1',img1)
cv2.waitKey(10)
else:
print("camera open failed")
cv2.destroyAllWindows()
if __name__ == '__main__':
read_cam()
Please give it a try.