小编urp*_*ani的帖子

无法使用language = eng初始化Tesseract API

我正在开发一款需要OCR的Android应用.我决定使用Tesseract作为API,但我一直在收到此错误:

E/Tesseract(原生):无法使用language = eng初始化Tesseract API!

  1. 我已将文件复制"eng.traineddata"到该位置.
  2. 我使用的是Android Studio 2.1.2(SDK 23)
  3. 使用API​​ 22 Android Lollipop 5.1.1在设备上进行测试(阅读关于Marshmallow的权限问题)

这是我正在使用的代码:

public void reads(View view) {

  TextView textView = (TextView) findViewById(R.id.textView);

  int rotation = 0;

  try {
    ExifInterface exifInterface = new ExifInterface(mCurrentPhotoPath);
    int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION,ExifInterface.ORIENTATION_NORMAL);

    switch (orientation){
      case ExifInterface.ORIENTATION_ROTATE_90: rotation = 90; break;
      case ExifInterface.ORIENTATION_ROTATE_180: rotation = 180; break;
      case ExifInterface.ORIENTATION_ROTATE_270: rotation = 270; break;
    }
  } catch(Exception e) {

  }

  int w = imageBitmap.getWidth();
  int h = imageBitmap.getHeight();

  if …
Run Code Online (Sandbox Code Playgroud)

ocr android tesseract tess-two

7
推荐指数
1
解决办法
5342
查看次数

标签 统计

android ×1

ocr ×1

tess-two ×1

tesseract ×1