如何在Eclipse中配置Tesseract进行Android开发?
我已经从事 Android 工作 6 个月了。至此我对Android开发有了基本的了解。 现在我想使用 Tesseract 开发一个 OCR Android 应用程序。 为此,我从 Tesseract 下载了 android-ndk-r6b、tess-two、Windows 版 Cygwin,并在 Eclipse 中安装了 C/C++ 开发人员。
我点击了这两个链接:
1.http://www.itwizard.ro/interface-cc-libraries-via-jni-example-tesseract-163.html
2.http://gaut.am/making-an- ocr-android-app-using-tesseract/
但我陷入了中间。我的意思是我无法将这些东西配置在一起。
谁能建议我如何从头开始(一步一步)在Android中配置tesseract?
I have been working on android from 6 months. So I have basic idea about Android development.
Now I want to develop an OCR Android app using Tesseract.
For that I have downloaded android-ndk-r6b, tess-two from Tesseract, Cygwin for Windows and installed C/C++ developer in Eclipse.
And I followed these two links:
1.http://www.itwizard.ro/interfacing-cc-libraries-via-jni-example-tesseract-163.html
2.http://gaut.am/making-an-ocr-android-app-using-tesseract/
but I got stuck in between. I mean I am not able to configure these things together.
Can anyone suggest me how to configure tesseract in Android from beginning (step by step)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
https://github.com/rmtheis/tess-two Tesseract Android Tools 的一个分支添加的功能
这适用于 SDK r16 和 NDK r7(或最新版本,具体取决于您阅读本文的时间),
请检查自述文件以获取指南。
我不确定这是否适用于 Cygwin。
如果你不想设置环境,你可以输入绝对路径,如:
/home/user/android-ndk-r7/ndk-build
因为你使用的是 Windows,它看起来会是这样就像C:\\ndk-build
与
android update project --path 一样。
你可以做类似C:\< ;路径sdk>\tools\android update project --path .
(我必须通过添加android update project -t 10 --path .
for Android 2.3.3 来指定目标)当您完成后,就可以将 tess-two 项目导入到 Eclipse 中了。确保 tess-two 是一个库(您可以检查“属性”>“Android”>“库”(在构建目标下方))
确保您已下载 SDK r16 并使用 NDK r7(或最新版本,具体取决于您阅读本文的时间)否则构建会出错。
https://github.com/rmtheis/tess-two a fork of the Tesseract Android Tools with added functionality
This works for SDK r16 and NDK r7 (or the latest, depending on when you are reading this)
check the README for the guide.
I'm not sure if this works for Cygwin.
If you don't want to set the environment, you can type out the absolute path like:
/home/user/android-ndk-r7/ndk-build
since your using windows, it would look something likeC:\<path to ndk>\ndk-build
same thing with
android update project --path .
you can do something likeC:\<path to sdk>\tools\android update project --path .
(I had to specify the target by addingandroid update project -t 10 --path .
for Android 2.3.3 )When you're done, you can then import the tess-two project to Eclipse. Make sure tess-two is a library (you can check in Properties > Android > Library (beneath build target) )
be sure you have downloaded SDK r16 and use NDK r7 (or the latest, depending on when you are reading this) otherwise building will result in an error.
链接 #2 中的说明不适用于 cygwin——您必须使用 Linux 进行构建。我已经验证这些说明有效。所以尝试使用 Linux 而不是 cygwin。
如果您使用链接#2 中的说明,则根本不需要链接#1 中的说明——它已经提供了您在 JNI 中所需的内容。
The instructions at your link #2 don't work using cygwin--you have to build using Linux. I've verified that those instructions work. So try using Linux instead of cygwin.
If you're using the instructions at your link #2, you don't need the instructions at your link #1 at all--it has what you need in JNI already available.
下载适用于 Android 的 tesseract 库 对于 Windows,下载为 .zip,对于 Linux 用户
软件要求
对于 Windows 用户,请确保您已经安装了 cygwin(您可以下载并安装它,请确保在 cygwin 安装过程中确保,还安装这些源代码和库 gcc-core、gcc-g++、make、swig)
从 [http://ant.apache.org/bindownload.cgi]
对于 Windows 用户选择 .zip,对于 Linux 用户选择 .tar.bz。
解压apache并设置环境变量(我的是C:\apache-ant-1.8.3\bin)
运行cygwin(仅适用于Windows用户,适用于Linux用户,运行终端)
a.cd /tess-two
b.export TESSERACT_PATH=${PWD}/external/tesseract-3.01
c.export LEPTONICA_PATH=${PWD}/external/leptonica-1.68
d.export LIBJPEG_PATH=${PWD}/external/libjpeg
e.ndk-build(对于 Windows 用户,/cygdrive//ndk-build)
f. Android 更新项目 --path 。 (对于windows用户,有时cygwin无法执行该命令,所以
使用命令提示符执行此命令)。
注:“.”命令中必须包含 after --path。
g。 antrelease(有时你会得到像javatools.jarnotfound这样的错误,设置环境变量
JAVA_HOME到jdk文件夹,我的是C:\Program Files\Java\jdk1.7.0)
运行 Eclipse。右键单击包资源管理器,导入>>一般>>将现有项目放入工作区>>
下一页>>选择根目录>>浏览tess-two文件夹位置>>结束。
您将在包资源管理器中看到 tess-two 文件夹。
安卓>>检查是库。
从 [https://github.com/GautamGupta/Simple-Android 下载简单的 OCR Android 应用程序-OCR.] 右键单击包资源管理器,导入简单的 OCR android 应用程序文件夹。
Download tesseract library for android Download as .zip for windows, as .tar.gz for linux user.
Software requirement
For windows user, make sure you already installed cygwin ( you can download it and install it f make sure during the cygwin installation, install also these source and library gcc-core, gcc-g++, make, swig)
Download apache-ant from[http://ant.apache.org/bindownload.cgi ]
choose .zip for windows, .tar.bz for linux user.
Unzip the apache and set the environment variable (mine is C:\apache-ant-1.8.3\bin)
Run cygwin (for windows user only,for linux user,run terminal)
a.cd /tess-two
b.export TESSERACT_PATH=${PWD}/external/tesseract-3.01
c.export LEPTONICA_PATH=${PWD}/external/leptonica-1.68
d.export LIBJPEG_PATH=${PWD}/external/libjpeg
e.ndk-build(for windows user, /cygdrive//ndk-build)
f. android update project --path . (for windows user, sometime cygwin cannot execute this command, so
use command prompt to execute this command).
Note: The “.” after --path must be included in the command.
g. ant release ( sometimes you will get error like java tools.jar not found, set environment variable
JAVA_HOME to the jdk folder, mine is C:\Program Files\Java\jdk1.7.0)
Run Eclipse. Right click on package explorer, import>> General >> Existing Project into Workspace >>
Next >> Select Root Directory >> Browse the tess-two folder location >> Finish.
You will see tess-two folder in your package explorer.
Android >> Check Is Library.
Download the simple OCR android app from [https://github.com/GautamGupta/Simple-Android-OCR.] Right click on package explorer, import the simple OCR android app folder.