필터 지우기
필터 지우기

How can I load multiple images and save in a subfolders in the same path?

조회 수: 1 (최근 30일)
Subrata Bhatacharjee
Subrata Bhatacharjee 2018년 12월 29일
답변: Walter Roberson 2018년 12월 29일
I want to load multiple images from a folder path (''C:\Users\Subrata\Desktop\New folder\robin'') and I want to save in a sub folder ("C:\Users\Subrata\Desktop\New folder\robin\exmimg"). Where to set my original code between loading and saving code?

답변 (1개)

Walter Roberson
Walter Roberson 2018년 12월 29일
srcdir = 'C:\Users\Subrata\Desktop\New folder\robin';
destdir = 'C:\Users\Subrata\Desktop\New folder\robin\exmimg';
srcext = '.png';
dstext = '.tif';
dinfo = dir( fullfile(srcdir, ['*' srcext]) );
numfiles = length(dinfo);
srcnames = fullfile(srcdir, {dinfo.name});
for K = 1 : numfiles
thissrcfile = srcnames{K};
[~, basename, ~] = fileparts(thissrcfile);
thisdstfile = fullfile( destdir, [basename dstext] );
thisimage = imread(thissrcfile);
....
modifiedimage = ...
imwrite(modifiedimage, thisdstfile);
end

카테고리

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