Android tesseract OCR, jni:在Lcom/googlecode/tesseract/ Android /TessBaseAPI中接收到一个nullstring。

时间:2022-01-27 08:59:55

tesseract-android-tools-test (test project to ensure everything is set up right) works. i got my eng.traindeddata from : http://tesseract-ocr.googlecode.com/files/eng.traineddata.gz (http://code.google.com/p/tesseract-ocr/wiki/ReadMe) Yet i still get the above mentioned error when trying to run my own path, which is just initializing it... that is all i am doing so far. Any suggestions?

tesseract-android-tools-test(测试项目,确保设置正确)工作。我得到了我的英格。但是,当我试图运行我自己的路径时,我仍然得到上面提到的错误,这只是初始化它……这就是我目前所做的一切。有什么建议吗?

2 个解决方案

#1


2  

You need to place eng.traineddata (unzipped) inside tessdata directory in your folder -

你需要把eng放在这里。培训数据(解压缩)在您的文件夹中的tessdata目录-。

/mnt/sdcard/tessdata/eng.traineddata

/ mnt / sdcard / tessdata / eng.traineddata

Then, supply the path as /mnt/sdcard/ to your init call. 'tessdata' is added by the library..

然后,提供路径为/mnt/sdcard/到您的init调用。“tessdata”由库添加。

public class TesseractApp extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        File sdcard = Environment.getExternalStorageDirectory();
        File from = new File(sdcard, "Pic.jpg");
        TessBaseAPI api = new TessBaseAPI();
        api.init("/mnt/sdcard/", "eng");
        api.setImage(from);
        Log.d("OCR", api.getUTF8Text());
    }
}

#2


0  

OKay even though the documentation states that you can call the init as tesseract.init(PATH, null) Then you cannot do so. Make sure you call it with "eng" or the language that you are looking to "interpret".

尽管文档说明你可以把init称为tesseract。init(路径,null),然后不能这样做。一定要用“eng”或者你想要“解释”的语言来称呼它。

#1


2  

You need to place eng.traineddata (unzipped) inside tessdata directory in your folder -

你需要把eng放在这里。培训数据(解压缩)在您的文件夹中的tessdata目录-。

/mnt/sdcard/tessdata/eng.traineddata

/ mnt / sdcard / tessdata / eng.traineddata

Then, supply the path as /mnt/sdcard/ to your init call. 'tessdata' is added by the library..

然后,提供路径为/mnt/sdcard/到您的init调用。“tessdata”由库添加。

public class TesseractApp extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        File sdcard = Environment.getExternalStorageDirectory();
        File from = new File(sdcard, "Pic.jpg");
        TessBaseAPI api = new TessBaseAPI();
        api.init("/mnt/sdcard/", "eng");
        api.setImage(from);
        Log.d("OCR", api.getUTF8Text());
    }
}

#2


0  

OKay even though the documentation states that you can call the init as tesseract.init(PATH, null) Then you cannot do so. Make sure you call it with "eng" or the language that you are looking to "interpret".

尽管文档说明你可以把init称为tesseract。init(路径,null),然后不能这样做。一定要用“eng”或者你想要“解释”的语言来称呼它。