필터 지우기
필터 지우기

How to load specific image extension from specific path directory MATLAB ?

조회 수: 3 (최근 30일)
Najwa Samlan
Najwa Samlan 2019년 9월 6일
댓글: Najwa Samlan 2019년 9월 7일
Hi. How can I load all image that has png,jpeg and jpg extension in a specific path directory by using push button ?
Someone please help me.

답변 (1개)

chandrapal Singh
chandrapal Singh 2019년 9월 6일
Create a Pushbutton and use the following code
path=uigetdir();
path
img_directory= dir(path);
total_images= length(img_directory)-2;
total_images
for i=3:length(img_directory)
im= imread(strcat(path,'\',img_directory(i).name));
im=imresize(im, [512 512]);
out{:,:,i-2}=im;
end
  댓글 수: 3
Walter Roberson
Walter Roberson 2019년 9월 6일
See also https://www.mathworks.com/matlabcentral/answers/478309-facing-difficulty-in-converting-a-matlab-function-to-c-code#comment_742361 for why using dir results that way is wrong
Najwa Samlan
Najwa Samlan 2019년 9월 7일
sorry but I dont get it. Can you show an example on how to solve this problem ?
my path is : C:\Users\HP\Downloads\FYP REFERENCES\DATASET
and image extension that I would like to choose is either .JPG, .JPEG or .PNG only.
so how can code this into push button function?

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

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by