How do I search for images in a user-inputted directory with user-inputted file extensions?
Show older comments
I am creating a function that will let the user give a directory name and file type, and then the function will take those and search for the corrosponding files
1 Comment
Use dir:
and fullfile:
Either loop over each of the file extensions and call dir for each one, or call dir on the folder and then filter for the extensions that you want to keep (you might find fileparts useful for this).
See also:
Answers (1)
jibrahim
on 6 Sep 2019
0 votes
Take a look at imageDatastore
To point to all files with a certain extension in a folder:
imds = imageDatastore('C:\dir\imagedata','FileExtensions',{'.jpg','.tif'})
Categories
Find more on Image Filtering and Enhancement 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!