I am working on a OCR based Android app. I am using the Tesseract library for the same. My application works fine on a Sony Ericsson Xperia Arc S device. However, the same app crashes on my Samsung Galaxy Tab 8.9. I am not sure why this is happening. Following is code snippet:
我正在开发一个基于OCR的Android应用程序,我也在使用Tesseract库。我的应用程序在索尼爱立信Xperia Arc S设备上运行良好。然而,同样的应用程序在我的三星Galaxy Tab 8.9上崩溃了。我不知道为什么会这样。以下是代码片段:
TessBaseAPI baseApi = new TessBaseAPI();
baseApi.init(Environment.getExternalStorageDirectory().toString() + "/tesseract/", "eng",TessBaseAPI.OEM_DEFAULT);
baseApi.setImage(bitmap);
String recognizedText=baseApi.getUTF8Text(); //App Crashes here
How can it be resolved?
如何解决这个问题?
Unfortunately the logCat does not report any error.
不幸的是,logCat没有报告任何错误。
Following is the output I see in the logCat:
下面是我在logCat中看到的输出:
02-12 09:57:20.720: I/Tesseract(native)(5577): Initialized Tesseract API with language=eng
02-12 09:57:20.720: D/dalvikvm(5577): Trying to load lib /data/data/com.project.meter_reader/lib/liblept.so 0x4074d618
02-12 09:57:20.720: D/dalvikvm(5577): Shared lib '/data/data/com.project.meter_reader/lib/liblept.so' already loaded in same CL 0x4074d618
02-12 09:57:21.030: D/dalvikvm(5577): Trying to load lib /data/data/com.project.meter_reader/lib/liblept.so 0x4074d618
02-12 09:57:21.030: D/dalvikvm(5577): Shared lib '/data/data/com.project.meter_reader/lib/liblept.so' already loaded in same CL 0x4074d618
02-12 09:57:24.160: I/dalvikvm(5577): threadid=4: reacting to signal 3
02-12 09:57:24.160: I/dalvikvm(5577): Wrote stack traces to '/data/anr/traces.txt'
At baseApi.getUTF8Text()
the application displays a blank screen and simply stops responding, then the debugger gets detached.
在baseap . getutf8text()中,应用程序显示一个空白屏幕,并简单地停止响应,然后调试器被分离。
1 个解决方案
#1
1
I had similar issue using Tesseract 3.0.19 in native lib. Updating tess-data to version 3.02 helped me.
在native lib中使用Tesseract 3.0.19也有类似的问题,将tess数据更新为3.02版本对我很有帮助。
#1
1
I had similar issue using Tesseract 3.0.19 in native lib. Updating tess-data to version 3.02 helped me.
在native lib中使用Tesseract 3.0.19也有类似的问题,将tess数据更新为3.02版本对我很有帮助。