how to write multiple images into a folder
Show older comments
I have this code
[parentFolder deepestFolder] = fileparts('24x24');
output_folder = 'E:\Bismillah Wisuda 115\progress TA ku new\program';
for a=1:40
im=imread(['E:\Bismillah Wisuda 115\progress TA ku new\program\data training\citra training positif2\kendaraan' num2str(a) '.jpg']);
image=imresize(im,[24 24]);
imwrite(image,['kendaraan' num2str(a) '.jpg'],'jpg');
newSubFolder = sprintf(deepestFolder);
fullname = fullfile(output_folder,'output_folder',newSubFolder);
if ~exist(parentFolder, 'dir')
mkdir(parentFolder);
end
end
it can run, but my folder is still empty. Can you please fix it? Thank you.
Accepted Answer
More Answers (1)
Image Analyst
on 6 Nov 2016
2 votes
That code is not very robust at all. I can see at least 3 or 4 problems right off the bat. See the FAQ for two ways that it can be done. http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F
Categories
Find more on Image Preview and Device Configuration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!