def gen_image_frames(img_path, fps, duration):
"""Generate frames from a image so that can play like a video.
Parameters
----------
img_path : string
absolute path to the image.
fps : int
frame rates per second
duration : float
duration of the sequence in second
"""
num_frames = int(fps*duration)
img = cv2.imread(img_path)
frames = []
for i in xrange(num_frames):
frames.append(img)
return frames, len(frames)
评论列表
文章目录