1

I using Tesseract OCR to recognizing my below picture (it is an image meter electric) but it not working. I have not permitted to use Machine learning or deep learning. Does anyone have some other technique that I can use to solve my problem? please let give to me a guide. Thank you for reading.

This my root image: enter image description here

This image that I have processed must to recognizing digits
enter image description here

This my code:

import cv2
import pytesseract as pts
pts.pytesseract.tesseract_cmd = r'C:\Users\Thep Ho\AppData\Local\Programs\Tesseract-OCR\tesseract.exe'

img = cv2.imread("images/text1.jpg")
text = pts.image_to_string(img)
print(text)
1
  • Did you already check this and this ? Commented Nov 30, 2020 at 5:49

1 Answer 1

0
  • If you apply adaptive-thresholding to the input image:

  • enter image description here

  • Now, if you apply regular-expression to remove all non-numeric variables from the extracted text:

    • 99951
      

Code:


import re
import cv2
import pytesseract

img = cv2.imread("Eadxj.png")
gry = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
flt = cv2.adaptiveThreshold(gry,
                            252, cv2.ADAPTIVE_THRESH_MEAN_C,
                            cv2.THRESH_BINARY_INV, 31, 7)
txt = pytesseract.image_to_string(flt)
txt_int = re.sub("[^0-9]", "", txt)
print(txt_int)

But if you are allowed to use deep-learning, result will be:

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.