Click here to Skip to main content
15,883,990 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
from PIL import Image

img = Image.open('1.gif') # Your image here!
img = img.convert("RGBA")
width, height = img.size
pixdata = img.load()

# Make the letters bolder for easier recognition

for y in xrange(img.size[1]):
for x in xrange(img.size[0]):
if pixdata[x, y][0] < 90:
pixdata[x, y] = (0, 0, 0, 255)

for y in xrange(img.size[1]):
for x in xrange(img.size[0]):
if pixdata[x, y][1] < 136:
pixdata[x, y] = (0, 0, 0, 255)

for y in xrange(img.size[1]):
for x in xrange(img.size[0]):
if pixdata[x, y][2] > 0:
pixdata[x, y] = (255, 255, 255, 255)

img.save("input-black.gif", "GIF")

# Make the image bigger (needed for OCR)
im_orig = Image.open('input-black.gif')
big = im_orig.resize((width, height), Image.NEAREST)

ext = ".tif"
big.save("input-NEAREST" + ext)

# Pytesser
from pytesser import *
image = Image.open('input-NEAREST.tif')
print image_to_string(image)




Error:
SQL
Traceback (most recent call last):
  File "C:\Users\user\Desktop\ten\ten.py", line 37, in <module>
    print image_to_string(image)
  File "C:\Python27\lib\site-packages\pytesser.py", line 31, in image_to_string
    call_tesseract(scratch_image_name, scratch_text_name_root)
  File "C:\Python27\lib\site-packages\pytesser.py", line 21, in call_tesseract
    proc = subprocess.Popen(args)
  File "C:\Python27\lib\subprocess.py", line 709, in __init__
    errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 957, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
Posted
Updated 25-Apr-14 2:36am
v3
Comments
mahla.r 25-Apr-14 8:11am    
why get this error ? plz help me

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900