Image Segmentation and Saving image
Afficher commentaires plus anciens
hello I'm a final year student using Matlab for image segmentation but I have a problem. How do I save multiple pictures automatically? Please help, thank you
image_folder = 'C:\Users\ADMIN\Matlab\Implementasi';
outfolder = 'C:\Users\ADMIN\Matlab\Implementasi\output';
if ~isdir(outfolder); mkdir(outfolder); end
load mri %I presume it has the variable map in it
files = dir(fullfile(image_folder, '*.jpg'));
% filenames = fullfile({fileinfo.folder}, {fileinfo.name});
% total_images = numel(filenames);
for iFiles = 1:numel(files)
thisfilename = fullfile(files(iFiles).folder,files(iFiles).name);
% for n = 1 : total_images
% thisfile = filenames{n};
[~, basename, ext] = fileparts(image_folder);
citra = imread(thisfilename);
V = squeeze(citra);
fprintf('processing %s\n', basename);
citra3 = montage(reshape(V,size(citra)), map, 'Indices', 3);
outfile = fullfile(outfolder, sprintf(['%s-coba-%03d.%s',basename,ext]));
saveas(citra3, outfile);
end
Réponse acceptée
Plus de réponses (1)
Rosida Octavia Sitorua
le 27 Fév 2021
0 votes
2 commentaires
KALYAN ACHARJYA
le 28 Fév 2021
Oh, this is partial code, the result, I represent the output image, which you want to save. Consider your output image there and change the result variable name accordingly.
Rosida Octavia Sitorua
le 8 Mar 2021
Catégories
En savoir plus sur Images dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
