Git Product home page Git Product logo

flutter_mobile_vision's Introduction

flutter_mobile_vision

Codacy Badge pub package

Flutter implementation for Google Mobile Vision.

Based on Google Mobile Vision.

Android Samples -=- iOS Samples

Liked? ⭐ Star the repo to support the project!

Features

  • Android

    • Barcode Scan
      • Front or Back camera.
      • Select preview sizes.
      • Simple scan.
      • Toggle torch.
      • Toggle auto focus.
      • Specify types of barcodes that will be read.
      • Tap to capture.
      • Select barcode type to be scanned.
      • Scan multiple barcodes.
      • Barcode coordinates.
      • Show barcode text.
      • Standard code.
    • Recognize Text
      • Front or Back camera.
      • Select preview sizes.
      • Simple OCR.
      • Toggle torch.
      • Toggle auto focus.
      • Multiple recognition.
      • Text language.
      • Text coordinates.
      • Hide recognized text.
      • Standard code.
    • Detect Faces
      • Front or Back camera.
      • Select preview sizes.
      • Simple detection.
      • Toggle torch.
      • Toggle auto focus.
      • Multiple detection.
      • Face coordinates.
      • Hide detection information.
      • Standard code.
    • Generalization of capture activities.
    • Choose between back and front camera.
    • Control camera FPS.
  • iOS

    • Barcode Scan
      • Future Tasks
    • Recognize Text
      • Future Tasks
    • Detect Faces
      • Future Tasks

Your feature isn't listed? Open a issue right now!

Screenshots

Usage

Example

To use this plugin :

  • add the dependency to your pubspec.yaml file:
  dependencies:
    flutter:
      sdk: flutter
    flutter_mobile_vision: ^0.1.3
  • add FlutterMobileVision.start() to initState():
@override
void initState() {
  super.initState();
  FlutterMobileVision.start().then((x) => setState(() {}));
}

or for a better implementation:

@override
void initState() {
  super.initState();
  FlutterMobileVision.start().then((previewSizes) => setState(() {
    _previewBarcode = previewSizes[_cameraBarcode].first;
    _previewOcr = previewSizes[_cameraOcr].first;
    _previewFace = previewSizes[_cameraFace].first;
  }));
}

Barcode

//...
List<Barcode> barcodes = [];
try {
  barcodes = await FlutterMobileVision.scan(
    flash: _torchBarcode,
    autoFocus: _autoFocusBarcode,
    formats: _onlyFormatBarcode,
    multiple: _multipleBarcode,
    waitTap: _waitTapBarcode,
    showText: _showTextBarcode,
    preview: _previewBarcode,
    camera: _cameraBarcode,
    fps: 15.0,
  );
} on Exception {
  barcodes.add(new Barcode('Failed to get barcode.'));
}
//...

Android

For Android, you must do the following before you can use the plugin:

  • Add the camera permission to your AndroidManifest.xml

    <uses-feature android:name="android.hardware.camera" />

    <uses-permission android:name="android.permission.CAMERA" />

  • Add the Barcode activity to your AndroidManifest.xml (after other activity nodes)

    <activity android:name="io.github.edufolly.fluttermobilevision.barcode.BarcodeCaptureActivity" />

iOS

If you can help, the community thanks. Your fork is needed. πŸ˜‰


OCR

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

Android

For Android, you must do the following before you can use the plugin:

  • Add the camera permission to your AndroidManifest.xml

    <uses-feature android:name="android.hardware.camera" />

    <uses-permission android:name="android.permission.CAMERA" />

  • Add the OCR activity to your AndroidManifest.xml (after other activity nodes)

    <activity android:name="io.github.edufolly.fluttermobilevision.ocr.OcrCaptureActivity" />

iOS

If you can help, the community thanks. Your fork is needed. πŸ˜‰


Face Detection

//...
List<Face> faces = [];
try {
  faces = await FlutterMobileVision.face(
    flash: _torchFace,
    autoFocus: _autoFocusFace,
    multiple: _multipleFace,
    showText: _showTextFace,
    preview: _previewFace,
    camera: _cameraFace,
    fps: 15.0,
  );
} on Exception {
  faces.add(new Face(-1));
}
//...

