Skip to content

Commit 9d93628

Browse files
authored
Update img2vid.py
1 parent 3f1a8fd commit 9d93628

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Images to Video/img2vid.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import cv2
22

33
from imutils import paths
4-
import os
54
import argparse
65

76
ap = argparse.ArgumentParser()
@@ -10,22 +9,23 @@
109
args = vars(ap.parse_args())
1110

1211
out = None
13-
(w,h) = (None,None)
12+
(w, h) = (None, None)
1413
img_array = []
1514

1615
imagePaths = list(paths.list_images(args["path"]))
1716

1817
for filename in imagePaths:
1918
img = cv2.imread(filename)
20-
img = cv2.resize(img,(1400,800))
19+
img = cv2.resize(img, (1400, 800))
2120
height, width, layers = img.shape
2221
if w is None or h is None:
23-
(w,h) = (width,height)
22+
(w, h) = (width, height)
2423
img_array.append(img)
25-
24+
2625
if out is None:
27-
out = cv2.VideoWriter(args["output_video"],cv2.VideoWriter_fourcc(*'DIVX'), 1, (w,h),True)
28-
26+
out = cv2.VideoWriter(args["output_video"], cv2.VideoWriter_fourcc(*'DIVX'), 1, (w, h), True)
27+
2928
for i in range(len(img_array)):
3029
out.write(img_array[i])
31-
out.release()
30+
31+
out.release()

0 commit comments

Comments
 (0)