summaryrefslogtreecommitdiff
path: root/cv/seg
diff options
context:
space:
mode:
authorzhang <zch921005@126.com>2022-06-04 08:48:54 +0800
committerzhang <zch921005@126.com>2022-06-04 08:48:54 +0800
commit44097da7288042e988bcb89f1c6cc817a8e1eec9 (patch)
tree7c28da29f31ca429b8d27ed7441d650f1195812d /cv/seg
parent0f885b830ac552bfd357dec74c70e1349434b58b (diff)
0604
Diffstat (limited to 'cv/seg')
-rw-r--r--cv/seg/img2video.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/cv/seg/img2video.py b/cv/seg/img2video.py
index c824c9c..4fdc17b 100644
--- a/cv/seg/img2video.py
+++ b/cv/seg/img2video.py
@@ -9,7 +9,8 @@ images = [img for img in os.listdir(image_folder) if img.endswith(".jpg")]
frame = cv2.imread(os.path.join(image_folder, images[0]))
height, width, layers = frame.shape
-video = cv2.VideoWriter(video_name, 0, 10, (width,height))
+fourcc = cv2.VideoWriter_fourcc(*'XVID')
+video = cv2.VideoWriter(video_name, fourcc, 10, (width,height))
images.sort(key=lambda s: int(s.split('.')[0].split('-')[1]))
for image in tqdm(images):
video.write(cv2.imread(os.path.join(image_folder, image)))