时间:2022-11-30 10:58:27 | 栏目:Python代码 | 点击:次
如下所示:
import cv2 cap = cv2.VideoCapture(0) k = 0 while k != 27: # esc ret, img = cap.read(0) cv2.imshow(‘233', img) k = cv2.waitKey(20) & 0xff print( ‘begin to record images…' ) for ii in range(1000): ret, img = cap.read(0) cv2.imshow(‘233', img) cv2.imwrite(‘imaged%04d.jpg'%(ii), img) cv2.waitKey(20)