how to read multiple pgm images ?
古いコメントを表示
I'm working with a database which has 472 pgm files inside a folder named faces. I want to read all 472 and store it I
also each file inside the folder is name cmu_0000.pgm..........cmu_00471.pgm
4 件のコメント
Stephen23
2017 年 8 月 17 日
Why not read the MATLAB documentation?:
Or any of the hundreds of threads on this forum that explain how to read files in a loop:
etc., etc.
kitty varghese
2017 年 8 月 17 日
編集済み: Stephen23
2017 年 8 月 17 日
Stephen23
2017 年 8 月 17 日
@kitty Varghese: today I formatted your code correctly for you. In future you can do this yourself: simply select the code text and then click the {} Code button.
Stephen23
2017 年 8 月 17 日
@kitty Varghese: there is no point in getting dir to search for files with a .m extension:
thepath = ... *.m';
if what you are after is .pgm files. Do not hard-code how many files there are:
for i=1:472,
when it is much more robust to use numel. I would also recommend avoid i as a variable name.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Images についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!