Recommand · October 14, 2021 0

How to recognize only numbers(python tesseract )

I’m using tesseract version 0.3.8 and I want to know how to detect only numbers in an image.

If you are using the

image_to_string 

function then you can just pars the string for all integers it contains such as:

a = ''.join(filter(str.isdigit, x )) # Get all digits from string
numbers_only = int(a) # Cast to int

Where x is the string returned from tesseract image_to_string funtion.