-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[camera_android_camerax] Fix NV21 Format #10022
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is directly inspired by this camera_android code that came from Google MLKit. I made some changes the methods to (1) take in the objects I want and (2) for planesToNV21, I worked off of yuv420ThreePlanesToNV21 but deleted lots of logic and added an exception. So, I'm not sure what to do here....
Should I also link to https://github.com/googlesamples/mlkit/blob/master/android/vision-quickstart/app/src/main/java/com/google/mlkit/vision/demo/BitmapUtils.java and call it a day or are there more license implications?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stuartmorgan-g Do you know what we should do in cases like this by chance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I also link to https://github.com/googlesamples/mlkit/blob/master/android/vision-quickstart/app/src/main/java/com/google/mlkit/vision/demo/BitmapUtils.java and call it a day or are there more license implications?
Third-party code cannot be handled that way; the camera_android
code shouldn't have landed like that (unless it had OSPO approval), so it should definitely not be replicated, and the old code should be fixed.
The standard way to handle this would be:
- Land it in a
third_party
directory, with the correct license. - Include that license in the package LICENSE file.
However, because it is specifically Google that has the copyright on that code, it may be that there are simpler options. I would reach out to OSPO and ask how this should be handled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the guidance! Reached out to OSPO and they let me know that if our code is derived from code authored by Googlers or contributed to a Google-managed open source project under the terms of Google's contributor license agreement, then I can treat the code as though we wrote it ourselves.
Because the BitmapUtils.java
code comes from mlkit/android/vision-quickstart that is licensed under the aforementioned agreement, I think I am okay to use it without reference to the original code. I will go ahead and make edits to accommodate this fact and also make a follow-up PR to remove the reference from camera_android
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just FYI: I did send an email back with my intentions just to sanity check my decision here!
Edit: They confirmed this is the right move 👍
…t` code (#10056) Remove references to [mlkit/android/vision-quickstart](https://github.com/googlesamples/mlkit/tree/master/android/vision-quickstart) as per my findings in #10022 (comment). ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
Updating brach to pick up the license format check change, since this adds new files. The new files will need to be updated to match the new header boilerplate. |
When NV21 image format is requested for streaming images, this PR ensures that:
CameraImagePlane
created has overridden raw and camera image format NV21.*This should make this package compatible with google_ml_kit_flutter 🤞 I tested this change with the Barcode scanner example. Fixes flutter/flutter#174923.
*The conversion will fail if the image is actually not NV21 compatible for some reason, so this should never be a false positive.
Note: Uses code inspired by googlesamples/mlkit.
Pre-Review Checklist
[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assist
bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2 ↩3