Created
October 14, 2023 23:20
-
-
Save kevinlinxc/b6ce924182b3483a834e9db215b3e685 to your computer and use it in GitHub Desktop.
Simple OpenCV video genereator where each frame is the frame number
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 | |
# make a video where each frame is the frame number | |
writer = cv2.VideoWriter("frame_numbers.mp4", cv2.VideoWriter_fourcc(*"mp4v"), 30, (1920, 1080)) | |
for i in range(6572): | |
frame = numpy.zeros((1080, 1920, 3), dtype=numpy.uint8) | |
cv2.putText(frame, str(i), (500, 500), cv2.FONT_HERSHEY_SIMPLEX, 10, (255, 255, 255), 2) | |
writer.write(frame) | |
print(i, end="\r") | |
writer.release() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment