📜  从usb opencv python代码示例读取实时视频

📅  最后修改于: 2022-03-11 14:46:08.483000             🧑  作者: Mango

代码示例2
import cv2
cap = cv2.VideoCapture()
# The device number might be 0 or 1 depending on the device and the webcam
cap.open(0, cv2.CAP_DSHOW)
while(True):
    ret, frame = cap.read()
    cv2.imshow('frame', frame)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
cap.release()
cv2.destroyAllWindows()