I want to use an OCR program on an RPi to recognise the digits from a photo of my electricity meter. The digits are large and are very obvious to me, but Tesseract appears unable to recognise them at all - at best it detects a few random wrong digits.

I have tried cropping the numbers and OCRing them individually, but it doesn't help. I have tried a few other OCR programs and they were no better.

Please can you give any suggestions to how I can get Tesseract to correctly identify the 2 large numbers in the picture below? Note that this the original picture is ~2.5MB - this copy is smaller to fit this site.

Picture of electricity meter


Very small numbers are easier to read when they are illuminated by a strong light source. Some hardware devices such as flash drives and power adapters have very small writing printed on the plastic case that is very difficult to read in soft light but easy to read when the device is illuminated by a strong light source.

If that doesn't do the trick you can open the image to be scanned in GIMP Image Editor and enhance the brightness and contrast before OCRing it. GIMP Image Editor is available in the default Ubuntu repositories.

  1. Select a rectangular area of the image which contains the numbers to be scanned using the Rectangle Select Tool which is located in the top left corner of the Toolbox.

  2. From the GIMP menu select Colors -> Brightness-Contrast.

  3. Move the Brightness and Contrast sliders to improve the readability of the numbers.

  4. Make sure that the Foreground color which is located at the bottom center of the Toolbox is black, which is the default color.

  5. Use the Bucket Fill Tool to fill the background of the numbers with black color, so that the light colored numbers will show up with higher contrast against a black background.

  6. Select another rectangular area of the image which contains numbers to be scanned if necessary and repeat steps 2-5.

  7. Export your image when you are finished editing it using either File -> Overwrite or File -> Export As…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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