MH0386's picture
Upload folder using huggingface_hub
3e165b2 verified
raw
history blame contribute delete
398 Bytes
import cv2
import numpy as np
def load_video_to_cv2(input_path: str) -> list[np.ndarray]:
video_stream = cv2.VideoCapture(input_path)
full_frames = []
while 1:
still_reading, frame = video_stream.read()
if not still_reading:
video_stream.release()
break
full_frames.append(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
return full_frames