필터 지우기
필터 지우기

how to uplad and process multiply images

조회 수: 2 (최근 30일)
Kamyar Mazarei
Kamyar Mazarei 2021년 3월 26일
편집: Jan 2021년 3월 26일
hi
i have 520 images i want to upload and make them black-white only (binary)
i know how to do it 1 by 1 but not sure how to do all at once
dont even know how to upload multiply images it gives me error when i drag t hem
i know i can use 'for' command but dont know how
thank you

채택된 답변

Jan
Jan 2021년 3월 26일
Folder = 'C:\You\Base\Folder';
FileList = dir(fullfile(Folder, '*.jpg')); % Use ** for recursive search
for iFile = 1:numel(FileList)
File = fullfile(FileList(iFile).folder. FileList(iFile).name);
... % Now insert or call the code for converting 1 file here
end
  댓글 수: 1
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 3월 26일
Jan's answer is more uniform than my proposed answer.

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

추가 답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 3월 26일
It is doable, but your image file names need to be in a sequential order, e.g.: Image1.jpg, Image2.jpg, ...., etc.,
OR IM_01.jpeg, IM_02.jpeg, .., etc., OR IM1.jpg, IM2.jpg,... etc., OR something in a similar fashion.
If this is the case, then you can go ahead; otherwise, you'd need to rename them.
Once you get all your image file names sorted out, you can use something similar to the following type of string conversion procedure to make up the list of your image data file names. E.g.: IM1.jpg, IM2.jpg,... IM13.jpg and import them into MATLAB workspace.
for ii=1:13
MM{ii} =strcat('IM', num2str(ii), '.jpg')
% READ IMAGEs
DATA{ii} = imread(MM{ii});
end
Good luck
  댓글 수: 1
Jan
Jan 2021년 3월 26일
편집: Jan 2021년 3월 26일
With using dir() you can get a list of files without the need to rename the files.

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

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by