edge detection issue on Text detection in images
Asked Answered
R

2

12

I am trying to implement Epshtein's paper(Detecting text in natural scenes with stroke width transform(2010)) on text detection in natural images. First step is edge detection.

I am getting some extra edges inside my text. How should I remove those?

Original image:

enter image description here My edge detection: enter image description here

In the example, you can see extra edges in the text 'WHY HURRY'

I have tried these steps in 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);

Problem #2:

As per belisarius's suggestion, I found that mean-shift filter works quite well for text region segmentation. Now I am facing another problem in the implementation of Stroke Width transform(look at Epshtein's paper).

Stroke Width works well with chars like 'H''Y' even for 'S' because the corresponding edges are usually at constant distance if we proceed in the direction of gradient.

Problem comes in chars like 'W'. For one portion of left edge of 1st upstroke we get the right edge of 2nd upstoke as its correspoding edge. Whereas for another portion, we get right edge of 1st upstroke. This introduces significant variance in the stroke width of the region of 'W' leading to terming this as non-text region according to paper.

Can anyone suggest any solution?

Rosenberry answered 15/10, 2011 at 7:14 Comment(1)
Hi, can you share the code for SWT in matlab if you have completed it ? You can contact me on [email protected]Vaccine
Q
10

Use a Mean Shift Filter before the Edge Detection. Example in Mathematica:

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

Outputs:

enter image description hereenter image description here

Quechuan answered 15/10, 2011 at 19:1 Comment(1)
Since EdgeDetection in Mathematica is not the same as OPs, you could also post EdgeDetection without MeanShiftFilter for comparison.Armistead
P
0

Take a look at the Matlab documentation for edge and the Wikipedia article on the Canny algorithm.

You can call edge(I, 'canny', thresh, sigma) for more control. Play around with the low and high edge thresholds. I'd try lowering the high threshold first: since the interior edges are not connected to the letter edges, the gradient magnitude must exceed the high threshold inside the letters.

You can also increase sigma to blur the image more before edge detection. (Your Gaussian blurring is redundant, because edge blurs the image for you.)

Pino answered 15/10, 2011 at 19:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.