RobinDavid/Pytesser

how to recognize small char

Closed this issue · 3 comments

after search pytesser,

>>> im = Image.open(r'C:\Users\martlee2\Documents\words\30.tif')
>>> text = image_to_string(im)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\pytesser\__init__.py", line 32, in image_to_string
    text = util.retrieve_text(scratch_text_name_root)
  File "C:\Python27\lib\pytesser\util.py", line 10, in retrieve_text
    inf = open(scratch_text_name_root + '.txt','r')
IOError: [Errno 2] No such file or directory: 'temp.txt'
import pytesser
txt = pytesser.image_to_string(r'C:\Users\martlee2\Documents\words\30.png',"en",pytesser.PSM_SINGLE_WORD)
>>> import pytesser
>>> txt = pytesser.image_to_string(r'C:\Users\martlee2\Documents\words\30.png',"en",pytesser.PSM_SINGLE_WORD)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\pytesser\__init__.py", line 78, in image_to_string
    process_request(file, TEMP_FILE, lang, psm) #Process command
  File "C:\Python27\lib\pytesser\__init__.py", line 64, in process_request
    raise TesseractException, ret[1]
pytesser.TesseractException
>>>
even if using original file, error temp file 
after edit to args = [tesseract_exe_name, input_filename, output_filename,'-psm','7']

#http://code.google.com/p/tesseract-ocr/
#pip install pytesseract
from PIL import Image
from pytesser import *

im = Image.open(r'C:\Users\martlee2\Documents\words\30.png')

im.save(r'C:\Users\martlee2\Documents\words\30.tif')
im = Image.open(r'C:\Users\martlee2\Documents\words\30.tif')

Hi!
Can you describe thoroughly the issue it is rather unclear ?

After test the executable file directly, I discover that it is due to no temp.txt file generated, it can not recognize small words "file" which a screen capture from window 10's notepad after tried psm option from 5 to 10 , then I enlarge 2516 size screen capture to 160120 , it can recognize to generate temp.txt but output is wrong words

Can you share this picture, please?