refactor: Enhance image format validation and optimize InputImage con…#847
Open
bensonarafat wants to merge 3 commits intoflutter-ml:testfrom
Open
refactor: Enhance image format validation and optimize InputImage con…#847bensonarafat wants to merge 3 commits intoflutter-ml:testfrom
bensonarafat wants to merge 3 commits intoflutter-ml:testfrom
Conversation
…ods for better resource management
Collaborator
Author
There was a problem hiding this comment.
Pull request overview
This PR refactors Android-side InputImage creation to broaden supported camera image formats (notably YUV_420_888) and updates the example camera view to validate/prepare multi-plane image bytes.
Changes:
- Update multiple Android detectors to create an
InputImageConverterper request and close it when ML Kit processing completes. - Extend
InputImageConverterto handle additional byte-based image formats, including a newYUV_420_888path. - Update the example
camera_view.dartto accept more Android formats and to concatenate bytes from multi-planeCameraImages.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/google_mlkit_text_recognition/android/src/main/kotlin/com/google_mlkit_text_recognition/TextRecognizer.kt | Switches to per-call converter instance and closes on completion. |
| packages/google_mlkit_subject_segmentation/android/src/main/kotlin/com/google_mlkit_subject_segmentation/SubjectSegmenter.kt | Switches to per-call converter instance and closes on completion. |
| packages/google_mlkit_selfie_segmentation/android/src/main/kotlin/com/google_mlkit_selfie_segmentation/SelfieSegmenter.kt | Switches to per-call converter instance and closes on completion. |
| packages/google_mlkit_pose_detection/android/src/main/kotlin/com/google_mlkit_pose_detection/PoseDetector.kt | Switches to per-call converter instance and closes on completion. |
| packages/google_mlkit_face_mesh_detection/android/src/main/kotlin/com/google_mlkit_face_mesh_detection/FaceMeshDetector.kt | Switches to per-call converter instance and closes on completion. |
| packages/google_mlkit_face_detection/android/src/main/kotlin/com/google_mlkit_face_detection/FaceDetector.kt | Switches to per-call converter instance and closes on completion. |
| packages/google_mlkit_barcode_scanning/android/src/main/kotlin/com/google_mlkit_barcode_scanning/BarcodeScanner.kt | Switches to per-call converter instance and closes on completion. |
| packages/google_mlkit_commons/android/src/main/kotlin/com/google_mlkit_commons/InputImageConverter.kt | Adds new byte-format handling (incl. YUV_420_888) and introduces closeable resources. |
| packages/example/lib/vision_detector_views/camera_view.dart | Expands Android format validation and concatenates multi-plane bytes for InputImage.fromBytes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...google_mlkit_commons/android/src/main/kotlin/com/google_mlkit_commons/InputImageConverter.kt
Outdated
Show resolved
Hide resolved
...text_recognition/android/src/main/kotlin/com/google_mlkit_text_recognition/TextRecognizer.kt
Outdated
Show resolved
Hide resolved
...text_recognition/android/src/main/kotlin/com/google_mlkit_text_recognition/TextRecognizer.kt
Outdated
Show resolved
Hide resolved
...google_mlkit_commons/android/src/main/kotlin/com/google_mlkit_commons/InputImageConverter.kt
Outdated
Show resolved
Hide resolved
...gmentation/android/src/main/kotlin/com/google_mlkit_subject_segmentation/SubjectSegmenter.kt
Outdated
Show resolved
Hide resolved
...barcode_scanning/android/src/main/kotlin/com/google_mlkit_barcode_scanning/BarcodeScanner.kt
Outdated
Show resolved
Hide resolved
...google_mlkit_commons/android/src/main/kotlin/com/google_mlkit_commons/InputImageConverter.kt
Outdated
Show resolved
Hide resolved
...mlkit_pose_detection/android/src/main/kotlin/com/google_mlkit_pose_detection/PoseDetector.kt
Outdated
Show resolved
Hide resolved
Collaborator
|
@bensonarafat : address Copilot's comments |
…code, selfie segmentation, and subject segmentation classes
Collaborator
Author
|
@fbernaly |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…version