How to save multiple images in a "for" loop?
I need to save a lot of pictures in a "for" loop.I use python,imported opencv3.0.0 library already.
I need to save a lot of pictures in a "for" loop.I use python,imported opencv3.0.0 library already.
Assuming that you want to save files from a video recording, you can do this :
import cv2
vid = cv2.VideoCapture("video.mp4")
d = 0
ret, frame = vid.read()
while ret:
ret, frame = vid.read()
filename = "images/file_%d.jpg"%d
cv2.imwrite(filename, frame)
d+=1
Asked: 2016-09-02 00:39:11 -0600
Seen: 19,406 times
Last updated: Sep 09 '16
Missing header files in OpenCV 2.4.3 pre-built library install
challenging problem..how to change src files
How do I fix "cannot find or open PBD files visual studio 2010 express
FileStorage Documetation Wrong/Failing
VideoWriter features support for Android?
Unable to open video files with .mpeg file format using opencv in python
Is it possible to have ALL header files referenced by OpenCV included in the standard download?
reading a sequence of files within a folder
Writing Mat to FileStorage: is there a way to format the output?