import cv2
# 读取图像序列
images = []
for i in range(1, 101):
filename = f"frame{i}.jpg"
image = cv2.imread(filename)
images.append(image)
# 创建视频编码器
fourcc = cv2.VideoWriter_fourcc(*'XVID')
video = cv2.VideoWriter('output.avi', fourcc, 20.0, (640, 480))
# 写入图像到视频
for image in images:
video.write(image)
# 释放资源
video.release()
cv2.destroyAllWindows()
图片转视屏的代码
最新推荐文章于 2024-11-09 20:41:28 发布