Вопрос

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

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top