pytesseract does not extract numbers from image

Viewed 35

I am trying to extract numbers from an image using pytesseract but it does not return any text. Here is my code.

from PIL import Image
import pytesseract
im = Image.open('time.png')

custom_oem_psm_config = r'--oem 3 --psm 11 -c tessedit_char_whitelist="0123456789"'# -c preserve_interword_spaces=0'
text= pytesseract.pytesseract.image_to_string(im, config=custom_oem_psm_config)
print(text) 

Here is my image

time

Here is the output

enter image description here

1 Answers

Pyteserract is not able to extract from all images.

It is mostly able to extract text which is similar to normal fonts we use on Microsoft word, notepad, etc.

Related