Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Live preview #679

Closed
wants to merge 32 commits into from
Closed

Conversation

dustin-graham
Copy link

@dustin-graham dustin-graham commented Jul 20, 2018

Fixes #19274. flutter/flutter#19274

Currently this PR has working code but is still pretty raw. I think the shape of the solution is getting close, but there is a lot of uncleaned code and some outstanding defects.

Android: barcode detector boundaries are wrong
iOS: MLKit detector doesn't work when preview image is not landscape
Android: Live text detection block boundaries are wrong.
iOS: utilizing some iOS 10 APIs, need to find iOS 8 work-arounds

The barcode implementation is left very basic as I'm told that someone else is working on a more full-featured implementation at this time.

@bparrishMines This is a starting point. I'd appreciate any feedback and guidance you can provide.

The implementation was pulled from several sources:
Android Live Preview ML Kit reference: https://github.com/firebase/quickstart-android/tree/master/mlkit
iOS Live Preview ML Kit reference: https://github.com/firebase/quickstart-ios
Android & iOS flutter camera implementation: Flutter camera plugin

Note that there are two implementations on Android with camera2 and the legacy camera API. I need some guidance on which to use for this effort.

Remaining Tasks:

  • Android runtime permission handling (camera)
  • iOS rotation + detector problem. (detector does not work properly unless video preview is in landscape)
  • Unify Android camera implementation(s).
  • Remove capture functionality from iOS camera implementation

Android only for now. pulled impl from camera flutter plugin.
make stream handling more appealing
this is in preparation to integrate ML Kit recognition of frames.
not yet returning any data to the Flutter app.
defect: preview image is not oriented correctly. detector does not
work properly when the preview image is oriented correctly.
screen coordinates are still not translating properly
refactor detectors so that we can send messages back to flutter on
Results and Sinks
there are some defects on both platforms that need to be resolved.
Android & iOS: barcode detector boundaries are wrong
iOS: MLKit detector doesn't work when preview image is not landscape
Android: Live text detection block boundaries are off.
iOS: utilizing some iOS 10 APIs, need to find iOS 8 work-arounds
@dustin-graham
Copy link
Author

working on merging with upstream changes now.

# Conflicts:
#	packages/firebase_ml_vision/android/src/main/java/io/flutter/plugins/firebasemlvision/BarcodeDetector.java
#	packages/firebase_ml_vision/android/src/main/java/io/flutter/plugins/firebasemlvision/Detector.java
#	packages/firebase_ml_vision/android/src/main/java/io/flutter/plugins/firebasemlvision/FaceDetector.java
#	packages/firebase_ml_vision/android/src/main/java/io/flutter/plugins/firebasemlvision/FirebaseMlVisionPlugin.java
#	packages/firebase_ml_vision/android/src/main/java/io/flutter/plugins/firebasemlvision/LabelDetector.java
#	packages/firebase_ml_vision/android/src/main/java/io/flutter/plugins/firebasemlvision/TextDetector.java
#	packages/firebase_ml_vision/example/lib/detector_painters.dart
#	packages/firebase_ml_vision/example/lib/main.dart
#	packages/firebase_ml_vision/ios/Classes/BarcodeDetector.m
#	packages/firebase_ml_vision/ios/Classes/FaceDetector.m
#	packages/firebase_ml_vision/ios/Classes/FirebaseMlVisionPlugin.h
#	packages/firebase_ml_vision/ios/Classes/FirebaseMlVisionPlugin.m
#	packages/firebase_ml_vision/ios/Classes/TextDetector.m
#	packages/firebase_ml_vision/lib/src/barcode_detector.dart
# Conflicts:
#	packages/firebase_ml_vision/android/build.gradle
#	packages/firebase_ml_vision/example/android/build.gradle
also, fix two errors in BarcodeDetector.java:
  - TYPE_DRIVER_LICENSE barcodeMap key copy/paste error
  - TYPE_CALENDAR_EVENT typeValue not entered into barcodeMap
@dustin-graham
Copy link
Author

@bparrishMines I'm struggling with code formatting. I'm reading that flutter_plugin_tools requires clang-format v5. The only version I can get from homebrew is 7 and it formats my code differently than the CI is expecting. I exported the google .clang-format file that is used when the formatter type is set to google and it disagrees with how this CI system formats ObjectiveC code. I have to assume that it's because I'm running v7 and not v5. I don't know how to get v5, can you please advise?

# Conflicts:
#	packages/firebase_ml_vision/android/src/main/java/io/flutter/plugins/firebasemlvision/BarcodeDetector.java
#	packages/firebase_ml_vision/android/src/main/java/io/flutter/plugins/firebasemlvision/LabelDetector.java
#	packages/firebase_ml_vision/ios/Classes/FirebaseMlVisionPlugin.m
#	packages/firebase_ml_vision/ios/Classes/LabelDetector.m
#	packages/firebase_ml_vision/lib/src/firebase_vision.dart
@goderbauer
Copy link
Member

@dustin-graham Does this comment help you with regards to formatting? flutter/flutter#12864 (comment)

@dustin-graham
Copy link
Author

@goderbauer Thank you very much.

@bhammer88
Copy link

How is this project going along? I'm kinda interested to learn this, and hope it can help me in making a document scanner in flutter

@bbofrk
Copy link

bbofrk commented Nov 13, 2018

Hi @dustin-graham thanks for your work. I am one of the many few that is very excited about this, just wondering if there is any update?

@gimox
Copy link

gimox commented Feb 16, 2019

any news?

@bparrishMines
Copy link
Contributor

Hi @dustin-graham,

I'm going to go ahead and close this PR since we are going a different direction with a Live camera view with ML Kit.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants