
权限配置


懒 没有写回调 第一遍点击允许 重进一遍就可以了
modul 包模式
https://github.com/rmtheis/tess-two 库下载链接 在tess-two里面找到tess-two 文件夹
tess-two 是一个ndk项目 所以下载一下ndk cmake 和lldb 如图

打开添加的tess-two的module,找到build.gradle文件。
在最开始的地方添加
代码:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'org.codehaus.groovy:groovy-backports-compat23:2.3.5'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
}
}

tessdata:字体识别库(chi_sim.traineddata中文简体,chi_tra.traineddata中文繁体,eng.traineddata英文库)
https://github.com/tesseract-ocr 文字库 如果需要中文简体 就下载 然后放在assets 文件下
(assets文件夹需要是系统创建 自己手动创建的获取不到输入流)
如
https://github.com/tesseract-ocr/tessdata/blob/master/chi_sim.traineddata

思路: 文件库 assets 文件copay 到内存卡上 然后获tessApi
创建路径: 现创建文件夹在创建文件

创建tessBassApi
lvBaseAPI.init(getExternalCacheDir().getAbsolutePath(), "chi_sim");
参数 文件根目录和语言类型

到此就初步的实现了 图片上的文字识别
网友评论