在python要匯出影片要用到numpy,所以我們要先安裝pip install numpy
在開始的時候import cv2 讀取圖片
import cv2
import numpy as np
我們將偵數設定30,size設定成(256,128)
Exportvideo = cv2.VideoWriter(r'D:\viwepoint.mp4',-1,30,(256,128))
img_array=[]
for file_img in [r'D:\img\{0}.png'.format(i) for i in range(66)]:
img = cv2.imread(file_img)
imgarray.append(img)
for i in range(66):
Exportvideo.write(imgarray[i])