Loading all images using imread from a given folder

后端 未结 8 1993
长发绾君心
长发绾君心 2021-01-30 21:48

Loading and saving images in OpenCV is quite limited, so... what is the preferred ways to load all images from a given folder? Should I search for files in that folder with .png

8条回答
  •  无人及你
    2021-01-30 22:03

    import os
    import cv2
    rootdir = "directory path"
    for subdir, dirs, files in os.walk(rootdir):
        for file in files:
            frame = cv2.imread(os.path.join(subdir, file)) 
    
    

提交回复
热议问题