作者电脑:Mac Mini 系统信息:OS X EI Capitan 10.11.6

Tesseract4.0github地址:https://github.com/tesseract-ocr/tesseract/wiki/4.0-with-LSTM

build 步骤:

参考Tesseract github上的官方文档:https://github.com/tesseract-ocr/tesseract/wiki/Compiling#macos

  1. 安装homebrew

直接在终端中输入:ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

安装过程中需要键入一次回车

2. 使用brew命令安装依赖

brew install automake autoconf
brew install autoconf-archive
brew install pkgconfig
brew install icu4c
brew install leptonica
brew install gcc
   3. compile 
git clone https://github.com/tesseract-ocr/tesseract/
在这一步可能会有错误提示:

fatal: could not create work tree dir 'tesseract': Permission denied

此时需要我们使用sudo命令创建一个具有写权限的文件夹,然后把tesseract的源码clone至此文件中

也可能有错误提示:

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

我们需要:

1、打开终端,输入  sudo xcodebuild -license

2、终端提示敲回车键(enter)打开许可协议,照做

3、终端提示 按下  “space” 键阅读许可协议,按“q” 不阅读

4、最终,终端会出现三个选项,agree 、print、cancel,不用想,能不是agree 吗!输入agree,然后enter

4. 接下来:

cd tesseract
./autogen.sh
这一步可能会有错误:“

Failed to find libtoolize or glibtoolize...“

只需安装libtool即可:brew install libtool
./configure CC=gcc-6 CXX=g++-6 CPPFLAGS=-I/usr/local/opt/icu4c/include LDFLAGS=-L/usr/local/opt/icu4c/lib
make -j
sudo make install # if desired
make training
5.试一下好不好使
首先要下载相关语言的数据文件,英语数据文件下载地址:eng.traineddata 其他数据文件下载地址:https://github.com/tesseract-ocr/tesseract/wiki/Data-Files#data-files-for-version-400数据文件下载完成后,需要把它move到:/tesseract/tessdata 路径下
然后如果出现错误:

Please make sure the TESSDATA_PREFIX environment variable is set to the parent directory of your "tessdata" directory.

就使用命令:

export TESSDATA_PREFIX=/Users/naver/code/tesseract/

接下来要提前创建一个文件来存储识别的文字结果,如:out

然后输入测试命令:

tesseract /Users/naver/Downloads/test.jpg out

test.jpg 为要识别的图片,然后识别结果会存储在out文件中。

详细参数介绍参见官方github文档:https://github.com/tesseract-ocr/tesseract/wiki/Command-Line-Usage

https://github.com/tesseract-ocr/tesseract/blob/master/doc/tesseract.1.asc#config-files-and-augmenting-with-user-data

其他参考链接:

http://blog.csdn.net/xiaochunyong/article/details/7193744

http://www.zmonster.me/2015/04/17/tesseract-install-usage.html

http://git.malu.me/tesseract%E4%BD%BF%E7%94%A8%E8%AE%B0%E5%BD%95/

