|
@@ -188,13 +188,22 @@ class CloudPhotoView(View):
|
|
|
@param pic_list: 图片文件名集合
|
|
|
@return:
|
|
|
"""
|
|
|
- fps = 0.5 # 帧率
|
|
|
- img_size = (1920, 1080) # 图片尺寸
|
|
|
+ if not pic_list:
|
|
|
+ raise Exception('this pic_list is null.')
|
|
|
+ fps = 1 # 帧率
|
|
|
+ img_path = poj_path + r'\Ansjer\file\{}'.format(pic_list[0])
|
|
|
+ image = cv2.imread(img_path)
|
|
|
+ size = image.shape
|
|
|
+ w = size[1] # 宽度
|
|
|
+ h = size[0] # 高度
|
|
|
+ img_size = (w, h) # 图片尺寸
|
|
|
fourcc = cv2.VideoWriter_fourcc(*"mp4v")
|
|
|
video_writer = cv2.VideoWriter(video_path, fourcc, fps, img_size)
|
|
|
for item in pic_list:
|
|
|
img_path = poj_path + r'\Ansjer\file\{}'.format(item)
|
|
|
frame = cv2.imread(img_path)
|
|
|
+ if frame is None:
|
|
|
+ continue
|
|
|
frame = cv2.resize(frame, img_size) # 生成视频 图片尺寸和设定尺寸相同
|
|
|
video_writer.write(frame) # 将图片写进视频里
|
|
|
os.remove(img_path)
|