File size: 390 Bytes
0077a91 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import cv2
from config import FRAME_SKIP
def extract_frames(video_path):
cap = cv2.VideoCapture(video_path)
frames = []
i = 0
while True:
ret, frame = cap.read()
if not ret:
break
if i % FRAME_SKIP == 0:
frames.append(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
i += 1
cap.release()
return frames
|