I have written this matlab code (given below) for detecting text from an image. This code is detecting the text from the image, but now I want to create an output image for each detected letter from the image. Please tell how can I do that?
Code:
i = imread('text.png');
i1 = i;
imshow(i1);
i2 = edge(i1,'canny',0.3);
imshow(i2);
se = strel('square',2);
i3 = imdilate(i2,se);
imshow(i3);
i4 = imfill(i3,'holes');
imshow(i4);
[Ilabel num] = bwlabel(i4);
disp(num);
Iprops = regionprops(Ilabel);
Ibox = [Iprops.BoundingBox];
Ibox = reshape(Ibox,[4 92]);
imshow(i);
hold on;
for cnt = 1:92
rectangle('position',Ibox(:,cnt),'edgecolor','r');
end