I am working on text extraction form image. For this I am using edge detection technique. I detected edges of a image with text or non text regions.
Now I want to eliminate the non-text region from image.
Please tell me how can I do this?
The code I have so far is:
i = imread('t1.jpg');
i1 = rgb2gray(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,[]);
imshow(i);
hold on;
for cnt = 1:size(Ibox,2)
rectangle('position',Ibox(:,cnt),'edgecolor','r');
end