edufolly / flutter_mobile_vision

Flutter implementation of Google Mobile Vision.
MIT License
455 stars 168 forks source link

OCR Method always returning the exception #14

Closed KVManpreetam closed 5 years ago

KVManpreetam commented 6 years ago

Hi We are using this OCRText widget library for our project, it is running okay, but after scanning the text, it is always throwing the error. even though the text is recognised on screen. code block as follows:

/// /// OCR Method /// Future _read() async { List texts = []; try { texts = await FlutterMobileVision.read( flash: _torchOcr, autoFocus: _autoFocusOcr, multiple: _multipleOcr, showText: _showTextOcr, camera: _cameraOcr, fps: 2.0, ); } on Exception { texts.add(new OcrText('Failed to recognize text.'));

}

if (!mounted) return;
setState(() => _textsOcr = texts);

}

screenshot_20180831-140041

edufolly commented 5 years ago

Hi @ KVManpreetam, Could you try this code? And catch the exception?

Future<Null> _read() async {
    List<OcrText> texts = [];
    try {
      texts = await FlutterMobileVision.read(
        flash: _torchOcr,
        autoFocus: _autoFocusOcr,
        multiple: _multipleOcr,
        showText: _showTextOcr,
        camera: _cameraOcr,
        fps: 2.0,
      );
    } catch(e) {
      print('Error: $e');
      texts.add(new OcrText('Failed to recognize text.'));
    }

    if (!mounted) return;

    setState(() => _textsOcr = texts);
  }
raziAkbar commented 5 years ago

While scanning it says UNKNOWN(99) for format and UNKNOWN(99) value format

Prismane commented 5 years ago

I have this same issue . I see the text on the screen but no way to access in my terminal or print the text in my terminal . Really need some help. I tried editing the ocrgraphic class but it's read only and won't allow me. I'm a student at a university using this for a project. Please help

msndvlpr commented 5 years ago

I think the problem is because of .so file which cannot be loaded, I have the same problem and I found it inspecting Flutter Console log:
I/Vision (22604): Loading library libbarhopper.so I/Vision (22604): Library not found: /data/data/com.google.android.gms/app_vision/barcode/libs/armeabi-v7a/libbarhopper.so I/Vision (22604): libbarhopper.so library load status: false I/Vision (22604): Request download for engine barcode W/BarcodeNativeHandle(22604): Native handle not yet available. Reverting to no-op handle. W/DynamiteModule(22604): Local module descriptor class for com.google.android.gms.vision.dynamite not found. I/DynamiteModule(22604): Considering local module com.google.android.gms.vision.dynamite:0 and remote module com.google.android.gms.vision.dynamite:2405 I/DynamiteModule(22604): Selected remote version of com.google.android.gms.vision.dynamite, version >= 2405 I/Vision (22604): Loading library libbarhopper.so I/Vision (22604): libbarhopper.so library load status: false I/Timeline(22604): Timeline: Activity_idle id: android.os.BinderProxy@1d8664db time:824535679

edufolly commented 5 years ago

I've just published a new demo app. Check it out... Flutter Mobile Vision Start

Please feel free to ask for further help here.