官方教程地址:https://github.com/tesseract-ocr/tesseract/wiki/Compiling

测试版本为

root@9a2a063f9534:/tesseract/testing# tesseract -v
tesseract 4.00.00dev--gcdc3533
leptonica-1.74.
libjpeg 8d (libjpeg-turbo 1.4.) : libpng 1.2. : libtiff 4.0. : zlib 1.2. Found AVX2
Found AVX
Found SSE

一、Docker + Ubuntu

git clone git@github.com:tesseract-ocr/tesseract.git
cd tesseract
docker pull ubuntu:latest
docker build -t google-ocr:latest .
docker run -itd --name ocr google-ocr:latest /bin/bash
docker exec -it ocr /bin/bash

进入环境后,需要训练功能要执行下面第二条

apt-get install -y  g++ autoconf automake libtool autoconf-archive pkg-config libpng-dev libjpeg8-dev libtiff5-dev zlib1g-dev git
#training
apt-get install -y libicu-dev libpango1.-dev libcairo2-dev

Leptonica

Tesseract    Leptonica    Ubuntu
4.00    1.74.   Must build from source

官网给出必须源码安装,所以去找源码安

cd /tmp
git clone https://github.com/DanBloomberg/leptonica.git
cd leptonica
autoreconf -vi
./autobuild
./configure
make
make install

安装主体ocr

cd /tesseract
./autogen.sh
LIBLEPT_HEADERSDIR=/usr/include
./configure --with-extra-libraries=/usr/local/lib
make install

测试安装是否成功

tesseract
tesseract -v

下载字库模型,选自己需要的就行了

字库地址:https://github.com/tesseract-ocr/tessdata
手册地址:https://github.com/tesseract-ocr/tesseract/wiki/Data-Files

将字库放入指定路径

export TESSDATA_PREFIX=/tesseract/tessdata
cp xxx.traindata /tesseract/

执行测试

cd /tesseract/testing
#english
tesseract phototest.tif result -l eng
#chinese
tesseract chi.jpg result1 -l chi_sim

检查输出

cat result.txt
cat result1.txt

可通过训练提高精度,训练方法见官方文档,这个我没试过。

附录:

python 调用接口:https://www.pyimagesearch.com/2017/07/10/using-tesseract-ocr-python/

python 官方调用依赖:https://github.com/madmaze/pytesseract

最新文章

  1. 关于SubSonic3.0插件使用Json反序列化获得的实体进行更新操作时,只能执行添加而不能执行修改(编辑)操作的处理
  2. [Scala] akka actor编程(一)
  3. JavaScript中面向对象的的深拷贝和浅拷贝
  4. Hive get table rows count batch
  5. 利用HTML5 Geolocation API在百度地图中显示你的位置
  6. hibernate的dao操作不能提交到数据库问题的解决
  7. 利用C语言强行点击置灰的按钮
  8. 怎样在万网加入Lync Online SRV记录
  9. Appium 1.6.4 环境搭建流程(Java, Android+IOS, Windows+Mac)
  10. 让你的Dapper像EF一样调用 开源~!
  11. SPOJ DQUERY树状数组离线or主席树
  12. Jackson工具
  13. 一款超人气代码格式化工具prettier
  14. Nagios 监控 Mysql
  15. Why you should use async tasks in .NET 4.5 and Entity Framework 6
  16. Jmeter-接口功能测试
  17. 缩放到被选择的部分: ICommand Cmd = new ControlsZoomToSelectedCommandClass();
  18. IntelliJ IDEA 自动导入包 快捷方式 关闭重复代码提示
  19. mysq 数据库基本管理
  20. Android的JNI调用(三)

热门文章

  1. Flask中路由系统、Flask的参数及app的配置
  2. Centos7安装Wkhtmltopdf -- nodejs将html转pdf
  3. MySQL安装(windows版本)
  4. 音频 PCM 数据的采集和播放
  5. Android的事件分发机制
  6. SQL update语句 更新和查询同一张表 冲突
  7. C#中多线程的并行处理
  8. centos7下的glusterfs的安装与使用
  9. #define INVSQRT2 0.707106781 平方根倒数速算法
  10. threejs- z-fighting 问题(模型的重叠部位便不停的闪烁起来。这便是Z-Fighting问题)