我正在使用与此类似的代码
from skvideo.io import VideoCapture
cap = VideoCapture(filename)
cap.open()
while True:
retval, image = cap.read()
# image is a numpy array containing the next frame
# do something with image here
plt.show()
if not retval:
break
但是输出仅显示一帧,而第二帧仅在我关闭第一帧后显示。 scikit中是否有类似于cv2.waitKey()和cv2.destroyAllWindows()的函数来自动更新帧?
答案 0 :(得分:1)
尝试正确缩进代码,如下所示:
from skvideo.io import VideoCapture
cap = VideoCapture(filename)
cap.open()
while True:
retval, image = cap.read()
# image is a numpy array containing the next frame
# do something with image here
plt.show()
if not retval:
break