So here is the following image https://i.stack.imgur.com/I3Tl5.jpg
I want to isolate each one of these number so I can read them with pytesseract
.
Here is the script I've wrote until now :
try:
import Image
except ImportError:
from PIL import Image
import pytesseract as tes
filename = "test.png";
x1 = (50,60,220,110)
x2 = (45,160,230,228)
x3 = (45,260,330,328)
image = Image.open( filename );
cropped_image = 'cropped_image'
scores = [x1, x2, x3]
for i in scores:
cropped_image1 = image.crop ( i )
results = tes.image_to_string(cropped_image1,lang="letsgodigital",boxes=False)
print(results)
so basically I'm cropping this image for each numbers. However I don't feel like this solution is very efficient (plus it's not so easy to find the coordinate for each number. I'm planning to apply this script to multiple images but the number will always be at the same place. Any idea on how I can make this script better ?
Hope the issue is clear.
Thanks.
P.S : I don't know why but uploading the image directly in my post doesn't work....