How to read Images from multiple folders?

Rohan Gupta

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 of the image and store them in a variable.

I don't know as how can I read images from multiple folders. It would be really helpful if anyone can help me with this.

cs95

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

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to read multiple images from multiple folders in python

Open/read multiple .tif images from multiple folders on different levels

How to read multiple images from two different folders one by one using python?

How to read a specific paragraph from from multiple folders and files

Insert multiple images from multiple folders in VBA

read multiple text files from multiple folders

Read *.csv as list from multiple folders

How to read multiple images in Python?

How to copy images from multiple sub-folders to a common folder and rename them?

Reading images in multiple folders

Read images from sub folders and save into another folder

Read and extract multiple PDF's from multiple folders using python

Combining images into video with ffmpeg, but from multiple folders into the same frames

Displaying random images from multiple folders using python

Matlab: Accessing images from multiple folders in single loop

Read from an Excel spreadsheet, and rename multiple folders with data from XLSX

How to delete files from multiple folders excluding couple of folders?

Azure Data Factory Read Csv Files from multiple portioned folders

How to remove dot from multiple folders

How to import tags from multiple folders?

How to compare multiple screenshots from two folders

How to read multiple images and store them on MATLAB?

How to read files in multiple folders under Shared Google Drive?

how to copy files and folders from docker context to images?

how to download images from url and create folders with python in pandas

UWP how to upload a list of images from different folders to different pivotItems

Collection views - receiving images from different folders - how?

How to unlink two images from two different folders at once in php

How to load images and text labels for CNN regression from different folders