Skip to main content

Solution to extract the text from image and get wordlevel output as dataframe and also to extract text from given boundingBox

Project description


This class contains two main funtions:

  1. tess2dict: Input an image and get the extracted text as a dataframe which gives the content, coordinates (x,y,w,h) and confidence of each word. Essentially, it is a wrapper on pytesseract to output a dataframe.
  2. word2text: Once you obtain the dataframe, you can pass it through this function along with a bounding box to get the text inside the given box with proper formatting.


  • beautifulsoup4
  • MakeTreeDir
  • numpy
  • opencv-python
  • pandas
  • pytesseract

Tesseract Installation

(currently solution works on Tesseract 5.0.0 only)

What is Tesseract?

For Windows

adding path to path variable (for Tesseract)

For Linux

  • sudo apt install tesseract-ocr
  • sudo apt install libtesseract-dev


pip install tesseract2dict


A sample usage of our solution is shown below. Input an image as numpy.ndarray and the extracted dataframe at word level is returned. You can also get the text as plain of a given bounding box with proper formatting using the second function eg:

import cv2
from tesseract2dict import TessToDict
### function 1

### function 2


  • Sreekiran A R - Analytics Consultant, AI Labs, Bridgei2i Analytics Solutions - Github , Stackoverflow

  • Anil Prasad M N - Project Manager, AI Labs, Bridgei2i Analytics Solutions - Github


This project is licensed under the MIT License - see the file for details

NOTE: This software depends on other packages that may be licensed under different open source licenses.

Useful links


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tesseract2dict-1.3.tar.gz (4.0 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page