Tess-two OCR not working

前端 未结 1 1616
醉酒成梦
醉酒成梦 2021-01-21 18:44

im trying to get text from an image using tess-two on android.

But its giving me a really bad result

01-16 12:00:25.339: I/Tesseract(native)(29038): Init         


        
1条回答
  •  失恋的感觉
    2021-01-21 19:06

    Here change the language code for image text language.

    eg: if you want English language text recognition, then use 'eng', or Spanish language for 'spa'

    1)

       TessBaseAPI baseApi = new TessBaseAPI();
            baseApi.init("/mnt/sdcard/external_sd/tess/", "eng");
            baseApi.setImage(bitmap);
            String recognizedText = baseApi.getUTF8Text();
            Log.d("Texto leido", "texto: "+recognizedText);
            baseApi.end();
    

    2)Download language package files from Download here you must download osd.traineddata.zip file and tesseract-ocr-3.01.eng.tar.zip(here eng for English, spa for Spanish.. etc) files paste into assets folder.

    3)before set bitmap convert into gray scale image bitmap

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