- A+
所属分类:未分类
下载ubuntu镜像
docker pull cuteribs/dsm-ubuntu1604
启动并进入镜像
docker run -i -t cuteribs/dsm-ubuntu1604 /bin/bash
安装依赖包
apt-get update apt-get install autoconf automake libtool apt-get install autoconf-archive apt-get install pkg-config apt-get install libpng12-dev -y apt-get install libjpeg8-dev -y apt-get install libtiff5-dev -y apt-get install zlib1g-dev -y apt-get install libicu-dev -y apt-get install libpango1.0-dev -y apt-get install libcairo2-dev -y apt-get install git
leptonica编译
git clone https://github.com/DanBloomberg/leptonica cd leptonica/ autoreconf -vi ./configure make make install
安装tesseract
git clone --depth 1 https://github.com/tesseract-ocr/tesseract.git cd tesseract/ ./autogen.sh ./configure --enable-debug LDFLAGS="-L/usr/local/lib" CFLAGS="-I/usr/local/include" make make install ldconfig
查找刚才安装好tesseract的镜像
[root@iZwz9bpg2u1r39ml9st8qzZ ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 55aec6df5819 cuteribs/dsm-ubuntu1604 "/bin/bash" About an hour ago Exited (0) 2 minutes ago
添加语言包
cd /opt git clone https://github.com/tesseract-ocr/tessdata export TESSDATA_PREFIX=/opt/tessdata
提交改镜像
[root@iZwz9bpg2u1r39ml9st8qzZ ~]# docker commit 55aec6df5819 tesseract
查看镜像
[root@iZwz9bpg2u1r39ml9st8qzZ ~]# docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE tesseract latest 2f0e97c6d963 About a minute ago 1.4 GB
启动镜像并且查看状态
docker run -d -it -v /xubo/tesseractdir:/opt/image/ --name tesseract4 tesseract docker ps
进入到容器
docker exec -it 664fc7c2e97b /bin/bash
查看tesseract版本
root@664fc7c2e97b:/app# tesseract -v tesseract 4.0.0-beta.1 leptonica-1.76.0 libjpeg 8d (libjpeg-turbo 1.4.2) : libpng 1.2.54 : libtiff 4.0.6 : zlib 1.2.8 Found AVX512BW Found AVX512F Found AVX2 Found AVX Found SSE
测试
docker exec f5a3c5efb362 tesseract /opt/image/test.jpg /opt/image/out
然后到/xubo/tesseractdir查看,如下:
[root@iZwz9bpg2u1r39ml9st8qzZ tesseractdir]# pwd /xubo/tesseractdir [root@iZwz9bpg2u1r39ml9st8qzZ tesseractdir]# ls out.txt test.jpg [root@iZwz9bpg2u1r39ml9st8qzZ tesseractdir]# more out.txt Hutool ^L
如上是测试图片,到处安装完毕
- 安卓客户端下载
- 微信扫一扫
- 微信公众号
- 微信公众号扫一扫