捕捉摄像视频画面

import cv2
import numpy as np
import matplotlib.pyplot as plt
 
cap = cv2.VideoCapture(0)
while True:
    ret,frame = cap.read()
    cv2.imshow('capture', frame)
    if cv2.waitKey(1)==ord('p'):
        cv2.imwrite(r'C:\Users\ngwdy\Desktop\shexiang1.jpg',frame)
    if cv2.waitKey(1)==ord('q'):
        break
    
cap.release()
cv2.destroyAllWindows()

猜你喜欢

转载自blog.csdn.net/qq_27017791/article/details/79116814