save sequence of images in a folder using matlab
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
annmaria
el 10 de Jul. de 2015
Comentada: Image Analyst
el 10 de Jul. de 2015
I want to save images into a folder. I tried a code given below
[Ilabel num] = bwlabel(If);
disp(num);
Iprops = regionprops(Ilabel);
Ibox = [Iprops.BoundingBox];
Ibox = reshape(Ibox,[4 83]);
figure,imshow(Ibox);
for n=1:num
[r,c] = find(Ilabel==n);
% Extract letter
n1=Iout(min(r):max(r),min(c):max(c));
% Resize letter (same size of template)
img_r=imresize(n1,[42 24]);
%figure,imshow(n1);
%Uncomment line below to see letters one by one
%imshow(img_r);pause(0.5)
imwrite(img_r,['H:\\mainproject\\codes\\images\\test0.jpg' ]);
end
But only the last letter is saved in the folder. I dont know where it made mistakes.I tried a lot but i didn't get it.please help me and thanks in advance
0 comentarios
Respuesta aceptada
Image Analyst
el 10 de Jul. de 2015
Change the filename then:
baseFileName = sprintf('H:\\mainproject\\codes\\images\\Letter%d.png');
fullFileName = fullfile(pwd, baseFileName); % Prepend folder
imwrite(img_r, fullFileName);
1 comentario
Image Analyst
el 10 de Jul. de 2015
By the way, you can just use the bounding box, which you already got, rather than recomputing it with find(), min(), and max(). That's just a waste of time.
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!