帧未在scikit视频输出中自动更新

时间:2015-12-11 05:28:05

标签: scikit-image

我正在使用与此类似的代码

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()的函数来自动更新帧?

1 个答案:

答案 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