Can't do OCR with tess-two on Android Studio

all. I am trying to include the tess-two OCR library in an android project but am having some problems.

[What am I trying to do]

Do OCR with tess-two ( tess-two github link ) on Android Studio.
(I would like to develop some OCR applications)

[Where am I stuck]

Application forcibly quits when launched from Android Studio

[What I've done]

  • Downloaded tess-two
  • built it
ndk-build
android update project --path C:\...\tess-two  
ant release

      

  1. Made a new project "test" on Android Studio (API 16, Blank Activity).
  2. Place .jar classes for testing \ app \ libs
  3. Added .jar classes as a library for the application
  4. Place directories with .so files (armeabi-v7a, mips, x86) to check \ app \ src \ main \ jniLibs
  5. Place the following code in MainActivity.java
import com.googlecode.tesseract.android.TessBaseAPI;

public void testOCR(){
    String storagePath = Environment.getExternalStorageDirectory().getPath();
    Bitmap bitmap = null;
    ImageView img = (ImageView) findViewById(R.id.imageView);

    // Read an image
    File file = new File("storage/sdcard1/tess-two/ocr_sample.jpg");
    if (file.exists()) {
        bitmap = BitmapFactory.decodeFile(file.getPath());
        bitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);
        img.setImageBitmap(bitmap);
    }else{
        Log.d("tess-two","File not found.");
        return;
    }

    // Init modules
    TessBaseAPI tessOCRAPI = new TessBaseAPI();
    tessOCRAPI.init(storagePath+"/tess-two/", "eng");

    // Set Image
    tessOCRAPI.setImage(bitmap);
    String recognizedText = tessOCRAPI.getUTF8Text();
    Log.d("tess-two",recognizedText);

    // Close OCR API
    tessOCRAPI.end();

}

      

  1. An application has been sent to the smartphone.

Then the application stopped. I debugged it and the program seemed to stop at TessBaseAPI tessOCRAPI = new TessBaseAPI();

. While debugging in debug windows the following suggestion appeared.

com.android.internal.os.ZygoteInit$MethodAndArgsCaller

Restoring and cleaning up the project and searching on google did not give any good results.

Can anyone suggest a way to solve this problem? Thank you in advance!

[My surrounding]

  • Windows 8.1 Pro 64 bit
  • Android studio 1.3
  • Xperia SO-04F

[Link]

  • Android Tesseract OCR on Android Studio [Locked]
  • Including * .so Android Studio tess-two libraries (tesseract)
+3
java android android-studio ocr tess-two


source to share


No one has answered this question yet

See similar questions:

five
Including * .so libraries Android Studio tess-two (tesseract)
2
Android Tesseract OCR on Android Studio

or similar:

6549
Why subtracting these two times (in 1927) gives a strange result?
3606
Close / hide Android soft keyboard
3295
Why is the Android emulator so slow? How can we speed up the development of an Android emulator?
3288
Correct use cases for Android UserManager.isUserAGoat ()?
2609
Is there a unique identifier for an Android device?
1345
Where can I put the "assets" folder in Android Studio?
1214
Rename package in Android Studio
1206
What is Gradle in Android Studio?
1112
What should my Android Studio .gitignore project be?
746
Error getting parent for element: no resource found that matches the specified name after updating to AppCompat v23



All Articles
Loading...
X
Show
Funny
Dev
Pics