user3247146
user3247146

Reputation:

Use OpenCV to detect text blocks to send to Tesseract iOS

How can I use OpenCV to detect all the text in an image, I want to to be able to detect "blocks" of texts individually. Then pass the the recognized blocks into tesseract. Here is an example, if I were to scan this I would want to scan the paragraphs separately, not go from left to right which is what tesseract does.

Image of the example

Upvotes: 3

Views: 2044

Answers (1)

user2518618
user2518618

Reputation: 1407

That would be my first test:

  • Threshold the image to get a black and white image, with the text in black
  • Erode it until the paragraph converts to a big blob. It may have lots of holes, it doesn't matter.
  • Find contours and the bounding box

If some paragraphs merge, you should erode less or dilate a little bit after the erode.

Upvotes: 2

Related Questions