How can I use Tesseract in Android?

前端 未结 4 1570
悲哀的现实
悲哀的现实 2020-12-23 22:20

I have searched on the net for a couple of hours. I got many answers saying we need to use NDK, etc. for \"Tesseract\" for WINDOWS.

But I didn\'t get any step-by-ste

相关标签:
4条回答
  • 2020-12-23 23:07

    http://kurup87.blogspot.in/2012/03/android-ocr-tutorial-image-to-text.html here is step by step tutorial

    0 讨论(0)
  • 2020-12-23 23:15

    You need to use tess-two project for working with Tesseract on Android.
    The tess-two contains tools for compiling the Tesseract and Leptonica libraries for use on the Android platform. It provides a Java API for accessing natively-compiled Tesseract and Leptonica APIs.

    Adding tess-two to your project:

    add to build.gradle:

    dependencies {
        compile 'com.rmtheis:tess-two:5.4.1'
    }
    

    Using Tesseract:

    import com.googlecode.tesseract.android.TessBaseAPI;
    
    private String extractText(Bitmap bitmap) throws Exception{
        TessBaseAPI tessBaseApi = new TessBaseAPI();
        tessBaseApi.init(DATA_PATH, "eng");
        tessBaseApi.setImage(bitmap);
        String extractedText = tessBaseApi.getUTF8Text();
        tessBaseApi.end();
        return extractedText;
    }
    

    You can looking on my simple one-class example of using Tesseract for Android. It contains only 200 lines of Java code.

    0 讨论(0)
  • 2020-12-23 23:22

    This video shows you exactly how it is done

    How can I use Tesseract in Android?

    Make sure to: 1. Create the folder 2. in that folder you have to put the traineddata file (You can download it from here in the language you require https://github.com/tesseract-ocr/tessdata/tree/3.04.00 ) 3. Reference the path to the folder cointining the traineddata file and state the language: tessBaseApi.init(DATA_PATH, "eng");

    Hope it helps

    0 讨论(0)
  • 2020-12-23 23:23

    You can refer this document, It gives ths step by step But you need to do is to set up the tesseract-android-tools project as a library project in Eclipse, and tell your project to refer to the library project. So you’ll need two projects in Eclipse,

    http://rmtheis.wordpress.com/2011/08/06/using-tesseract-tools-for-android-to-create-a-basic-ocr-app/

    I hope this help.....

    0 讨论(0)
提交回复
热议问题