Python installation package:
There are two main packages to install: PIL and pytesser ,tesseract
(1), Installation pil::http://www.pythonware.com/products/pil/
After the download is an EXE program, directly double-click the installation
(2), pytesser::http://code.google.com/p/pytesser/
Installation of the Pytesser module:
After downloading to get "Pytesser.zip", is a compressed file, using the method:
1. Create a new folder under the "C:\Python27\Lib\site-packages" Path and name "Pytesser". Extract the files from the "Pytesser.zip" to this directory:
2, renamed "pytesser.py" to "__init__.py".
3. Open "__init__.py" file, modify: Tesseract_exe_name = ' c:\\python27\\lib\\site-packages\\pytesser\\tesseract ' # Name of Executable to being called at command line
4, Pytesser module depends on the PIL module, if the above method to install PIL, you need to "init.py" file "import image" changed to "from PIL import image."
Download decompression directly put C:\Python27\Lib\site-packages, at the same time, a new pytesser.pth, the content is written, note that the content here must and pytesser this folder the same name, meaning is Pytesser folder, Pytesser.pth, and the content must be the same!
(3), tesseract OCR engine Download: http://code.google.com/p/tesseract-ocr/
After downloading, unzip, Tessdata folder, use it to replace the Pytesser extracted Tessdata folder. (On the Pytesser folder above)
The code is as follows:
1 #-*-coding:utf-8-*-2 __author__="Carry"3 fromPILImportImage4 fromPytesserImport*5 6Image = Image.open ('xx.jpg')7 PrintImage_to_string (image)
Python verification code identified by Pytesser