i want save images folder. tried code given below
[ilabel num] = bwlabel(if); disp(num); iprops = regionprops(ilabel); ibox = [iprops.boundingbox]; ibox = reshape(ibox,[4 83]); figure,imshow(ibox); 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 see letters 1 one %imshow(img_r);pause(0.5) imwrite(img_r,['h:\\mainproject\\codes\\images\\test0.jpg' ]); end but last letter saved in folder. dont know made mistakes.i tried lot didn't it.please me , in advance
i think may overwriting images, since using same name test0.jpg. try:
[ilabel num] = bwlabel(if); disp(num); iprops = regionprops(ilabel); ibox = [iprops.boundingbox]; ibox = reshape(ibox,[4 83]); figure,imshow(ibox); 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 see letters 1 one %imshow(img_r);pause(0.5) image_name = strcat('h:\\mainproject\\codes\\images\\test', num2str(n), '.jpg'); imwrite(img_r,[image_name]); end i can't test now, , couldn't comment (points below 50). hope helps,
Comments
Post a Comment