MATLAB Answers

0

How to read images from one directory into variables using loop?

Md Farhad Mokter さんによって質問されました 2019 年 5 月 27 日
最新アクティビティ Rik
さんによって コメントされました 2019 年 5 月 28 日
I am new in Matlab. I want to read all images from a directory and store each of them into separate variables. For example, if there are 225 images then i should have 225 variables, each of them containing pixel values of corresponding image, no matter same name as image or different.

  0 件のコメント

サインイン to comment.

2 件の回答

回答者: Image Analyst
2019 年 5 月 28 日
 採用された回答

See the FAQ for explanation and code samples: The FAQ

  0 件のコメント

サインイン to comment.


Rik
回答者: Rik
2019 年 5 月 27 日

You don't want numbered variables. Try a cell array instead. That way you can much more easily loop through your images to do the further processing.

  6 件のコメント

Rik
2019 年 5 月 28 日
There is no reason to store your images in separate variables. Why do you think you need that?
Md Farhad Mokter 2019 年 5 月 28 日
I need the ratio of black pixels to other pixels for every image, so I am trying to store all the black pixels of each image into a separate variable.
Rik
2019 年 5 月 28 日
You are much better off just processing the images in a loop without storing the intermediate steps. You could also consider a struct array with a field for the file name and a field with the property of interest (and you could even add a field with the image itself).

サインイン to comment.



Translated by