Reading images from a folder ony by one

2 次查看(过去 30 天)
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

回答(2 个)

Honglei Chen
Honglei Chen 2012-2-15
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 2012-2-15

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by