0

Here is my code

String DATA_PATH = Environment.getExternalStorageDirectory().toString() + "/VIVA/";
    TessBaseAPI baseApi = new TessBaseAPI();
    baseApi.setDebug(true);
    //baseApi.init(DATA_PATH, lang);
    baseApi.init(DATA_PATH, "eng");
    baseApi.setImage(bmp);
    String recognizedText = baseApi.getUTF8Text();
    baseApi.end();
    Log.i("OCRED TEXT 2: " + recognizedText, "hello");

When I debug it, debugger stops after this line " TessBaseAPI baseApi = new TessBaseAPI();" There are no errors logged in log cat, But it opens target invocation exception class.

I have my training data in tessdata folder in assets,I have copied that data into Google glass SD card in onCreate() method.

enter image description here

I have compiled tess-two project using ndk-build and have generated .so files.

What is it that I am missing?

Prasanna Aarthi
  • 3,439
  • 4
  • 26
  • 48

1 Answers1

1

Have you added the tess-two project into your Google glass project and imported the classes? Can´t remenber very well where you have to add it. Try looking in your glass project > properties > Android

If you are using more than one NDK compiled libraries you can solve the problem by deleting one of the armeabi folders of a library. This may depend on the architecture of the device (can't explain you much about this sorry). You may backup your compiled libraries or use a copy of these libraries in your glass app and try hit or miss deleting until you get it. I also passed through this problem once and this worked for me.

Sakawa
  • 38
  • 4
  • i have added it there, but it doesnt get included into Android dependencies, I have added it into libs folder and it is under Android private libraries. – Prasanna Aarthi Sep 18 '14 at 10:30
  • Sometimes if you are using more than one libraries in the project, armeabi folders of a library can hide the armeabi folder of another library. – Sakawa Sep 18 '14 at 10:31
  • Do you mean including the same library twice? – Prasanna Aarthi Sep 18 '14 at 10:32
  • No, I mean if you are using a NDK compiled library of Tesseract and another NDK compiled library for, let's say, image processing, they will both have the same structure of armeabi folders and one is hiding the other. – Sakawa Sep 18 '14 at 10:39
  • yeah I am using open CV and tesseract.. Any work around for this? – Prasanna Aarthi Sep 18 '14 at 10:43
  • Google glass uses armeabi-v7a,So After i delete those , will they get generated again ?Aren't those .so lib files required to run my project? – Prasanna Aarthi Sep 18 '14 at 11:17
  • You can delete the armeabi-v7a folder of one of the two libraries you are using. As there are are more .so of other arquitectures, it may run. As I said, this worked for me and both libraries are running well. But first make a backup of these libraries, just in case – Sakawa Sep 18 '14 at 11:36