Created
October 23, 2015 20:22
-
-
Save vtsatskin/4190fee5c4804cb69f17 to your computer and use it in GitHub Desktop.
Saving numpy image frames to video with OpenCV
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 | |
import numpy as np | |
def save_frames(frames, file_path, width, height, fps, codec="mp4v"): | |
# Define the codec and create VideoWriter object | |
fourcc = cv2.cv.CV_FOURCC(*codec) | |
out = cv2.VideoWriter(file_path, fourcc, fps, (width,height)) | |
for frame in frames: | |
out.write(frame) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you for your code !
run the code ,it's nothing?
thank you