Python-tesseract是python的一个OCR工具,能识别读取图像中的文本。
Python-tesseract是对google的Tesseract-OCR引擎的wrapper。
它也可作为tesseract的独立脚本来用。支持Python Imaging Library所支持的所有图像格式,
包括jpeg, png, gif, bmp, tiff等,tesseract-ocr缺省只支持tiff,bmp格式。
另外Python-tesseract也能把识别的文本写入到文件中。
安装要求
- Python-tesseract要求python 2.5+以上或3.x
- 需要Python Imaging Library (PIL)。
- 安装Google Tesseract OCR。
功能
- image_to_string 返回Tesseract OCR所识别图像后的string
- image_to_boxes 返回结果中包含识别的字符以及边框
- image_to_data 返回结果中包含边框, confidences,和其他信息。需要Tesseract 3.05以上版本。image_to_data的参数
- image_to_data(image,, config='', nice=0, output_type=Output.STRING)
- image 对象,能被Tesseract处理的PIL Image或Image NumPy数组
- lang String, Tesseract language code string
- config String, 配置string,例如: ``config="-psm 6"``
- nice 整数, 调整Tesseract运行的进程的优先级。在Windows上不支持。
- output_type 类属性,输出的指定类型。缺省是string。
各种字体文字
ocr