edufolly / flutter_mobile_vision

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

Add Optional ScanArea GraphicOverlay and Detection Filtering for OCR #66

Open SamuelHaws opened 3 years ago

SamuelHaws commented 3 years ago

Allows users to specify the width and height of a rectangular "scan area" when calling FlutterMobileVision methods, like so: FlutterMobileVision.read(camera: _ocrCamera, waitTap: true, scanArea: Size(400, 250));

Default scan area size is Size(0,0). When starting the CameraSourcePreview, a check is ran on scanArea dimensions. If either width or height is zero, the actual scanArea graphic is not added to the ScanAreaOverlay. The presence of this graphic is checked in OcrGraphicTracker. If a scan area graphic is found, text graphics will only be tracked / added to overlay if they are within the scan area. If no scan area graphic is found, the OCR detector operates on default behavior.

Admittedly, I have only used this forked version using FlutterMobileVision.read(...) with OCR. Additional testing is necessary with other methods (scan, face, etc.) and vision activities (barcode, face, etc.). However, I needed this feature for my own usage, and have seen several Issues associated with requests for this feature. Hopefully this is a good start for those who wish to make use of such a feature. Example screenshot of scan area

edufolly commented 3 years ago

Nice @SamuelHaws, I'll revise asap.

SamuelHaws commented 3 years ago

While this PR is under review, if anyone would like to try it out on their own, you can point your pubspec.yaml to my fork like so:

flutter_mobile_vision:
    git:
      url: https://github.com/SamuelHaws/flutter_mobile_vision

After adding the above dependency, you may need to run flutter pub upgrade and flutter clean.

nicolasknz commented 3 years ago

Important feature, shoud be implemented @edufolly

ghost commented 3 years ago

Please make a pull request to https://github.com/harrowmykel/flutter_mobile_vision_2

He already migrated the plugin to non null.

https://pub.dev/packages/flutter_mobile_vision_2

ghost commented 3 years ago

Thanks @SamuelHaws . Your code has been implemented in the new version at https://github.com/harrowmykel/flutter_mobile_vision_2