import cv2
import imageio
import os
predict_list = []
gt_list = []
predict_path_list =[]
gt_path_list =[]
scale_percent = 60
width = int(1280 * scale_percent / 100)
height = int(720 * scale_percent / 100)
dim = (width, height)
for i in range(21):
predict_file_name = predict_affix+str(i)+predict_suffix
predict_path = predict_dir+predict_file_name
gt_file_name = str(i)+gt_suffix
gt_path = gt_dir+gt_file_name
predict_data = cv2.imread(predict_path)
gt_data = cv2.imread(gt_path)
predict_data = cv2.resize(predict_data, dim, interpolation=cv2.INTER_AREA)
gt_data = cv2.resize(gt_data, dim, interpolation=cv2.INTER_AREA)
predict_data = cv2.cvtColor(predict_data, cv2.COLOR_BGR2RGB)
gt_data = cv2.cvtColor(gt_data, cv2.COLOR_BGR2RGB)
predict_list.append(predict_data)
gt_list.append(gt_data)
predict_path_list.append(predict_path)
gt_path_list.append(gt_path)
imageio.mimwrite(os.path.join(output_dir, 'predict.mp4'), predict_list, fps=5, quality=9 )
imageio.mimwrite(os.path.join(output_dir, 'gt.mp4'), gt_list, fps=5, quality=9 )