Projet

Général

Profil

Capture de video au ralentit » in_img_out_video.py

Marouane SOBTI, 02/12/2022 14:14

 
import cv2
import numpy as np
import glob
import os


dir_path = os.path.dirname(os.path.realpath(__file__))
file_pattern = '/*'
file_extenstion = '.png'

full = dir_path + file_pattern + file_extenstion






img_array = []
for filename in glob.glob(full):
img = cv2.imread(filename)
height, width, layers = img.shape
size = (width,height)
img_array.append(img)


out = cv2.VideoWriter('project.avi',cv2.VideoWriter_fourcc(*'DIVX'), 25, size)
for i in range(len(img_array)):
out.write(img_array[i])
out.release()
(2-2/2)