Skip to content

refactor: Enhance image format validation and optimize InputImage con…#847

Open
bensonarafat wants to merge 3 commits intoflutter-ml:testfrom
bensonarafat:fix_yuv_420
Open

refactor: Enhance image format validation and optimize InputImage con…#847
bensonarafat wants to merge 3 commits intoflutter-ml:testfrom
bensonarafat:fix_yuv_420

Conversation

@bensonarafat
Copy link
Collaborator

…version

@bensonarafat bensonarafat marked this pull request as ready for review February 27, 2026 11:57
@bensonarafat
Copy link
Collaborator Author

bensonarafat commented Feb 27, 2026

@fbernaly
Here is the Updated PR
And I am closing #732

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 InputImageConverter per request and close it when ML Kit processing completes.
  • Extend InputImageConverter to handle additional byte-based image formats, including a new YUV_420_888 path.
  • Update the example camera_view.dart to accept more Android formats and to concatenate bytes from multi-plane CameraImages.

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.

@fbernaly
Copy link
Collaborator

@bensonarafat : address Copilot's comments

…code, selfie segmentation, and subject segmentation classes
@bensonarafat
Copy link
Collaborator Author

@fbernaly
You can review it again or ask @copilot code review[agent]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants