Reading images from a folder ony by one

1 visualizzazione (ultimi 30 giorni)
Tarik Razak
Tarik Razak il 15 Feb 2012
Hi I have folder with bunch of images I am trying to read the images one by one from that folder, using imread command, any ideas how to do that? will appreciate thanks

Risposte (2)

Honglei Chen
Honglei Chen il 15 Feb 2012
You can use dir and filter out the files you need, for example, let's say you want to read in all the jpg files in the folder 'myimage'.
files = dir('myimage');
for m = 1:numel(files)
if strcmp(files(m).name(end-3:end),'.jpg')
x = imread(file(m).name,'jpg');
% process x
end
end

Walter Roberson
Walter Roberson il 15 Feb 2012

Categorie

Scopri di più su Convert Image Type in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by