read all images in a folder python opencv code example
Example 1: get all type of image in folder python
import cv2
import glob
imdir = 'path/to/files/'
ext = ['png', 'jpg', 'gif'] # Add image formats here
files = []
[files.extend(glob.glob(imdir + '*.' + e)) for e in ext]
images = [cv2.imread(file) for file in files]
Example 2: opencv read and show images in folder python
how to read all images from a folder in python using opencv