Ask Your Question
0

Eroding Text to from blobs

asked 2014-03-23 22:30:01 -0600

Luek gravatar image

I need to detect text blocks on a document and get back their bounding boxes, I have heard that I should erode the image which will "smudge" the text together and form blobs, then I can use blob detection to find where the text is. Currently I have I binarized image with some text on it.

I have been using this code to erode, and it is slightly merging the text together. But how can I make it more severe? The parameters have me slightly confused and if someone could explain how I could make the erosion harsher that would be great!

erode(quad, quad, Mat(), cv::Point(-1, -1), 2, 1, 1);

Thanks.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2014-03-24 01:52:53 -0600

Hi Luek,

By using Mat() as the third argument on erode you are using de default 3x3 structuring element, which might be too small for your case. You should experiment with larger sizes/different shapes of structuring element until you achieve satisfying results..

You can try something like this:

int size = 6; //Play with this size until you get the results you want
erode ( quad, quad, cv::getStructuringElement ( MORPH_RECT, size ), cv::Point ( -1, -1 ), 2, 1 , 1);
edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-03-23 22:30:01 -0600

Seen: 528 times

Last updated: Mar 24 '14