当我使用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 for 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);
有人知道我弄错了吗?