Android

For Android, you must do the following before you can use the plugin:

  • Add the camera permission to your AndroidManifest.xml

    <uses-feature android:name="android.hardware.camera" />

    <uses-permission android:name="android.permission.CAMERA" />

  • Add the Face Detection activity to your AndroidManifest.xml (after other activity nodes)

    <activity android:name="io.github.edufolly.fluttermobilevision.face.FaceCaptureActivity" />

iOS

If you can help, the community thanks. Your fork is needed. πŸ˜‰

flutter_mobile_vision's People

Contributors

andytwoods avatar artob avatar codacy-badger avatar cybaker avatar edufolly avatar g123k avatar trancanhluc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flutter_mobile_vision's Issues

Camera event

It would be very good if we can add the widgets or at least that you specify a few labels over the camera event.

Because now user cannot know that he needs to click on the screen.

OCR Video insted camera

Is it possible to use a video instead of the camera? (In this case i want to use a stream video)

Android Errors Out on Front Camera Landscape

I'm running the package on a Lenovo tablet and using the barcode scanning feature. I am using the front camera and noticed that when the tablet is in landscape mode with the front camera at the top of the device the app errors out when scanning with the following in the debug console:

W/DynamiteModule(22489): Local module descriptor class for com.google.android.gms.vision.dynamite not found. I/DynamiteModule(22489): Considering local module com.google.android.gms.vision.dynamite:0 and remote module com.google.android.gms.vision.dynamite:1800 I/DynamiteModule(22489): Selected remote version of com.google.android.gms.vision.dynamite, version >= 1800 I/Vision (22489): Loading library libbarhopper.so I/Vision (22489): libbarhopper.so library load status: true D/AndroidRuntime(22489): Shutting down VM E/AndroidRuntime(22489): FATAL EXCEPTION: main E/AndroidRuntime(22489): Process: com.example.billoflading, PID: 22489 E/AndroidRuntime(22489): java.lang.RuntimeException: set display orientation failed E/AndroidRuntime(22489): at android.hardware.Camera.setDisplayOrientation(Native Method) E/AndroidRuntime(22489): at io.github.edufolly.fluttermobilevision.ui.CameraSource.setRotation(CameraSource.java:1032) E/AndroidRuntime(22489): at io.github.edufolly.fluttermobilevision.ui.CameraSource.createCamera(CameraSource.java:784) E/AndroidRuntime(22489): at io.github.edufolly.fluttermobilevision.ui.CameraSource.start(CameraSource.java:384) E/AndroidRuntime(22489): at io.github.edufolly.fluttermobilevision.ui.CameraSourcePreview.startIfReady(CameraSourcePreview.java:97) E/AndroidRuntime(22489): at io.github.edufolly.fluttermobilevision.ui.CameraSourcePreview.access$200(CameraSourcePreview.java:35) E/AndroidRuntime(22489): at io.github.edufolly.fluttermobilevision.ui.CameraSourcePreview$SurfaceCallback.surfaceCreated(CameraSourcePreview.java:121) E/AndroidRuntime(22489): at android.view.SurfaceView.updateWindow(SurfaceView.java:632) E/AndroidRuntime(22489): at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:162) E/AndroidRuntime(22489): at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:944) E/AndroidRuntime(22489): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2205) E/AndroidRuntime(22489): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1254) E/AndroidRuntime(22489): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6343) E/AndroidRuntime(22489): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:874) E/AndroidRuntime(22489): at android.view.Choreographer.doCallbacks(Choreographer.java:686) E/AndroidRuntime(22489): at android.view.Choreographer.doFrame(Choreographer.java:621) E/AndroidRuntime(22489): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:860) E/AndroidRuntime(22489): at android.os.Handler.handleCallback(Handler.java:751) E/AndroidRuntime(22489): at android.os.Handler.dispatchMessage(Handler.java:95) E/AndroidRuntime(22489): at android.os.Looper.loop(Looper.java:154) E/AndroidRuntime(22489): at android.app.ActivityThread.main(ActivityThread.java:6119) E/AndroidRuntime(22489): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(22489): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) E/AndroidRuntime(22489): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

