Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: #1177 - new camera image getter with cropping feature #1184

Merged
merged 2 commits into from
Mar 6, 2022

Conversation

monsieurtanuki
Copy link
Contributor

New files:

  • abstract_camera_image_getter.dart: Abstract getter of Camera Image, for barcode scan.
  • camera_image_cropper.dart: Camera Image Cropper, in order to limit the barcode scan computations.
  • camera_image_full_getter.dart: Camera Image helper where we get the full image.

Impacted file:

  • ml_kit_scan_page.dart: now using new CameraImageFullGetter class - same full screen camera image capture as before for the moment.

What

  • preliminary work on the pre-scan cropping feature, while keeping the same full screen capture.
  • next step is to test the cropping feature IRW (which I cannot) - I guess the idea would be to put a new switch item in the dev mode

Part of

New files:
* `abstract_camera_image_getter.dart`: Abstract getter of Camera Image, for barcode scan.
* `camera_image_cropper.dart`: Camera Image Cropper, in order to limit the barcode scan computations.
* `camera_image_full_getter.dart`: Camera Image helper where we get the full image.

Impacted file:
* `ml_kit_scan_page.dart`: now using new `CameraImageFullGetter` class - same full screen camera image capture as before for the moment.
@monsieurtanuki monsieurtanuki requested a review from a team as a code owner March 5, 2022 18:27
@monsieurtanuki monsieurtanuki requested a review from M123-dev March 5, 2022 18:28
@teolemon teolemon added the 🤳🥫 Scan We need to be able to scan on low-end, old devices, even with a bad camera, connexion… label Mar 5, 2022
Impacted files:
* `ml_kit_scan_page.dart`: added optional scan / no scan options according to dev mode
* `user_preferences.dart`: added methods for dev mode int values
* `user_preferences_dev_mode.dart`: added a "scan mode" option on dev mode
@monsieurtanuki
Copy link
Contributor Author

@M123-dev ping
Capture d’écran 2022-03-06 à 12 34 05

Copy link
Member

@M123-dev M123-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks @monsieurtanuki

I can't say if there is a problem in the calculation part but it looks about right, now we have to test

);
}

@protected
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://api.flutter.dev/flutter/meta/protected-constant.html

Used to annotate an instance member in a class or mixin which is meant to be visible only within the declaring library, and to other instance members of the class or mixin, and their subtypes.

Looks to me like it's only usefull for libraries on pub.dev not for something private, but I could be wrong

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I read the link you've provided, I think you're right.
If I test, I see I'm right:
Capture d’écran 2022-03-06 à 21 16 15

@@ -39,6 +39,7 @@ class UserPreferencesDevMode extends AbstractUserPreferences {
static const String userPreferencesFlagLenientMatching = '__lenientMatching';
static const String userPreferencesFlagAdditionalButton =
'__additionalButtonOnProductPage';
static const String userPreferencesEnumScanMode = '__scanMode';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe to confuse with userPreferencesFlagUseMLKit

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed the confusion is possible: we're talking about scan parameters in both cases.
But I don't see how I could make it less confusing, and anyway it's the dev mode: things are not supposed to stay here forever.

@monsieurtanuki monsieurtanuki merged commit 341765f into openfoodfacts:develop Mar 6, 2022
@monsieurtanuki
Copy link
Contributor Author

@M123-dev Thank you for your review!
I hope we'll find the reason behind the smartphones heating up. Or perhaps we did find a new source of energy by mistake. That would be a good thing for the planet, and we surely could use some good news these days...

@teolemon teolemon mentioned this pull request Apr 4, 2022
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
camera dev mode 🤳 MLKit performance 🤳🥫 Scan We need to be able to scan on low-end, old devices, even with a bad camera, connexion… speed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants