Python image text recognition uses tools such as PiL and Pytesser. Because they use a lot of Python library files, in order to avoid the installation of a tool, it is recommended to use PYTHONXY, this tool can refer to the introduction of Baidu. Pytesser is a module of the Google OCR Open source project, which is imported into Python to convert the text in the image into text. Pytesser called the tesseract. When calling the Pytesser module in Python, Pytesser also uses tesseract to identify the text in the picture. Pytesser Use the following steps:
First, install the Python2.7 version, this version is relatively stable, it is recommended to use this version. Second, install the PYTHONCV. Then, install the PiL tool, download the address is: Http://www.pythonware.com/products/pil/,pytesser use requires PIL library support. Then download Pytesser, download the address is: Http://code.google.com/p/pytesser/downloads/list Finally, will pytesser decompression, this is free installation, The extracted files can be cut to the Python installation directory lib\site-packages under the direct use, such as my installation directory is: C:\Python27\Lib\site-packages,
but also add this directory to the environment variables . Once you have completed the above steps, you can write a Python script for image text recognition. The reference script is as follows: from Pytesser import *import imageenhance image =image.open (' D:\\xiehao\\workspace\\python\\5.png ') # Use Imageenhance to enhance the image recognition rate enhancer = imageenhance.contrast (image) Image_enhancer = enhancer.enhance (4) Print Image_to_ String (image_enhancer)
Pytesser Image text recognition