This doesn't happen when using the back camera, or when using any other orientation with the front camera. For example, when scanning with the front camera in landscape mode and the camera at the bottom of the tablet, it does not error out.

Any ideas?

OCR - get stream of texts instead of one result

how can I achieve a stream of texts instead of the "onTap" thing..

I want to interpret the stream and then depending on the results and filtering, continue or stop the "ocr read".

thanks!

IllegalStateException

Possibly related to #7 - except it happens when permission is granted. It crashes the first time (when the permission dialog is there), and then it works just fine.

java.lang.RuntimeException: 
  at android.app.ActivityThread.deliverResults (ActivityThread.java:4360)
  at android.app.ActivityThread.handleSendResult (ActivityThread.java:4402)
  at android.app.servertransaction.ActivityResultItem.execute (ActivityResultItem.java:49)
  at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:108)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:68)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1808)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:193)
  at android.app.ActivityThread.main (ActivityThread.java:6669)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:858)
Caused by: java.lang.IllegalStateException: 
  at io.flutter.view.FlutterNativeView$1.reply (FlutterNativeView.java:174)
  at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error (MethodChannel.java:199)
  at io.github.edufolly.fluttermobilevision.FlutterMobileVisionPlugin.onActivityResult (FlutterMobileVisionPlugin.java:188)
  at io.flutter.app.FlutterPluginRegistry.onActivityResult (FlutterPluginRegistry.java:210)
  at io.flutter.app.FlutterActivityDelegate.onActivityResult (FlutterActivityDelegate.java:139)
  at io.flutter.app.FlutterActivity.onActivityResult (FlutterActivity.java:138)
  at android.app.Activity.dispatchActivityResult (Activity.java:7454)
  at android.app.ActivityThread.deliverResults (ActivityThread.java:4353)
  Future scan() async {
    List<Barcode> barcodes = [];
    try {
      barcodes = await FlutterMobileVision.scan(
        fps: 15.0,
      );
      SharedPreferences prefs = await SharedPreferences.getInstance();
      prefs.setString("usr_idNumber", barcodes[0].rawValue);
      setState(() {
        id_number = barcodes[0].rawValue;
      });
    } on Exception {
      setState(() {
              errorText = "An error occured.";
            });
      barcodes.add(new Barcode('Failed to get barcode.'));
    }
  }

QR code scan & face recognition not working for sm-p901 tablet

I have tried the app on my android sm-p901 tablet with API lollipop but only the barcode san was working .The same code worked on the rest of my devices .So I don't know whats the problem .I tried the actual functionalities separately on other apps and they where working .

OCR - tracking box

Please how do I make a moving box stable, lets say positioned at the centre thus making a specified dimension box to recognize every text that passes through other than tracking every word the camera captures?

Idea

It would be cool to our the text , Google translate it and reconstitute it back on the image.

Not easy because the text length will change. I think the ocr API gives back the text box dimensions. Not sure how to calculate the dimensions of the translated text. It can probably be gotten at the dart layer though.
Dart libs for doing the image compositing are pretty good now I think.

Anyway just an idea I had...

GraphicOverlay.java uses unchecked or unsafe operations

After adding this package to a Flutter project, flutter run outputs -Xlint:deprecation and -Xlint:unchecked warnings from the Java compilation:

$ flutter run
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...                                       4.9s
Resolving dependencies...                                    3.3s
Running 'gradlew assembleDebug'...                               
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: ~/.pub-cache/hosted/pub.dartlang.org/flutter_mobile_vision-0.1.1/android/src/main/java/io/github/edufolly/fluttermobilevision/ui/GraphicOverlay.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Built build/app/outputs/apk/debug/app-debug.apk.
Installing build/app/outputs/apk/app.apk...                  3.4s
Syncing files to device Android SDK built for x86...             

Ideally, these complaints could be fixed or at least silenced such that the new user experience for this package doesn't raise undue concerns and red flags.

ηœŸζœΊθ°ƒθ―•ζ— ζ³•θ°ƒη”¨η›ΈζœΊ

W/DynamiteModule( 1782): Local module descriptor class for com.google.android.gms.vision.dynamite.ocr not found.
W/DynamiteModule( 1782): Failed to retrieve remote module version.
W/GooglePlayServicesUtil( 1782): Google Play Store is missing.
I/DynamiteModule( 1782): Considering local module com.google.android.gms.vision.dynamite.ocr:0 and remote module com.google.android.gms.vision.dynamite.ocr:0
W/GooglePlayServicesUtil( 1782): Google Play Store is missing.
W/DynamiteModule( 1782): Local module descriptor class for com.google.android.gms.vision.ocr not found.
I/DynamiteModule( 1782): Considering local module com.google.android.gms.vision.ocr:0 and remote module com.google.android.gms.vision.ocr:0
E/Vision ( 1782): Error loading module com.google.android.gms.vision.ocr optional module true: com.google.android.gms.dynamite.DynamiteModule$LoadingException: No acceptable module found. Local version is 0 and remote version is 0.
I/SendBroadcastPermission( 1782): action:com.google.android.gms.vision.DEPENDENCY, mPermissionType:0
W/TextNativeHandle( 1782): Native handle not yet available. Reverting to no-op handle.
W/DynamiteModule( 1782): Local module descriptor class for com.google.android.gms.vision.dynamite.ocr not found.
W/GooglePlayServicesUtil( 1782): Google Play Store is missing.
I/DynamiteModule( 1782): Considering local module com.google.android.gms.vision.dynamite.ocr:0 and remote module com.google.android.gms.vision.dynamite.ocr:0
W/GooglePlayServicesUtil( 1782): Google Play Store is missing.
W/DynamiteModule( 1782): Local module descriptor class for com.google.android.gms.vision.ocr not found.
I/DynamiteModule( 1782): Considering local module com.google.android.gms.vision.ocr:0 and remote module com.google.android.gms.vision.ocr:0

when starting to scan, it crashes

Future<Null> _scan() async { List<Barcode> barcodes = []; try { barcodes = await FlutterMobileVision.scan( autoFocus: true, formats: Barcode.QR_CODE, multiple: true, showText: true, fps: 15.0, ); } on Exception { barcodes.add(Barcode('Failed to get barcode.')); } }

and it is being called from a button onclick event.

Not working with USB Webcams

I was just wondering how to make it work with webcams as the library only works with Front and Back Cameras of the device.
Can anyone suggest me how to do it?

Screenshots

It would be awesome If you could get screenshot from your activity.

Filed to install Package

Failed to reinstall 1 package:

  • flutter_mobile_vision 0.1.3
    pub finished with exit code 69

I was getting some issues so I didi a cache repair and got this, any ideas?

Equal sign " = " not recognized by OCR on android

When recognizing text using the OCR function equal signs seem to not be detected at all. On rare occasions when the equal signs are in between alphanumeric characters the equal signs are recognized as " - " characters which is wrong.

Fail to connect to camera service

Hi,
I use version 0.1.3.
One of my user got crashed, please find a log below:

Fatal Exception: java.lang.RuntimeException: Fail to connect to camera service
at android.hardware.Camera.(Camera.java:542)
at android.hardware.Camera.open(Camera.java:378)
at io.github.edufolly.fluttermobilevision.ui.CameraSource.createCamera(Unknown Source)
at io.github.edufolly.fluttermobilevision.ui.CameraSource.release(Unknown Source)
at io.github.edufolly.fluttermobilevision.ui.CameraSourcePreview.startIfReady(Unknown Source)
at io.github.edufolly.fluttermobilevision.ui.CameraSourcePreview.start(Unknown Source)
at io.github.edufolly.fluttermobilevision.ui.CameraSourcePreview$SurfaceCallback.surfaceCreated(Unknown Source)
at android.view.SurfaceView.updateWindow(SurfaceView.java:580)
at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:176)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:944)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2144)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1189)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6243)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:773)
at android.view.Choreographer.doCallbacks(Choreographer.java:586)
at android.view.Choreographer.doFrame(Choreographer.java:556)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:759)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:160)
at android.app.ActivityThread.main(ActivityThread.java:5541)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:964)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:759)