在Mac OS 下 build Tesseract4.0 源码并在命令行中使用的更多相关文章

  1. 【转】如何在Ubuntu11.10(32位)下编译Android4.0源码(图文)

    原文网址:http://blog.csdn.net/flydream0/article/details/7046612 关于如何下载Android4.0的源码请参考我的另一篇文章: http://bl ...

  2. MAC环境下 Android P 系统源码下载、编译、导入到AS、Pixel2xl刷机 实战

    一.下载源码 1 . 确保主目录下有一个 bin/ 目录,并且该目录包含在路径中: mkdir ~/bin PATH=~/bin:$PATH 2 . 下载 Repo 工具,并确保它可执行: curl ...

  3. 【原】storm源码之mac os x编译twitter storm源码

    twitter storm是由backtype公司创始人nathanmarz一手研发和开源的流计算(实时计算)框架,堪称实时计算领域的hadoop.nathanmarz也是在mac os x环境下开发 ...

  4. 在eclipse下编译hadoop2.0源码

    Hadoop是一个分布式系统基础架构,由apache基金会维护并更新.官网地址: http://hadoop.apache.org/ Hadoop项目主要包括以下4个模块: Hadoop Common ...

  5. mac 环境下Android 反编译源码

    mac环境下Android 反编译 一.需要的工具 apktool:反编译APK文件,得到classes.dex文件,同时也能获取到资源文件以及布局文件. dex2jar:将反编译后的classes. ...

  6. Ubuntu16.04下编译android6.0源码

    http://blog.csdn.net/cnliwy/article/details/52189349 作为一名合格的android开发人员,怎么能不会编译android源码呢!一定要来一次说编译就 ...

  7. YII 框架在 MAC OS下 连接数据库失败 提示 DB connection: SQLSTATE[HY000] [2002]

    作者:zccst CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] No such file or dire ...

  8. hadoop-1.2.0源码编译

    以下为在CentOS-6.4下hadoop-1.2.0源码编译步骤. 1. 安装并且配置ant 下载ant,将ant目录下的bin文件夹加入到PATH变量中. 2. 安装git,安装autoconf, ...

  9. 使用idea编译spring-framework5.0源码

    自从迈入java开发这个行当,从来没有好好的研究过源码,深感惭愧,话不多说,今天上一篇使用idea编译spring5.0源码. 以下在win中构建和编译过程分为 jdk环境的配置 gradle的下载和 ...

随机推荐

  1. MongoDB一个基于分布式文件存储的数据库(介于关系数据库和非关系数据库之间的数据库)

    1:MongoDB的官方网址:https://www.mongodb.com   MongoDB的中文社区:http://www.mongoing.com/(老外也很看重中国市场啊,知道大家英语不好, ...

  2. A. Karen and Morning

    A. Karen and Morning time limit per test 2 seconds  memory limit per test 512 megabytes input standa ...

  3. AngularJS的文字溢出处理

    需求大致如图所示,由于本人也是新接触AngularJS,研究好久,制作了一个demo,代码如下: <!DOCTYPE html><html><head><me ...

  4. 你不知道的 flex 技巧

    一.使用 Auto Margins 对齐 不需要给图片使用任何的 flex,也不需要给父容器设置 space-between,只需要给 ' BUY-BUY-BUY' 按钮设置 margin-left: ...

  5. Java注解--实现简单读取excel

    实现工具类 利用注解实现简单的excel数据读取,利用注解对类的属性和excel中的表头映射,使用Apache的poi就不用在业务代码中涉及row,rows这些属性了. 定义注解: @Retentio ...

  6. Mybatis中使用 #{} 和 ${} 向sql传参时的区别

    今天在工作时,使用MyBatis中向sql传递两个参数时,一直显示SQL语法错误,仔细检查,才发现传入的参数被加上了引号,导致传入的参数(要传入的参数是表名)附近出现语法错误. 错误写法: } a } ...

  7. Spring Boot开启https

    原文:https://github.com/x113773/testall/issues/1 1. 第一步就是用JDK的keytool工具来创建一个密钥存储(keystore)`keytool -ke ...

  8. Linux下配置tomcat+apr+native应对高并发

    摘要:在慢速网络上Tomcat线程数开到300以上的水平,不配APR,基本上300个线程狠快就会用满,以后的请求就只好等待.但是配上APR之后,Tomcat将以JNI的形式调用Apache HTTP服 ...

  9. ajax数据请求2(json格式)

    ajax数据请求2(json格式) <!DOCTYPE html> <html> <head> <meta charset="UTF-8" ...

  10. 10.application对象

    1.application对象实现了用户数据的共享,可存放全局变量 2.application开始于服务器的启动,终止于服务器的关闭. 3.在用户的前后连接或不同用户之间的连接中,可以对applica ...