Home > Blockchain >  reading watermeter digits with pytesseract
reading watermeter digits with pytesseract

Time:10-14

I want to read my watermeter digits with tesseract but It returns only empty strings.

the water meter image looks like this: enter image description here

I read the image with opencv

and then I try to run this:

image = "./asset/test5.jpg"
img = cv2.imread(image)
ret,img = cv2.threshold(np.array(img), 125, 255, cv2.THRESH_BINARY)
text = pytesseract.image_to_string(img)
return text

but an empty string is returned ... Any hints for me?

Thanks in advance.

CodePudding user response:

Tesseract is used mostly for documentation kind reading. I can suggest you to use EasyOcr which is a good option for these kind of scenarios. I have downloaded your sample image and here is the output of code given below.

0167 m

Here is the code sample:

import easyocr
reader = easyocr.Reader(['ch_sim','en'])
result = reader.readtext('/ur/path/image/img.jpg')
print(result)

Note: If your image quality becomes higher, I believe you can read the numbers properly.

Here is the link for EasyOCR.

  • Related