# Extract text from a image - OCR

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:

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?

• I have a similar problem. Looking forward to suggestions! – Peter Jun 8 at 20:33
• Please let know if you find a solution @Peter. Would be very helpful. – cvg Jun 9 at 11:37
• 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 – cvg Jun 10 at 15:26

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.