-
支持向量机(SVM) -
OpenCV -
图像处理软件(Photoshop,Gimp…) -
Python Image Library
$sudo apt-get install python-imaging
$ sudo easy_install PIL
from PIL import Image im = Image.open('7039.jpg')
imgry = im.convert('L') imgry.show()
threshold = 140 table = [] for i in range(256): if i < threshold: table.append(0) else: table.append(1) out = imgry.point(table, '1') out.show()
-
如果没有安装PIL,请到这里下载安装:http://www.pythonware.com/products/pil/ -
安装pytesser,下载地址:http://code.google.com/p/pytesser/ ,下载后直接将其解压到项目代码下,或者解压到python安装目录的Libsite-packages下,并将其添加到path环境变量中,不然在导入模块时会出错。 -
下载Tesseract OCR engine:http://code.google.com/p/tesseract-ocr/ ,下载后解压,找到tessdata文件夹,用其替换掉pytesser解压后的tessdata文件夹即可。 -
另外如果现在都是从PIL库中运入Image,没有使用Image模块,所以需要把pytesser.py中的import Image改为from PIL import Image, 其次还需要在pytesser文件夹中新建一个__init__.py的空文件。
from PIL import Image from pytesser import pytesser image = Image.open('7039.jpg') print pytesser.image_file_to_string('7039.jpg') print pytesser.image_to_string(image)
本文为原创文章,版权归知行编程网所有,欢迎分享本文,转载请保留出处!
你可能也喜欢
- ♥ 如何使用列表理解11/12
- ♥ 如何发布python程序11/08
- ♥ 如何在 Python 中使用反射?11/02
- ♥ 如何理解python模块的搜索路径?11/07
- ♥ python切片符号介绍01/05
- ♥ python如何比较两个列表12/05
内容反馈