Loading all images using imread from a given folder

后端 未结 8 2007
长发绾君心
长发绾君心 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:19

    you can use glob function to do this. see the example

    import cv2
    import glob
    for img in glob.glob("path/to/folder/*.png"):
        cv_img = cv2.imread(img)
    

提交回复
热议问题