擅长:python、mysql、java
<p>您可以使用OpenCV的<a href="https://docs.opencv.org/master/dd/d43/tutorial_py_video_display.html" rel="nofollow noreferrer">VideoCapture</a>方法捕获单个帧</p>
<pre><code>import cv2
pic = cv2.VideoCapture(0) # video capture source camera (Here webcam of laptop)
ret,frame = pic.read() # return a single frame in variable `frame`
while(True):
cv2.imshow('img1',frame) #display the captured image
if cv2.waitKey(1) & 0xFF == ord('y'): #save on pressing 'y'
cv2.imwrite('images/c1.png',frame)
cv2.destroyAllWindows()
break
pic.release()
</code></pre>