“.SO” Tesseract OCR 文件
我需要在我的 Android 应用程序中使用 Tesseract OCR(光学字符识别)的“.so”文件。谁能解释一下如何获取 Tesseract OCR 的“.so”文件?
我尝试导入完整的项目,但不起作用。
I need to use the ".so" file of Tesseract OCR (Optical Character Recognition) for my Android app. Can anyone explain me how to get the ".so" file for Tesseract OCR?
I tried to import the complete project which is not working.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
tesseract-android-tools 附带的自述文件将成为你最好的朋友。我在 VirtualBox 中使用 Ubuntu 11.04。在 Ubuntu 中(我假设您稍后需要将它们转移到 Windows):
1) 下载 Android NDK
2) SVN tesseract-android-tools 项目。我使用 tesseract-android-tools-read-only/tesseract-android-tools/ 作为 $PROJECT 目录,仅供参考。
3)使用ndk-build(README中有详细介绍)构建tesseract。这样做将在 $PROJECT 中创建一个 libs 文件夹以及您需要的三个 .so 文件。
我相信有一种方法可以用 Cygwin 来做到这一点,但我不确定如何做,因为我已经准备好了可以使用的虚拟机。
从那里(使用 http://code.google.com/p 中的说明/tesseract-android-tools/updates/list):
4) tesseract tools 实际上是一个库,并且有一个 eclipse .project,因此只需在使用 ndk 构建 so 后导入该项目并构建它即可。
5)将其设置为lib:http://developer.android。 com/guide/developing/projects/projects-eclipse.html#SettingUpLibraryProject
6) 现在在同一个工作区中创建一个新的 android 项目,即您的应用程序。转到属性并引用步骤 3 中的库 ( http:// developer.android.com/guide/developing/projects/projects-eclipse.html#ReferencingLibraryProject )
7) 基于 Android 2.2 构建应用程序(分钟):http://code.google.com/p/tesseract -android-tools/issues/detail?id=5#c16
它应该可以工作!
请注意,您必须使用 Android 2.2 或更高版本。希望有帮助!
The README that comes with tesseract-android-tools is going to be your best friend. I used Ubuntu 11.04 in VirtualBox. Within Ubuntu (I assume you'll want to transfer these to Windows later):
1) Download the Android NDK
2) SVN the tesseract-android-tools project. I used
tesseract-android-tools-read-only/tesseract-android-tools/
as the $PROJECT directory, FYI.3) Use ndk-build (detailed in README) to build tesseract. Doing so will create a libs folder within $PROJECT, and the three .so files you need.
I believe there's a way to do it with Cygwin but I'm not sure how, as I already had the VM ready to use.
From there (using instructions at http://code.google.com/p/tesseract-android-tools/updates/list):
4) tesseract tools is actually a library and has a eclipse .project so just import that project after building the so's with ndk and build it.
5) Set it as lib : http://developer.android.com/guide/developing/projects/projects-eclipse.html#SettingUpLibraryProject
6) Now in the same workspace create a new android project i.e. your app. Go to properties and reference the library from step 3 ( http://developer.android.com/guide/developing/projects/projects-eclipse.html#ReferencingLibraryProject )
7) Build your app based on Android 2.2 (min) : http://code.google.com/p/tesseract-android-tools/issues/detail?id=5#c16
And it should work !
Note that you must be using Android 2.2 or higher. Hope that helps!!
@raju:我遇到了和你一样的问题。搜索解决方案后,我发现了这个: http://gaut.am/ Making-an-ocr-android-app-using-tesseract/
不知道你的情况是否和我一样!?!但我正在 Windows 操作系统下使用 Eclipse 进行开发。博客(上一个链接)说这不能在 Windows 下完成,因此您必须使用 Linux(例如:虚拟机中的 Ubuntu)。此外,博客还详细解释了应该完成的步骤。
@jmiles
我尝试在 Ubuntu 下执行“ndk-build”,然后将结果转移到 Windows 中。我已经构建了超立方体并将其设为“图书馆”;但是,在尝试识别字符时我总是遇到错误:这些是一些日志消息:04-04 14:32:28.569: E/2130968577(561): java.lang.IllegalArgumentException: 数据路径必须包含子文件夹 tessdata ! 04-04 14:32:28.569:E / 2130968577(561):在com.googlecode.tesseract.android.TessBaseAPI.init(TessBaseAPI.java:167)
你@jmiles或@CommonsWare对这个问题有任何想法吗?
@raju : I was having the same problem as yours. After searchig for solutions I found this: http://gaut.am/making-an-ocr-android-app-using-tesseract/
Dunno if your case is like mine!?! But I'm developing using Eclipse under Windows OS. The Blog (previous link) says that this can't be done under windows, so you must use Linux (ex: Ubuntu within a Virtual Machine for example). In addition, the blog explains in details the steps that should be done.
@jmiles
I've tried to do "ndk-build" under Ubuntu and then I transferred the result into Windows. I've built the tesseract and made it a "Library"; however, I'm always having errors when trying to recognize characters: These are some of the log messages: 04-04 14:32:28.569: E/2130968577(561): java.lang.IllegalArgumentException: Data path must contain subfolder tessdata! 04-04 14:32:28.569: E/2130968577(561): at com.googlecode.tesseract.android.TessBaseAPI.init(TessBaseAPI.java:167)
Do you @jmiles or @CommonsWare have any idea about the problem??
您需要安装 Android NDK,将 Tesseract 内容转换为 NDK 扩展,然后通过 JNI 将其添加到您的 Java 应用程序中。这不太容易。您不能只获取 Linux 的
.so
并将其放入您的项目中。You would need to install the Android NDK, convert the Tesseract stuff into an NDK extension, and add it to your Java app via JNI. This is unlikely to be easy. You cannot just take an
.so
for, say, Linux and put it in your project.您需要下载 tesseract 的语言数据文件并将其放入“tessdata”文件夹中,然后用它初始化 tesseract,就像
现在这样就可以了。
You need to download the language data file for the tesseract and put it into the 'tessdata' folder and then initialize tesseract with it like
This will work now.