-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathcreate_video_from_frames.py
31 lines (21 loc) · 1.06 KB
/
create_video_from_frames.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
import cv2
import glob
# input_paths = ["../results/stuttgart_video/result_sequence_imgs/*.png",
# "../results/stuttgart_video/rendered_sequence_top/*.png",
# "../results/stuttgart_video/rendered_sequence_good_frontal/*.png"]
# output_paths = ["../results/stuttgart_video/result_imgs.mp4",
# "../results/stuttgart_video/result_top_render.mp4",
# "../results/stuttgart_video/result_frontal_render.mp4"]
input_paths = ["../results/stuttgart_video/result_sequence_imgs/*.png"]
output_paths = ["../results/stuttgart_video/result_imgs.mp4"]
for i in range(len(input_paths)):
print("Reading from", input_paths[i])
test_frame = cv2.imread("../results/stuttgart_video/result_sequence_imgs/stuttgart_02_000000_005100_leftImg8bit.png")
height, width = test_frame.shape[0], test_frame.shape[1]
print(height, width)
video = cv2.VideoWriter(output_paths[i], cv2.VideoWriter_fourcc(*"mp4v"), 30, (width, height))
for frame_path in sorted(glob.glob(input_paths[i])):
frame = cv2.imread(frame_path)
video.write(frame)
print("Done", input_paths[i])