I'm trying to run a real-time Capture of 2 Usb-Cameras (same Reference) USB-Camera_0 --> USB-port 0 USB-Camera_1 --> USB-port 1
I use This Code to make a real time capture for only one camera. To run the second camera (connected to the second usb-Port) at the same time I create another file with the same Code (changing the index 0-->1). I'm asking if it is possible to run this two real time capture in the same Code-file.
thanks
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
# Display the resulting frame
cv2.imshow('frame',frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()