File size: 706 Bytes
f670afc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import os  
import cv2  
from PIL import Image  


def img_pair2vid(sat_list,media_path= 'interpolation.mp4'):
    fourcc = cv2.VideoWriter_fourcc('M', 'P', '4', 'V')
    out = cv2.VideoWriter(media_path, fourcc, 12.0, (512, 128))
    for i  in range(len(sat_list)):

        img1 = cv2.imread(os.path.join( img_dir , sat_list[i]))

        out.write(img1)
    out.release()

if __name__=='__main__':
    import csv
    img_dir = 'vis_interpolation'
    img_list = sorted(os.listdir(img_dir))
    sat_list = []
    for img in img_list:
        sat_list.append(img)
    media_path = os.path.join(img_dir,'interpolation.mp4')

    img_pair2vid(sat_list,media_path= media_path)
    print('save 2 ',media_path)