Last active
June 14, 2024 18:33
-
-
Save talhaahussain/4502fb022c3a58b34cec7db146da52c9 to your computer and use it in GitHub Desktop.
video_to_image_seq.py -- A Python function to convert a video to a sequence of images. Depends on OpenCV. See the original and an application here: https://github.com/talhaahussain/grappling-pose-identification/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
def split_video_into_frames(filename): | |
frames = [] | |
cap = cv2.VideoCapture(filename) | |
fps = cap.get(cv2.CAP_PROP_FPS) | |
success = 1 | |
while success: | |
success, frame = cap.read() | |
if success: | |
frames.append(frame) | |
cap.release() | |
return frames, fps |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment