Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
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?

Antworten (1)

Walter Roberson
Walter Roberson am 29 Dez. 2018
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

Kategorien

Mehr zu Convert Image Type finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by