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