My flutter:

[βœ“] Flutter (Channel beta, v1.0.0, on Mac OS X 10.13.6 17G65, locale en-ID)
β€’ Flutter version 1.0.0 at /Users/raymond.rulin/flutter
β€’ Framework revision 5391447fae (7 weeks ago), 2018-11-29 19:41:26 -0800
β€’ Engine revision 7375a0f414
β€’ Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

I see the report it happened at Oppo A37f with Android version 5.1.1.
Other works fine so far.
Thank you for your help :)

Run camera inside a box?

Hi, insteed of open a new activity, is possible to start Camera for example inside a box in my flutter homePage like an iframe?

Thanks

Face Recognition

Hi,

Thanks for the plugin and demo. I am wondering when we can implement the Face Recognition in both iOS and android flutter app? When detected faces how to get Face coordinates as Face Recognition. and save it to sql database or firebase database? Thanks

Migration to MLKit?

Hello,

You are currently Google Mobile Vision, which is now part of MLKit.
Do you plan to switch to MLKit instead anytime soon?

Thanks

Crash when the permission is not granted on Android

Hello,

On Android, the first time the application is opened (or if the camera permission is never granted), the app will crash.

In the onActivityResult method, if the resultCode is an error, you are never checking if the intent is null. In the case where the permission is not granted, the intent is null, so the app will crash.

Does this package supports android 6?

I tried using the application with my phone with android 6 it doesn't open camera and say unable to recognize but it is working with android version 7. Can you guide me for its solution.

Deprecation warnings

Hi! When build an apk with your lib i got 22 warnings like this

[deprecation] Camera in android.hardware has been deprecated
import android.hardware.Camera; 

[deprecation] Camera in android.hardware has been deprecated
                .setFlashMode(useFlash ? Camera.Parameters.FLASH_MODE_TORCH : null)

Deny Camera Permission crashed the app

Hi,
I found out that if I deny permission for camera, it will crash.
Please find the log below
Thank you

java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=9010, result=13, data=null} to activity {.MainActivity}: java.lang.IllegalStateException: Reply already submitted
        at android.app.ActivityThread.deliverResults(ActivityThread.java:4196)
        at android.app.ActivityThread.handleSendResult(ActivityThread.java:4239)
        at android.app.ActivityThread.-wrap20(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1599)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:165)
        at android.app.ActivityThread.main(ActivityThread.java:6365)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:883)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
     Caused by: java.lang.IllegalStateException: Reply already submitted
        at io.flutter.view.FlutterNativeView$1.reply(FlutterNativeView.java:174)
        at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error(MethodChannel.java:199)
        at io.github.edufolly.fluttermobilevision.FlutterMobileVisionPlugin.onActivityResult(FlutterMobileVisionPlugin.java:188)
        at io.flutter.app.FlutterPluginRegistry.onActivityResult(FlutterPluginRegistry.java:210)
        at io.flutter.app.FlutterActivityDelegate.onActivityResult(FlutterActivityDelegate.java:139)
        at io.flutter.app.FlutterActivity.onActivityResult(FlutterActivity.java:138)
        at android.app.Activity.dispatchActivityResult(Activity.java:7116)

save detected face

can i save detected face as image or get face as base64 to send it to api

Failed to run debug mode after install package

I've installed flutter_mobile_vision: 0.1.3.
I run 'package get'.
And then I get these errors while running.

