Last active
March 29, 2021 13:25
-
-
Save yun-long/6bc05e3218bda1ca74642dfbae9f0264 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import os | |
import glob | |
# | |
image_folder = './Saved' | |
video_name = 'video.avi' | |
fourcc = cv2.VideoWriter_fourcc(*'MP4V') | |
images = [] | |
for img in sorted(glob.glob(os.path.join(image_folder, "*"))): | |
images.append(img) | |
frame = cv2.imread(images[0]) | |
height, width, layers = frame.shape | |
video = cv2.VideoWriter(video_name, fourcc, 40, (width,height)) | |
for image in images: | |
video.write(cv2.imread(image)) | |
cv2.destroyAllWindows() | |
video.release() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment