android - 为 Android Studio 编译 Tesseract OCR 库

标签 android tesseract tess-two

我仍然对如何构建一个可用的 tess-two Android Studio 感到困惑使用 Tesseract OCR 的项目,尽管上面有几篇文章。有一个可用的预构建版本,其“自述文件”的“使用”部分说我们可以通过简单地添加 tess-two 来做到这一点。作为外部依赖项,只需将以下行添加到 dependencies我们应用程序的 build.gradle 部分:

compile 'com.rmtheis:tess-two:6.0.3'

我明白这告诉Android Studio从远程获取库的预构建版本 Maven它已发布的存储库,但是我们仍然需要复制到我们全新的 Android Studio 中吗?投影 tess-two内容我们下载或克隆的目录?

请查看附件图片:我的新空白Android Studio项目名为TessAndroid。在其他地方,我保存了完整的 tess-two下载 zip 文件后的内容。除了compile行添加到 dependencies我应用的 build.gradle 部分,我是否必须将tess-two 文件夹(或其中的某些部分)复制到我的主应用程序的根目录中?

enter image description here

最佳答案

In addition to the compile line added to the dependencies section of my app's build.gradle, do I also have to copy the tess-two folder (or some parts of it) into my main app's root directory?

没有。通过将 compile 行添加到您的 build.gradle,您将该库代码的编译版本导入到您的项目中,并且无需将其源代码也复制到您的项目中。

您可以自己确认这一点,方法是在 Android Studio 中创建一个新项目,将库的 compile 行添加到新应用的 build.gradle,然后将一行代码添加到新 Activity 的onCreate 引用库中类的方法:

TessBaseAPI baseApi = new TessBaseAPI();

该类将在您的项目中找到并可用。

关于android - 为 Android Studio 编译 Tesseract OCR 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45126201/

相关文章:

android - 自动从 strings.xml 中删除未引用的字符串

python - pytesseract 努力识别带有字体编号和 7 段数字的干净黑白图片(python)

android - 包括 *.so 库 Android Studio tess-two (tesseract)

android - Android 上的 OCR 扫描问题

java - 苔丝二号和tessdata文件夹

java - RecyclerAdapter getItemCount 崩溃

Android 免费/付费 - 使用库的架构

android - 无法执行 dex : Multiple dex files define Lorg/apache/maven/artifact/Artifact

python - 根据已知字体确定图像中是否存在数字 (OCR + OpenCV)

image - Tesseract-OCR (3.02) 识别准确率和速度