Skip to content

Instantly share code, notes, and snippets.

@Merwanski
Last active January 22, 2022 21:30
Show Gist options
  • Select an option

  • Save Merwanski/af0b788aea750c1aab2f29ccb63643ce to your computer and use it in GitHub Desktop.

Select an option

Save Merwanski/af0b788aea750c1aab2f29ccb63643ce to your computer and use it in GitHub Desktop.
photo2video.py
import cv2
import numpy as np
import glob
video_file_name = 'project.wmv'
path_to_images = 'path_2_video/*.bmp'
cmpt = 0
for filename in glob.glob(path_to_images):
img = cv2.imread(filename)
height, width, layers = img.shape
size = (width,height)
print("[INFO] {}".format(cmpt))
if cmpt == 0:
out = cv2.VideoWriter(video_file_name, cv2.VideoWriter_fourcc('W','M','V','1'), 25, size)
out.write(img)
cmpt = cmpt +1
if cmpt == 10000:
break
out.release()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment