tesseract
Tesseract是一款开源OCR引擎,可识别提取图片中的文字内容,支持百余语种,提供命令行工具与开发调用接口。
这个项目值得继续研究吗?
Tesseract是一款开源OCR引擎,可识别提取图片中的文字内容,支持百余语种,提供命令行工具与开发调用接口。
- 解决什么问题
- 解决企业大量扫描件、图片类票据、合同、文档的文字人工录入效率低、成本高、出错率高的问题,同时满足多语种识别场景的低成本、灵活定制需求。
- 适合什么团队
- 有批量图片文字识别需求的业务团队,以及需要集成OCR能力到自有业务系统的产品、技术团队均可使用。
- 使用前注意
- 本项目无自带图形操作界面,要获得理想识别效果需提前优化输入图片质量,从源码编译需使用官方指定编译器。
本页用于缩短初步筛选时间,不构成技术、采购或法律结论。 正式使用前请在真实业务数据上验证,并以官方说明与许可证为准。
从官方资料看清能力、部署与采用边界
以下内容依据项目公开 README 或模型卡翻译整理,代码、命令和产品名保持原样。
Tesseract OCR 项目导读
1. 项目定位
Tesseract是一款开源的光学字符识别(Optical Character Recognition,简称OCR,指将图片中的文字转换为可编辑文本的技术)引擎,最早由惠普实验室开发,2005年开源后曾由谷歌主导维护,当前由开源社区持续迭代,最新稳定版本为5.x系列。 它的定位是为各类文字识别场景提供通用、低成本的基础能力,既支持直接运行使用,也支持嵌入到其他业务系统中。
2. 核心能力
Tesseract的核心能力包括以下几类:
需要注意的是,Tesseract本身没有自带图形操作界面,若需要可视化操作工具,可使用社区第三方开发的配套GUI产品。
- 多语种支持:开箱即可识别100余种语言,支持UTF-8编码,也支持自定义训练来识别新增的语种或特殊字体。
- 多格式兼容:输入支持PNG、JPEG、TIFF等常见图片格式,输出可生成纯文本、HTML、PDF、TSV等多种格式的结果,满足不同业务场景的导出需求。
- 双识别引擎:包含基于长短期记忆网络(Long Short-Term Memory,简称LSTM,一种适合序列内容识别的机器学习模型)的行识别引擎,同时兼容旧版本的字符模式识别引擎,可根据需求切换。
3. 典型使用方式
Tesseract有两类典型使用方式,可适配不同团队的需求:
- 命令行直接调用:无需开发,业务人员可通过简单的命令行指令完成识别,基础用法为tesseract 输入图片路径 输出文件前缀 [-l 语种代码],比如识别中文简体图片可使用指令tesseract test.jpg result -l chisim,执行后即可得到识别后的文本文件。
- 集成到业务系统:开发者可通过官方提供的C/C++ API调用libtesseract核心引擎,也可使用社区提供的Python、Java等其他编程语言的封装包,将OCR能力直接嵌入到自有的档案管理、票据录入、文档处理等业务系统中。
4. 部署安装要求
Tesseract的安装门槛较低,有两种安装路径可选:
安装需要依赖Leptonica图片处理库,建议使用内置zlib、png、tiff支持的Leptonica版本,可正常处理各类常见格式的图片文件。
- 预编译包安装:大多数场景下可直接使用官方提供的预编译二进制包,无需手动编译,按照官方文档指引即可快速完成安装。
- 源码编译:若有自定义修改需求,可从源码编译,编译前需确认所用编译器在官方支持的编译器列表内。
5. 项目维护状态
Tesseract目前处于活跃维护状态,最新代码更新在GitHub的main分支,官方会定期发布小版本更新和bug修复。 问题支持渠道完善,使用前可先查阅官方文档、常见问题说明,若仍有疑问可在官方用户邮件组咨询,仅bug类问题可提交到GitHub issue区。
6. 许可与采用建议
Tesseract采用Apache-2.0开源许可,允许商业使用、修改、二次分发,无付费门槛,仅需遵守许可要求即可。其依赖的Leptonica库采用BSD 2-clause许可,也兼容商业使用场景。 对于企业用户,若有批量图片文字识别需求,无需采购商业OCR服务即可通过Tesseract满足大多数常规场景需求;若识别效果不理想,可先按照官方指引优化输入图片的清晰度、倾斜度、对比度等参数,无需直接调整模型,可大幅降低使用成本。
官方资料与来源
- hacktoberfest
- lstm
- machine-learning
- ocr
- ocr-engine
- tesseract
- tesseract-ocr
## Installing Tesseract You can either [Install Tesseract via pre-built binary package](https://tesseract-ocr.github.io/tessdoc/Installation.html) or [build it from source](https://tesseract-ocr.github.io/tessdoc/Compiling.html). Before building Tesseract from source, please check that your system has a compiler which is one of the [supported compilers](https://tesseract-ocr.github.io/tessdoc/supported-compilers.html).
该片段来自项目 README,仅用于初步判断;实际部署请以官方文档为准。
核对上游原始说明节选
Tesseract Open Source OCR Engine (main repository)
Tesseract OCR
Coverity Scan Build Status CodeQL OSS-Fuzz \ GitHub license Downloads
Table of Contents
- Tesseract OCR
- About
- Brief history
- Installing Tesseract
- Running Tesseract
- For developers
- Support
- License
- Dependencies
- Latest Version of README
About
This package contains an OCR engine - libtesseract and a command line program - tesseract.
Tesseract 4 adds a new neural net (LSTM) based OCR engine which is focused on line recognition, but also still supports the legacy Tesseract OCR engine of Tesseract 3 which works by recognizing character patterns. Compatibility with Tesseract 3 is enabled by using the Legacy OCR Engine mode (--oem 0). It also needs traineddata files which support the legacy engine, for example those from the tessdata repository.
Stefan Weil is the current lead developer. Ray Smith was the lead developer until 2017. The maintainer is Zdenko Podobny. For a list of contributors see AUTHORS and GitHub's log of contributors.
Tesseract has unicode (UTF-8) support, and can recognize more than 100 languages "out of the box".
Tesseract supports various image formats including PNG, JPEG and TIFF.
Tesseract supports various output formats: plain text, hOCR (HTML), PDF, invisible-text-only PDF, TSV, ALTO and PAGE.
You should note that in many cases, in order to get better OCR results, you'll need to improve the quality of the image you are giving Tesseract.
This project does not include a GUI application. If you need one, please see the 3rdParty documentation.
Tesseract can be trained to recognize other languages. See Tesseract Training for more information.
Brief history
Tesseract was originally developed at Hewlett-Packard Laboratories Bristol UK and at Hewlett-Packard Co, Greeley Colorado USA between 1985 and 1994, with some more changes made in 1996 to port to Windows, and some C++izing in 1998. In 2005 Tesseract was open sourced by HP. From 2006 until August 2017 it was developed by Google.
Major version 5 is the current stable version and started with release 5.0.0 on November 30, 2021. Newer minor versions and bugfix versions are available from GitHub.
Latest source code is available from main branch on GitHub. Open issues can be found in issue tracker, and planning documentation.
See Release Notes and Change Log for more details of the releases.
Installing Tesseract
You can either Install Tesseract via pre-built binary package or build it from source.
Before building Tesseract from source, please check that your system has a compiler which is one of the supported compilers.
Running Tesseract
Basic command line usage:
tesseract imagename outputbase [-l lang] [--oem ocrenginemode] [--psm pagesegmode] [configfiles...]
For more information about the various command line options use tesseract --help or man tesseract.
Examples can be found in the documentation.
For developers
Developers can use libtesseract C or C++ API to build their own application. If you need bindings to libtesseract for other programming languages, please see the wrapper section in the AddOns documentation.
Documentation of Tesseract generated from source code by doxygen can be found on tesseract-ocr.github.io.
Support
Before you submit an issue, please review the guidelines for this repository.
For support, first read the documentation, particularly the FAQ to see if your problem is addressed there. If not, search the Tesseract user forum, the Tesseract developer forum and past issues, and if you still can't find what you need, ask for support in the mailing-lists.
Mailing-lists:
- tesseract-ocr - For tesseract users.
- tesseract-dev - For tesseract developers.
Please report an issue only for a bug, not for asking questions.
License
The code in this repository is licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
NOTE: This software depends on other packages that may be licensed under different open source licenses.
Tesseract uses the Leptonica library which essentially uses a BSD 2-clause license.
Dependencies
Tesseract uses Leptonica library for opening input images (e.g. not documents like pdf). It is suggested to use leptonica with built-in support for zlib, png and tiff (for multipage tiff).
Latest Version of README
For the latest online version of the README.md see: