图像中文本检测的边缘检测问题

时间:2011-10-15 07:14:09

标签: image-processing ocr image-segmentation

我正在尝试im p lement Epshtein's paper 使用笔画宽度变换检测自然场景中的文字(2010) )进行文本检测在自然图像中。 第一步是边缘检测。

我在文本中得到了一些额外的边缘。我应该如何删除它们?

原始图片:

enter image description here 我的边缘检测: enter image description here

在示例中,您可以在text'WHY HURRY'中看到额外的边缘

我在Matlab中尝试了这些步骤:

% contrast enhancement
I_adjust = imadjust(I);

% dilation & erosion
se = strel(ones(3,3));
I_dilate = imdilate(I_adjust, se);
I_final = imerode(I_dilate, se);

% gaussian smoothing
h_mask = fspecial('gaussian');
I_final = imfilter(I_final,h_mask);
figure; imshow(I_final);

BW_canny = edge(I_final,'canny');
figure; imshow(BW_canny);

问题#2:

根据belisarius的建议,我发现均值平移滤波器对于文本区域分割非常有效。现在我在实施笔画宽度变换时遇到了另一个问题(看看Epshtein的论文)。

笔画宽度适用于'H''Y'等字符,即使对于'S'也是如此,因为如果我们沿着渐变方向前进,相应的边缘通常是恒定的距离。

问题出现在'W'之类的字符中。对于左上边缘的第一个上行程的一部分,我们得到第二个上行链路的右边缘作为其对应的边缘。而对于另一部分,我们得到第一次上行的右边缘。这引入了'W'区域的笔划宽度的显着变化,导致根据纸张将其称为非文本区域。

有人可以建议任何解决方案吗?

2 个答案:

答案 0 :(得分:10)

在边缘检测之前使用Mean Shift Filter。 Mathematica中的示例:

i = Import["http://img839.imageshack.us/img839/28/whyhurry.jpg"];
iM = MeanShiftFilter[i, 2, .15, MaxIterations -> 10]
EdgeDetect[iM]

输出:

enter image description here enter image description here

答案 1 :(得分:0)

查看edgeMatlab documentation

the Wikipedia article on the Canny algorithm.

您可以致电edge(I, 'canny', thresh, sigma)以获得更多控制权。使用低边缘和高边缘阈值。我首先尝试降低高阈值:由于内部边缘没有连接到字母边缘,因此渐变幅度必须超过字母内部的高阈值。

您还可以增加sigma以在边缘检测之前模糊图像。 (你的高斯模糊是多余的,因为edge为你模糊图像。)

相关问题