C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\util\AbstractCaptureActivity.java:9: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
^
symbol: class ActivityCompat
location: package android.support.v4.app
C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\barcode\BarcodeUpdateListener.java:3: error: package android.support.annotation does not exist
import android.support.annotation.UiThread;
^
C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:28: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
^
C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:29: error: package android.support.annotation does not exist
import android.support.annotation.RequiresPermission;
^
C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:30: error: package android.support.annotation does not exist
import android.support.annotation.StringDef;
^
C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSourcePreview.java:22: error: package android.support.annotation does not exist
import android.support.annotation.RequiresPermission;
^
C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\FlutterMobileVisionPlugin.java:8: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
^
symbol: class ActivityCompat
location: package android.support.v4.app
C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\FlutterMobileVisionPlugin.java:9: error: package android.support.v4.content does not exist
import android.support.v4.content.ContextCompat;
^
C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:147: error: cannot find symbol
@stringdef({
^
symbol: class StringDef
location: class CameraSource
C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:160: error: cannot find symbol
@stringdef({
^
symbol: class StringDef
location: class CameraSource
C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\barcode\BarcodeUpdateListener.java:9: error: cannot find symbol
@UiThread
^
symbol: class UiThread
location: interface BarcodeUpdateListener
C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:344: error: cannot find symbol
@RequiresPermission(Manifest.permission.CAMERA)
^
symbol: class RequiresPermission
location: class CameraSource
C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:379: error: cannot find symbol
@RequiresPermission(Manifest.permission.CAMERA)
^
symbol: class RequiresPermission
location: class CameraSource
C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:534: error: cannot find symbol
@nullable
^
symbol: class Nullable
location: class CameraSource
C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:574: error: cannot find symbol
@nullable
^
symbol: class Nullable
location: class CameraSource
C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:622: error: cannot find symbol
public void autoFocus(@nullable AutoFocusCallback cb) {
^
symbol: class Nullable
location: class CameraSource
C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:659: error: cannot find symbol
public boolean setAutoFocusMoveCallback(@nullable AutoFocusMoveCallback cb) {
^
symbol: class Nullable
location: class CameraSource
C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSourcePreview.java:57: error: cannot find symbol
@RequiresPermission(Manifest.permission.CAMERA)
^
symbol: class RequiresPermission
location: class CameraSourcePreview
C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSourcePreview.java:73: error: cannot find symbol
@RequiresPermission(Manifest.permission.CAMERA)
^
symbol: class RequiresPermission
location: class CameraSourcePreview
C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSourcePreview.java:94: error: cannot find symbol
@RequiresPermission(Manifest.permission.CAMERA)
^
symbol: class RequiresPermission
location: class CameraSourcePreview
C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\util\AbstractCaptureActivity.java:83: error: cannot find symbol
int rc = ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA);
^
symbol: variable ActivityCompat
location: class AbstractCaptureActivity
where T is a type-variable:
T extends Graphic declared in class AbstractCaptureActivity
C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\FlutterMobileVisionPlugin.java:149: error: cannot find symbol
if (ContextCompat.checkSelfPermission(registrar.activity(),
^
symbol: variable ContextCompat
location: class FlutterMobileVisionPlugin
C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\FlutterMobileVisionPlugin.java:153: error: cannot find symbol
ActivityCompat.requestPermissions(registrar.activity(),
^
symbol: variable ActivityCompat
location: class FlutterMobileVisionPlugin
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
23 errors

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':flutter_mobile_vision:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 13s


The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See https://goo.gl/CP92wY for more information on the problem and how to fix it.


Finished with error: Gradle task assembleDebug failed with exit code 1

Goole API Key & Scan Limit

How can I input the google vision API Key.
If not, then how many time limited for successful recorded?

OCR Method always returning the exception

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

OCR from file

The current implementation only allows to use the camera.
I don't know if the mobile vision on android has such kind of API, but it would be lovely to do OCR from image files from the phone.

I really appreciate your work :)

Cannot Run After Install

I just add this plugin into my flutter project, I need the OCR plugin, I followed instruction like in Usage section, but I got this error when I start run my project.

Launching lib\main.dart on Mi A2 Lite in debug mode...
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\util\AbstractCaptureActivity.java:9: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
                             ^
  symbol:   class ActivityCompat
  location: package android.support.v4.app
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\barcode\BarcodeUpdateListener.java:3: error: package android.support.annotation does not exist
import android.support.annotation.UiThread;
                                 ^
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:28: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
                                 ^
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:29: error: package android.support.annotation does not exist
import android.support.annotation.RequiresPermission;
                                 ^
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:30: error: package android.support.annotation does not exist
import android.support.annotation.StringDef;
                                 ^
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSourcePreview.java:22: error: package android.support.annotation does not exist
import android.support.annotation.RequiresPermission;
                                 ^
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\FlutterMobileVisionPlugin.java:8: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
                             ^
  symbol:   class ActivityCompat
  location: package android.support.v4.app

C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\FlutterMobileVisionPlugin.java:9: error: package android.support.v4.content does not exist
import android.support.v4.content.ContextCompat;
                                 ^
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:147: error: cannot find symbol

    @StringDef({
     ^

  symbol:   class StringDef
  location: class CameraSource
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:160: error: cannot find symbol
    @StringDef({
     ^
  symbol:   class StringDef
  location: class CameraSource
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\barcode\BarcodeUpdateListener.java:9: error: cannot find symbol
    @UiThread
     ^
  symbol:   class UiThread
  location: interface BarcodeUpdateListener
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:344: error: cannot find symbol
    @RequiresPermission(Manifest.permission.CAMERA)
     ^
  symbol:   class RequiresPermission
  location: class CameraSource
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:379: error: cannot find symbol
    @RequiresPermission(Manifest.permission.CAMERA)
     ^
  symbol:   class RequiresPermission

  location: class CameraSource

C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:534: error: cannot find symbol
    @Nullable
     ^
  symbol:   class Nullable
  location: class CameraSource
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:574: error: cannot find symbol
    @Nullable

     ^
  symbol:   class Nullable
  location: class CameraSource
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:622: error: cannot find symbol
    public void autoFocus(@Nullable AutoFocusCallback cb) {
                           ^
  symbol:   class Nullable
  location: class CameraSource
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:659: error: cannot find symbol
    public boolean setAutoFocusMoveCallback(@Nullable AutoFocusMoveCallback cb) {
                                             ^
  symbol:   class Nullable
  location: class CameraSource
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSourcePreview.java:57: error: cannot find symbol
    @RequiresPermission(Manifest.permission.CAMERA)
     ^

  symbol:   class RequiresPermission
  location: class CameraSourcePreview
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSourcePreview.java:73: error: cannot find symbol
    @RequiresPermission(Manifest.permission.CAMERA)
     ^
  symbol:   class RequiresPermission
  location: class CameraSourcePreview
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSourcePreview.java:94: error: cannot find symbol
    @RequiresPermission(Manifest.permission.CAMERA)
     ^

  symbol:   class RequiresPermission
  location: class CameraSourcePreview
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\util\AbstractCaptureActivity.java:83: error: cannot find symbol
            int rc = ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA);
                     ^
  symbol:   variable ActivityCompat
  location: class AbstractCaptureActivity<T>
  where T is a type-variable:
    T extends Graphic declared in class AbstractCaptureActivity
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\FlutterMobileVisionPlugin.java:149: error: cannot find symbol
                if (ContextCompat.checkSelfPermission(registrar.activity(),
                    ^
  symbol:   variable ContextCompat
  location: class FlutterMobileVisionPlugin
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\FlutterMobileVisionPlugin.java:153: error: cannot find symbol
                    ActivityCompat.requestPermissions(registrar.activity(),
                    ^
  symbol:   variable ActivityCompat
  location: class FlutterMobileVisionPlugin
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
23 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':flutter_mobile_vision:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org

BUILD FAILED in 9s
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See https://goo.gl/CP92wY for more information on the problem and how to fix it.
*******************************************************************************************
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

Is there something I've wrong or something I need to do to run with this plugins properly?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.