Ecplisepytesser and tesseract are used for ocr in ecplise + phthon2.7.
Many cases of using pytesser or tesseract for OCR website verification code on the Internet using ecplise + phthon2.7, but the configuration is truly crashing.
General steps:
1. Download pytesser_v0.0.1;
2. decompress the package and copy it to C: \ ProgramData \ Anaconda2 \ Lib \ site-packages;
3. Change the folder name to pytesser;
4. Create a new file named pytesser. pth in the C: \ ProgramData \ Anaconda2 \ Lib \ site-packages folder.
5. In the C: \ ProgramData \ Anaconda2 \ Lib \ site-packages \ pytesser. py file, change import Image to from PIL import Image;
6. Then write the code on the ecplice interface:
from PIL import Image from pytesser import * im = Image.open('C:\\ProgramData\\Anaconda2\\Lib\\site-packages\\pytesser\\phototest.tif')im.show()
No problem. The image is successfully opened.
7. Then the oCR function is called:
print image_to_string(im)
Then there will be endless errors.
The error message of ecplice is not helpful. Only the prompt is:
Traceback (most recent call last): File "C:\Users\TF-2016\Desktop\spider\ruijie\ruijie.py", line 33, in <module> print image_file_to_string('11.png', graceful_errors=True) File "C:\Python27\lib\site-packages\pytesser\pytesser.py", line 48, in image_file_to_string call_tesseract(filename, scratch_text_name_root) File "C:\Python27\lib\site-packages\pytesser\pytesser.py", line 23, in call_tesseract proc = subprocess.Popen(args) File "C:\Python27\lib\subprocess.py", line 710, in __init__ errread, errwrite) File "C:\Python27\lib\subprocess.py", line 958, in _execute_child startupinfo)WindowsError: [Error 2]
Online looked for two hours, many people encountered this problem, almost no solution, and finally found someone talking about: http://blog.csdn.net/c465869935/article/details/51438576
- Qq_387171462017-05-091 replyReply
- Just happened to solve the problem. Find your pytesseract. py file and change the line tesseract_cmd = 'tesseract 'to tesseract_cmd = r 'C:/Program Files (x86)/tesseract-OCR/tesseract.exe.
Then I decided to download the latest version of tesseract 3.0.2, instead of relying on the version 1.01 that comes with pytesseract.
Download, install, and change tesseract_exe_name = 'tesseract '# Name of executable to be called at command line:
Tesseract_exe_name = r 'C:/Program Files (x86)/Tesseract-OCR/tesseract.exe '# 'tesseract' Name of executable to be called at command line
Then run. OK. You can use ocr in English and numbers.
However, unfortunately, the Chinese Library is a Google website and cannot be downloaded. If you can download it, you are very much looking forward to the effect of ocr in Chinese.