import os
import cv2
import glob
fourcc = cv2.VideoWriter_fourcc('m', 'p', '4', 'v')
cap_fps = 10
size = (1920, 1080)/#设置图片的分辨率
video_res_path = os.path.join("./2d/yolov5-7.0/runs/predict-seg/exp33/", '640_zh_ori.mp4')
video_save = cv2.VideoWriter(video_res_path, fourcc, cap_fps, size)
imgs = glob.glob("./2d/yolov5-7.0/runs/predict-seg/exp33/*.jpg")
imgs.sort()
for img_path in imgs:
image_vis = cv2.imread(img_path)
video_save.write(image_vis)
video_save.release()