필터 지우기
필터 지우기

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

조회 수: 3 (최근 30일)
Md Farhad Mokter
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.

채택된 답변

Image Analyst
Image Analyst 2019년 5월 28일
See the FAQ for explanation and code samples: The FAQ

추가 답변 (1개)

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
Md Farhad Mokter
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
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).

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by