load_video
def load_video_frames(video_path):
frames = []
count = 0
if os.path.isdir(video_path):
files=glob(video_path+'/*.png')+glob(video_path+'/*.jpg')
for file in files:
img=cv2.imread(file)
img.append(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
frames.append(img)
count += 1
return frames, 25
video = cv2.VideoCapture(video_path)
fps = int(video.get(cv2.CAP_PROP_FPS))
while True:
ret, frame = video.read()
if not ret:
break
else:
count += 1
frames.append(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
return frames, fps