ca_ur5/test12.py

29 lines
715 B
Python

import cv2
ID1 = 2
ID2 = 0
#cam1 = cv2.VideoCapture(ID2, cv2.CAP_V4L2)
#cam1.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc(*'MJPG'))
#cam2 = cv2.VideoCapture(ID1, cv2.CAP_V4L2)
#cam2.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc(*'MJPG'))
ret2, frame2 = cv2.VideoCapture(ID1, cv2.CAP_V4L2).read()
ret1, frame1 = cv2.VideoCapture(ID2, cv2.CAP_V4L2).read()
while True:
ret2, frame2 = cv2.VideoCapture(ID1, cv2.CAP_V4L2).read()
ret1, frame1 = cv2.VideoCapture(ID2, cv2.CAP_V4L2).read()
'''
print("ret 1 = ", ret1)
print("ret 2 = ", ret2)
'''
cv2.imshow('Camera 1', frame1)
cv2.imshow('Camera 2', frame2)
if cv2.waitKey(1) == ord('q'):
break
cam1.release()
cam2.release()
cv2.destroyAllWindows()