Ask Your Question

Eroding Text to from blobs

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

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);


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

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

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
Login/Signup to Answer

Question Tools


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

Seen: 232 times

Last updated: Mar 24 '14