使用摄像头捕获视频并显示
import cv2
import numpy
import matplotlib.pyplot as plot
imcap = cv2.VideoCapture(0)
while(1):
# get a frame
ret, frame = imcap.read()
# show a frame
cv2.imshow("capture", frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
imcap.release()
cv2.destroyAllWindows()
=参考=