【问题标题】:Android tesseract OCR, jni :received a nullstring in Lcom/googlecode/tesseract/android/TessBaseAPIAndroid tesseract OCR, jni :received a nullstring in Lcom/googlecode/tesseract/android/TessBaseAPI
【发布时间】:2012-04-17 04:05:00
【问题描述】:

tesseract-android-tools-test(测试项目以确保一切设置正确)有效。 我的 eng.traindeddata 来自:http://tesseract-ocr.googlecode.com/files/eng.traineddata.gz (http://code.google.com/p/tesseract-ocr/wiki/ReadMe) 然而,当我尝试运行我自己的路径时,我仍然遇到上述错误,这只是初始化它......这就是我到目前为止所做的一切。 有什么建议吗?

【问题讨论】:

    标签: android ocr tesseract


    【解决方案1】:

    您需要将 eng.traineddata(解压缩)放在文件夹中的 tessdata 目录中 -

    /mnt/sdcard/tessdata/eng.traineddata

    然后,将路径作为 /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】:

      好的,即使文档声明您可以将 init 称为 tesseract.init(PATH, null) 然后您不能这样做。确保使用“eng”或您要“解释”的语言来调用它。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-07-17
        • 1970-01-01
        • 1970-01-01
        • 2012-11-17
        • 2015-03-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多