How to run all the image with format jpg in folder? and save into folder?
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dayangku Nur Faizah Pengiran Mohamad
le 22 Avr 2024
Commenté : Dayangku Nur Faizah Pengiran Mohamad
le 22 Avr 2024
Hello. Anyone know how to run a folder with thousand images instead of run one by one the image? and save into folder?
I=imread('11_285.jpg');
imshow(I)
magnificationFactor = 1.2;
J=imresize(I,magnificationFactor, 'bilinear');
imshowpair(I,J,method="montage")
imwrite(J,'11_285_rescale.jpg');
0 commentaires
Réponse acceptée
Walter Roberson
le 22 Avr 2024
dinfo = dir('*.jpg');
filenames = fullfile({dinfo.folder}, {dinfo.name});
nfiles = length(filenames);
magnificationFactor = 1.2;
for K = 1 : nfiles
thisfile = filenames{K};
[folder, basename, ext] = fileparts(thisfile);
outfile = fullfile(folder, basename + "_rescale" + ext);
I = imread(thisfile);
J = imresize(I, magnificationFactor, 'bilinear');
imwrite(J, outfile);
end
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Image Segmentation and Analysis dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!