def make_mp4(ims, name="", fps=20, scale=1):
print("Making mp4...")
with imageio.get_writer("{}.mp4".format(name), mode='I', fps=fps) as writer:
for im in ims:
if scale != 1:
new_shape = (int(im.shape[1] * scale), int(im.shape[0] * scale))
interpolation = cv2.INTER_CUBIC if scale > 1 else cv2.INTER_AREA
im = cv2.resize(im, new_shape, interpolation=interpolation)
writer.append_data(im[..., ::-1])
print("Done")
评论列表
文章目录