当我使用 tess-two:6.1.1 时,出现以下错误
Tesseract(native): Could not initialize Tesseract API with language=eng!
ActivityThread: Performing resume of ActivityRecord{dc1c46c token=android.os.BinderProxy@ce1ba35 {xxx.xxxx.xxxxx/xxx.xxxx.xxxxx.MainActivity}}
D/skia: jpeg_decoder mode 1, colorType 4, w 1280, h 1280, sample 1, bsLength 0!!
I/System: FinalizerDaemon: finalize objects = 1
D/skia: jpeg_decoder finish successfully, L:1934!!!
A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xc in tid 22351 (ia.testproguard)
我在 android studio 中将这个 lib 用于 gradle
compile 'com.rmtheis:tess-two:6.1.1'
我在 sdcard 的根目录中创建了名为“tessdata”的文件,并在名为“eng.traineddata”的 tessdata 中创建了 emtry txt
下面是我的代码
int permissionCheck =
ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE);
if (permissionCheck == -1) {
ActivityCompat.requestPermissions(this,
new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, 101);
}
baseApi = new TessBaseAPI();
custom.traineddata
baseApi.init(SD_PATH, "eng");
baseApi.setPageSegMode(TessBaseAPI.PageSegMode.PSM_AUTO);
baseApi.setImage(new File("sdcard/img.jpg"));
final String result = baseApi.getUTF8Text();
//这里,你可以把result的值赋值给你的TextView
baseApi.end();
((TextView) findViewById(R.id.test)).setText(result);
有人知道我在哪里犯错吗?