How to read multiple images without renaming images like 10_left.jpeg, 13_left.jpeg, 15_left.jpeg

1 回表示 (過去 30 日間)
If I have multiple images in a folder e.g 10_left.jpeg, 13_left.jpeg, 15_left.jpeg, 16_left.jpeg & i want to read images in matlab one by one without renaming these images. how can I do it?

採用された回答

Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh 2015 年 6 月 2 日
編集済み: Salaheddin Hosseinzadeh 2015 年 6 月 3 日
Hi Hassan,
Obviously your files names have a pattern.
You can make a for loop and create the file names
for i = 10:15
fileName = ['C:\myFolder\myPics\',num2str(i),'_left.jpg'];
try
image = imread(fileName); % Have a look at Image Analyst comment
catch
disp('file doesn't exist');
end
end
This is the basic idea, you can make it better and more specific.
Good luck!
  3 件のコメント
Image Analyst
Image Analyst 2015 年 6 月 2 日
But please don't use image as the name of your variable since it's a built in function and you'll blow it away if you use image as the name of your variable.
Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh 2015 年 6 月 3 日
編集済み: Salaheddin Hosseinzadeh 2015 年 6 月 3 日
@Image Analyst.
Thanks a lot for your attention Image Analyst. I didn't know image is a MATLAB function.

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2015 年 6 月 2 日
Be sure to check out the answer to this and many other question in our FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by