0

I am trying to detect filled shapes (mainly texts) from an image using edge detection algorithms like Sobel, Canny, Prewitt, Roberts etc. I am using C# as my programming language. Image can contain texts of different sizes. The result I am getting after applying edge detection algorithms are the edges of texts like this

enter image description here

But I want to detect the whole body of text (no matter how big the size of text is), like this

enter image description here

I don't know whether I am doing it write or wrong, for what I want to achieve. I have also tried it by increasing the size of my mask, but it eventually neglect small size texts. I need help in it.

Umair Jameel
  • 1,573
  • 3
  • 29
  • 54
  • your input is already more like your desired output! What are you trying to achieve? What is your desired results? – Balaji R Jun 16 '16 at 17:29
  • I might have colored image having text of different colors (light text and dark background and opposite as well). If i will try to convert colored image a black and white, how do I know that what has to be white and what has to be dark. Other than that, if I upload a captured image of a page of real book. In that image, it is the possibility that some text is blurred or having disturbed texts. I want to convert that into same black and white color text to make it prominent. That's why I am trying to do it. – Umair Jameel Jun 16 '16 at 17:36
  • You know, this honestly seems like a simple case of reducing the image to 2 colours... – Nyerguds Jan 05 '18 at 08:47

1 Answers1

1

As said by @BalajiR your text is already in the desired shape and edge detection followed by filling would be overkill.

If you have different colors, you can just binarize by using the rule "background/not background".

Finding characters on a real picture is something completely different, which deserves a separate question. In particular, adaptive thresholding is usually required.

Regarding blur/disturbed text, there is nothing you can do to restore perfect characters (deblurring can help to some extent but I would not recommend). Image processing algorithms cannot "re-invent" the shape of the characters.