"""
Created on Sun Sep 25 21:51:56 2022
@author: in
"""
import cv2
import os
path = r"F:\2022112501-chaosheng\20221210mix\ms"
ls=[]
for root,dirs,files in os.walk(path):
for file in files:
splitext = os.path.splitext(file)
if splitext[1] == '.png':
fname = os.path.join(root, file)
ls.append(fname)
fps = 60
size = cv2.imread(ls[5]).shape[1::-1]
video_path = path+'\\'+"0result.mp4"
videowriter = cv2.VideoWriter(video_path,-1, fps, size)
for x in ls:
img = cv2.imread(x)
videowriter.write(img)
videowriter.release()
仅仅需要更改
path = r"F:\2022112501-chaosheng\20221210mix\ms"
if splitext[1] == '.png':