如下所示:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
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 )
|
以上这篇python 读取摄像头数据并保存的实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持服务器之家。
原文链接:https://blog.csdn.net/u012526003/article/details/73658328