フィルターのクリア

save sequence of images in a folder using matlab

3 ビュー (過去 30 日間)
annmaria
annmaria 2015 年 7 月 10 日
コメント済み: Image Analyst 2015 年 7 月 10 日
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

採用された回答

Image Analyst
Image Analyst 2015 年 7 月 10 日
Change the filename then:
baseFileName = sprintf('H:\\mainproject\\codes\\images\\Letter%d.png');
fullFileName = fullfile(pwd, baseFileName); % Prepend folder
imwrite(img_r, fullFileName);
  1 件のコメント
Image Analyst
Image Analyst 2015 年 7 月 10 日
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.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by