How to read a series of images with python using OpenCV?
I don't know the way to load multiple images with python using OpenCV's API
you probably still have to "read" an image somehow, but you can batch-process them like this:
from glob import glob
for fn in glob('*.png'):
im = cv2.imread(fn)
#
# your processing here.
if your images are numbered, like im00004.png
you can even abuse the VideoCapture:
cap = cv2.VideoCapture("im%05d.png") #like a printf pattern, leading zeros are important !
while cap.isOpened():
ret,img = cap.read()
#
# your processing here
Asked: 2016-08-25 23:07:01 -0600
Seen: 10,415 times
Last updated: Aug 26 '16
what do you mean, exactly ?
like reading in a whole directory ?
I mean reading many images at the same time so that I don't need to read them in one by one.Since I have to process these pictures using the same algorithm.