OpenCV - 无法将图像写入视频文件

时间:2016-05-16 10:28:00

标签: python opencv

我有一个循环来从图像中写入视频文件:

for a in range(len(events)):
        c_videos = []
        first = events[a][0]
        last = events[a][1]
        c_videos = video_ids[numpy.where(numpy.logical_and(timestamps >= first, timestamps <= last))]
        video_name = "/export/students/sait/9-may-video-dataset/video-" + str(events[a][2]) + ".avi"
        video = cv2.VideoWriter(video_name,-1,1,(width,height))
        for b in range(len(c_videos)):
                img_file = "/export/students/sait/9-may-results/rgb-" + str(c_videos[b]) + ".ppm"
                img = cv2.imread(img_file)
                video.write(img)
        cv2.destroyAllWindows()
        video.release()

但我无法成功制作视频。我没有在目标目录下看到任何已创建的视频文件。

如何解决此问题?

0 个答案:

没有答案