【发布时间】:2018-06-21 03:54:13
【问题描述】:
我正在使用树莓派来捕捉视频的前 20 帧。现在这更像是一个概念问题,但在浏览 videoCapture 上的 openCV 文档时,他们强调了在此代码中发布捕获的重要性(如在他们的网站上发布的那样):
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
# Our operations on the frame come here
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
# Display the resulting frame
cv2.imshow('frame',gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()
cap.release() 的重要性是什么?省略这条线是否有任何记忆含义?如果有,它们是什么,为什么?
【问题讨论】:
标签: python opencv raspberry-pi