Watch Star Fork

Find Text Regions

This example demonstrates how to find regions containing texts in images. It can be used for:

  • Previous step of character segmentation and recognition in a OCR solution.
  • Improve accuracy using third-party OCR modules. Tests have demonstrated that solutions using OCR modules like Tesseract can improve accuracy submitting just the image regions with text.
  • Improve performance of OCR based solutions by reducing the amount of pixels to be processed.


  • The algorithm provided by Marvin just search for regions with an specific frequency of constrast variation in the horizontal axis. Horizontal lines segments with such pattern are grouped and the text region is determined. In some cases, false positive regions are detected, but a further step can be used to remove it based on its characteristics.

    Live Demo:


    Source Code