How to make a code that loads specific images from multiple subfolders within a single folder?

4 views (last 30 days)
So basically I used readtable to create a table of several hundred image names from different folders. I am trying to load the images listed in the table, which are from multiple sub-folders within a main folder. I have 2 days of coding experience so I don't really know where to start.

Answers (2)

Image Analyst
Image Analyst on 12 Jun 2018
See if you have the ImageDatastore function in your release:
Description An ImageDatastore object manages a collection of image files, where each individual image fits in memory, but the entire collection of images does not necessarily fit. To create an ImageDatastore object, use either the imageDatastore function or the datastore function. Once the object is created, you can specify ImageDatastore properties using dot notation and use functions that access and manage the data.
It can handle images in subfolders of some top level folder. Otherwise, see dir() like in the attached examples.

jonas
jonas on 12 Jun 2018
Edited: jonas on 12 Jun 2018
The documentation is great ( link )
search for 'Add Folder and Its Subfolders to Search Path'
if you have all image names in your table, just load them by
imread('filename')
Best general advice I can give you: google your issues and you will in 9 times out of 10 find a solution within a minute, either from the doc or from a previous question on this forum

Categories

Find more on Computer Vision Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!