2

when I use the tess-two:6.1.1, I got below error

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)

I use this lib for gradle in android studio

compile 'com.rmtheis:tess-two:6.1.1'

I create the name "tessdata" file in root of sdcard and create emtry txt in tessdata named "eng.traineddata"

below is my code

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);

have someone know where I make mistake?

  • You may missing the cube files, at least if you are using EngineMode.Default. Why Do you use an empty traineddata ? Tesseract offer already good traineddata in almost all languages – feldeOne Dec 13 '16 at 13:40
  • @feldeOne I just use the Tesseract, what is the cube file ? – guodong cao Dec 14 '16 at 02:43
  • @feldeOne I have another question about chinese traineddata? I find the https://github.com/tesseract-ocr/langdata url and ont found chinese traineddata?have some advice? – guodong cao Dec 14 '16 at 02:55
  • the cube files are needed if you run your TessEngine on this mode, the You can specify three different OCR engine modes: .TesseractOnly, which is the fastest, but least accurate method; .CubeOnly, which is slower but more accurate since it employs more artificial intelligence; and .TesseractCubeCombined, which runs both .TesseractOnly and .CubeOnly to produce the most accurate results — but as a result is the slowest mode of the three – feldeOne Dec 14 '16 at 07:57
  • Possible duplicate of [Could not initialize Tesseract API with language=eng](https://stackoverflow.com/questions/38291379/could-not-initialize-tesseract-api-with-language-eng) – rmtheis May 15 '18 at 14:22

0 Answers0