如何消除下图的非文本区域?

时间:2016-04-20 07:40:27

标签: matlab image-processing ocr image-segmentation

我正在处理文本提取表单图像。为此,我使用边缘检测技术。我检测到带有文本或非文本区域的图像边缘 现在我想从图像中消除非文本区域 请告诉我该怎么做?

我到目前为止的代码是:

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

enter image description here

1 个答案:

答案 0 :(得分:0)

您可以考虑使用更多"文字"导向方法。
您考虑过使用"Stroke-Width Transform" (SWT)吗? 根据边缘是固定宽度脊的一部分的可能性,这个变换滤波器边缘,这通常是文本的特征。

相关问题