Android的OCR应用程序使用的tesseract应用程序、Android、OCR、tesseract

2023-09-07 09:03:11 作者:萌獸

我目前深化发展基于OCR(光学字符识别)Android应用程序。我已经下载了包含工具编译的tesseract,Leptonica和JPEG库在Android上使用tesseract-机器人项目。我通过Eclipse深化发展在Windows Vista操作系统。

I am currently developping an android application based on OCR (Optical Character Recognition). I've downloaded the "tesseract- android" project that contains tools for compiling the Tesseract, Leptonica, and JPEG libraries for use on Android. I am developping via Eclipse on Windows Vista OS.

我也下载了必要的工具(Android的NDK; Apache Ant的..),我已经仔细地做了所有建设项目,并将其添加为库我的基本应用程序的步骤

I've also downloaded the necessary tools (android-ndk;apache ant..), and I've done carefully all the steps to build this project and add it as a library to my basic application.

我的应用程序包括打开相机通过API的tesseract为了将其转化为文本拍照,然后处理这幅画的。

My app consists of opening the camera for taking a picture and then processing this picture via tesseract API in order to transform it into text.

我的问题是: 1.这是真的,这个过程不会在Windows操作系统的工作吗? 2.编译时,我有以下错误:    java.lang.IllegalArgumentException异常:数据路径必须包含子文件夹tessdata

My question is: 1. Is it true that this procedure doesn't work under Windows OS? 2. When compiling, I am having the following error: "java.lang.IllegalArgumentException: Data path must contain subfolder tessdata!"

这可能是什么潜在的错误?在java code的有关部分:

What could be the potential error? The concerned portion of the java code is:

File myDir = getExternalFilesDir(Environment.MEDIA_MOUNTED); 
TessBaseAPI baseApi = new TessBaseAPI(); 
baseApi.init(myDir, "eng");

我也试图用/tess-two/external/tesseract-3.01/tessdata/tessconfigs而不是MYDIR,但错误是一样的。

I've also tried to use "/tess-two/external/tesseract-3.01/tessdata/tessconfigs" instead of "myDir", but the error remains the same.

我会强烈AP preciate任何帮助。

I would highly appreciate any help.

先谢谢了。

推荐答案

我面临同样的问题。工作对我来说,当我删除tessdata从路径。

I was facing the same problem. Worked for me when I removed "tessdata" from the path.

Before (fail): path = "/mnt/sdcard/tesseract/tessdata"; 
After (success): path = "/mnt/sdcard/tesseract/";

然后,baseApi.init(路工程),没有例外的工作。

Then, baseApi.init(path, "eng") worked with no exceptions.

当然,tessdata夹应与desired.traineddata文件的路径。

Of course, tessdata folder should be in the path with the desired.traineddata file.