Accessing Image Files from Multiple Folders

Hello All,
I'm having difficulty reading images from multiple folders and running the same code on all of them. Suppose my image directory is
dir ('C:\...exp03\data');
And the 'data' folder have folders data01, data02 etc.. where each folder would have images 01_01.jpg, 01_02.jpg (from data01 folder) and 02_01.jpg, 02_02.jpg (from data02 folder) etc.
So far I have the following code which runs for 1 folder.
fileNames = dir(fullfile('C:\...\data01','*.jpg'));
N = length(fileNames);
for k = 1:N
filename = fileNames(k).name;
C{k} = imread(filename);
end
How do I modify so that I can read the images from all image folders? Please help.
Thank You

 採用された回答

Image Analyst
Image Analyst 2013 年 11 月 4 日

1 投票

See my demo attached below.

4 件のコメント

CX
CX 2013 年 11 月 4 日
Awesome. Thank you so much sir!!!
CX
CX 2013 年 11 月 4 日
Could you please let me know how to access an image in your attached file?
Image Analyst
Image Analyst 2013 年 11 月 5 日
Just put in an imread() or imshow() or something like that.
CX
CX 2013 年 11 月 9 日
Thank you!!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeImages についてさらに検索

質問済み:

CX
2013 年 11 月 4 日

コメント済み:

CX
2013 年 11 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by