This is the first time I am working with OCR. I have an image and want to extract data from the image. My image looks like this:

enter image description here

I want to extract the parameters and the values against them. Can someone guide me on how to do this? I know we can extract text from an image using tesseract and PIL libraries if the image contains some simple text. What to do in this case where there are several parameters?

  • 1
    $\begingroup$ I have a similar problem. Looking forward to suggestions! $\endgroup$
    – Peter
    Jun 8, 2019 at 20:33
  • $\begingroup$ Please let know if you find a solution @Peter. Would be very helpful. $\endgroup$
    – chink
    Jun 9, 2019 at 11:37
  • $\begingroup$ All the tutorials I am finding show how to extract text from a simple image with some text in it. Any tutorials to fulfil the above task will also be helpful. Thanks $\endgroup$
    – chink
    Jun 10, 2019 at 15:26

1 Answer 1


I have used tesseract for similar tasks. I can give you few recommendation. You can choose the best that works for you.

  • Extract the parameter values by finding the exact locations they appear.

    • If the parameters always appear in the same place you can find those coordinates and extract parameters from there. You can get the location information by getting the TSV output produced by Tesseract while performing OCR.
  • Looking at the line / block / paragraph numbers produced by tesseract for each text

    • Since the values and parameter pairs are separated by lines or to separate sections, I think tesseract will do a reasonable job in giving your parameters either different line numbers or block/paragraph numbers. You can get this information if you get the TSV output from Tesseract using the create_tsv=1 configuration I believe.
  • Using regex to match parameters

    • It seems that your parameters are pretty consistent (i.e. either categorical ON/OFF or a number). In that case what you can do is, while reading the output from tesseract, match the description in front of the value. For example, as soon as you encounter AHU ON/OFF STATUS text, look for the word either on or off.

And you can use these in combination to make the results even more accurate. Hope these suggestions help.

  • 1
    $\begingroup$ Pretty good answer. If the image included in the question is a good representation of the set, I would suggest training a key-value pair block detector as prep step in the pipeline. It seems that would work pretty well. $\endgroup$ Mar 9, 2020 at 11:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.