How to read Images from multiple folders?

后端 未结 2 407

I am working with mammogram images. I have 3 folders with each folder consisting of 40 images. I want to read images from each folders so that I can extract features from each o

相关标签:
2条回答
  • 2021-01-26 02:47

    Hope This can be helpful

    Browse files and subfolders in Python

    http://pythoncentral.io/how-to-traverse-a-directory-tree-in-python-guide-to-os-walk/

    0 讨论(0)
  • 2021-01-26 02:56

    Use os.walk to recursively traverse a directory, and PIL to handle images.

    import os
    from PIL import Image
    
    for path, _, files in os.walk('.')
        for file in files:
            foo = Image.open(file) 
            # now do something with the image
    
    0 讨论(0)
提交回复
热议问题