tesseract-ocr/tesseract
GitHub: tesseract-ocr/tesseract
业界最成熟的开源 OCR 引擎,基于 LSTM 神经网络,能够将多种图片格式中的文字转化为文本、PDF 或结构化数据。
Stars: 72888 | Forks: 10542
# Tesseract OCR
[](https://scan.coverity.com/projects/tesseract-ocr)
[](https://github.com/tesseract-ocr/tesseract/security/code-scanning)
[](https://issues.oss-fuzz.com/issues?q=is:open%20title:tesseract-ocr)
\
[](https://raw.githubusercontent.com/tesseract-ocr/tesseract/main/LICENSE)
[](https://github.com/tesseract-ocr/tesseract/releases/)
## 目录
* [Tesseract OCR](#tesseract-ocr)
* [关于](#about)
* [简史](#brief-history)
* [安装 Tesseract](#installing-tesseract)
* [运行 Tesseract](#running-tesseract)
* [开发者指南](#for-developers)
* [支持](#support)
* [许可证](#license)
* [依赖项](#dependencies)
* [最新版 README](#latest-version-of-readme)
## 关于
本软件包包含一个 **OCR 引擎** —— `libtesseract` 和一个 **命令行程序** —— `tesseract`。
Tesseract 4 添加了一个新的基于神经网络 (LSTM) 的 [OCR 引擎](https://en.wikipedia.org/wiki/Optical_character_recognition),该引擎专注于行识别,但同时也仍支持 Tesseract 3 的旧版 Tesseract OCR 引擎(通过识别字符模式工作)。通过使用 Legacy OCR Engine 模式 (--oem 0) 可以启用与 Tesseract 3 的兼容性。
它还需要支持旧版引擎的 [traineddata](https://tesseract-ocr.github.io/tessdoc/Data-Files.html) 文件,例如来自 [tessdata](https://github.com/tesseract-ocr/tessdata) 仓库的文件。
Stefan Weil 是当前的首席开发者。Ray Smith 在 2017 年之前担任首席开发者。维护者是 Zdenko Podobny。关于贡献者列表,请参阅 [AUTHORS](https://github.com/tesseract-ocr/tesseract/blob/main/AUTHORS)
以及 GitHub 的 [贡献者](https://github.com/tesseract-ocr/tesseract/graphs/contributors) 日志。
Tesseract 具有 **unicode (UTF-8) 支持**,并且可以 **“开箱即用”地识别 [100 多种语言](https://tesseract-ocr.github.io/tessdoc/Data-Files-in-different-versions.html)**。
Tesseract 支持 **[各种图像格式](https://tesseract-ocr.github.io/tessdoc/InputFormats)**,包括 PNG、JPEG 和 TIFF。
Tesseract 支持 **各种输出格式**:纯文本、hOCR (HTML)、PDF、不可见文本 PDF、TSV、ALTO 和 PAGE。
您应该注意,在许多情况下,为了获得更好的 OCR 结果,您需要 **[提高](https://tesseract-ocr.github.io/tessdoc/ImproveQuality.html) 提供给 Tesseract 的图像的质量**。
本项目 **不包含 GUI 应用程序**。如果您需要,请参阅 [3rdParty](https://tesseract-ocr.github.io/tessdoc/User-Projects-%E2%80%93-3rdParty.html) 文档。
Tesseract **可以经过训练以识别其他语言**。
有关更多信息,请参阅 [Tesseract Training](https://tesseract-ocr.github.io/tessdoc/Training-Tesseract.html)。
## 简史
Tesseract 最初由惠普布里斯托尔实验室(英国)和惠普公司格里利(美国科罗拉多州)于 1985 年至 1994 年间开发,并在 1996 年进行了一些修改以移植到 Windows,1998 年进行了一些 C++ 化。2005 年,Tesseract 由 HP 开源。从 2006 年到 2017 年 8 月,它由 Google 开发。
主版本 5 是当前的稳定版本,始于 2021 年 11 月 30 日发布的
[5.0.0](https://github.com/tesseract-ocr/tesseract/releases/tag/5.0.0)。较新的次要版本和错误修复版本可从
[GitHub](https://github.com/tesseract-ocr/tesseract/releases/) 获取。
最新源代码可从 [GitHub 上的 main 分支](https://github.com/tesseract-ocr/tesseract/tree/main) 获取。
未解决的问题可以在 [Issue 跟踪器](https://github.com/tesseract-ocr/tesseract/issues)、
和 [规划文档](https://tesseract-ocr.github.io/tessdoc/Planning.html) 中找到。
有关发布的更多详细信息,请参阅 **[Release Notes](https://tesseract-ocr.github.io/tessdoc/ReleaseNotes.html)**
和 **[Change Log](https://github.com/tesseract-ocr/tesseract/blob/main/ChangeLog)**。
## 安装 Tesseract
您可以选择 [通过预构建二进制包安装 Tesseract](https://tesseract-ocr.github.io/tessdoc/Installation.html)
或者 [从源代码构建](https://tesseract-ocr.github.io/tessdoc/Compiling.html)。
在从源代码构建 Tesseract 之前,请检查您的系统是否拥有 [受支持的编译器](https://tesseract-ocr.github.io/tessdoc/supported-compilers.html) 之一。
## 运行 Tesseract
基本 **[命令行用法](https://tesseract-ocr.github.io/tessdoc/Command-Line-Usage.html)**:
```
tesseract imagename outputbase [-l lang] [--oem ocrenginemode] [--psm pagesegmode] [configfiles...]
```
有关各种命令行选项的更多信息,请使用 `tesseract --help` 或 `man tesseract`。
示例可以在 [文档](https://tesseract-ocr.github.io/tessdoc/Command-Line-Usage.html#simplest-invocation-to-ocr-an-image) 中找到。
## 开发者指南
开发者可以使用 `libtesseract` 的 [C](https://github.com/tesseract-ocr/tesseract/blob/main/include/tesseract/capi.h) 或
[C++](https://github.com/tesseract-ocr/tesseract/blob/main/include/tesseract/baseapi.h) API 来构建自己的应用程序。如果您需要其他编程语言的 `libtesseract` 绑定,请参阅
AddOns 文档中的 [wrapper](https://tesseract-ocr.github.io/tessdoc/AddOns.html#tesseract-wrappers) 部分。
由 doxygen 从源代码生成的 Tesseract 文档可以在 [tesseract-ocr.github.io](https://tesseract-ocr.github.io/) 上找到。
## 支持
在提交 Issue 之前,请查看 **[本仓库的指南](https://github.com/tesseract-ocr/tesseract/blob/main/CONTRIBUTING.md)**。
如需支持,请先阅读 [文档](https://tesseract-ocr.github.io/tessdoc/),
特别是 [FAQ](https://tesseract-ocr.github.io/tessdoc/FAQ.html) 以查看您的问题是否已在其中得到解决。
如果没有,请搜索 [Tesseract 用户论坛](https://groups.google.com/g/tesseract-ocr)、[Tesseract 开发者论坛](https://groups.google.com/g/tesseract-dev) 和 [过往 Issue](https://github.com/tesseract-ocr/tesseract/issues),如果您仍然找不到所需内容,请在邮件列表中寻求支持。
邮件列表:
* [tesseract-ocr](https://groups.google.com/g/tesseract-ocr) - 面向 tesseract 用户。
* [tesseract-dev](https://groups.google.com/g/tesseract-dev) - 面向 tesseract 开发者。
请仅针对 **Bug** 提交 Issue,不要用于提问。
## 许可证
```
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.
```
**注意**:本软件依赖于其他可能根据不同开源许可证授权的软件包。
Tesseract 使用 [Leptonica library](http://leptonica.com/),该库主要
使用 [BSD 2-clause license](http://leptonica.com/about-the-license.html)。
## 依赖项
Tesseract 使用 [Leptonica library](https://github.com/DanBloomberg/leptonica)
来打开输入图像(例如,不是像 pdf 这样的文档)。
建议使用内置了 [zlib](https://zlib.net)、
[png](https://sourceforge.net/projects/libpng) 和
[tiff](http://www.simplesystems.org/libtiff)(用于多页 tiff)支持的 leptonica。
## 最新版 README
有关 README.md 的最新在线版本,请参阅:
标签:Apex, C++, IPv6支持, Linux工具, LSTM, OCR, Tesseract, 人工智能, 光学字符识别, 图像处理, 图像转文本, 数据擦除, 文字识别, 文本提取, 文档数字化, 机器学习, 深度学习, 用户模式Hook绕过, 神经网络, 端口探测, 计算机视觉