0

I have the following number:

enter image description here

I am using tesseract as documented in this question.

The result I am getting is "\n", and not 7000 as expected.

Has anyone experienced this issue in the past when trying to parse a number?

I have tried the following:

>>> image = Image.open("C:/temp/download.png")
>>> image = image.convert('RGB')
>>> image = image.filter(ImageFilter.BLUR)
>>> print image_to_string(image)


>>>image.save("C:/temp/dl1.png")

Which gives me

enter image description here


A step in the right direction is the following:

from PIL import ImageFilter
import sys
from PIL import Image
import PIL.ImageOps    
import pytesseract
import time


image=Image.open("C:/temp/download.png")
image.load() 
background = Image.new("RGB", image.size, (255, 255, 255))
background.paste(image, mask=image.split()[3]) # 3 is the alpha channel
background.save('C:/temp/foo.jpg', 'JPEG', quality=80)


img =Image.open('C:/temp/foo.jpg')
img.load()
print img
print '-------------------'
i = pytesseract.image_to_string(img)
print i

But now I am here.

Community
  • 1
  • 1
jason m
  • 6,519
  • 20
  • 69
  • 122

1 Answers1

0
tesseract_cmd = 'C:\\Tesseract-OCR\\tesseract'

In pytesseract.py change the tesseract_cmd to above line or path to where tesseract.It will work fine.