源码:

import cv2 as cv
import numpy as np

def video_demo():
    capture = cv.VideoCapture(0)
    while(True):
        ret, frame = capture.read()
        frame = cv.flip(frame, 1)
        cv.imshow("video", frame)
        c = cv.waitKey(40)
        # ESC Will Break Capture
        if c == 27:
            break

video_demo()
cv.waitKey(0)
cv.destroyAllWindows()

图像:
OpenCV读取UsbCam的图像

相关文章: