Preview coordinate mapping + Object Detector example (0.0.6) - #4
Merged
Conversation
CameraController.previewRectFromFrame(rect, sourceRotationDegrees:) converts a normalized box from a frame's coordinate space into preview-display space, accounting for the live previewRotation and the front-camera mirror. The preview rotation and frame orientation are tracked independently, so ML overlays drawn without this drift as the device turns. Adds a unit test + README section. (0.0.6)
FFI frame pipeline → YUV→RGB preprocessing → on-device EfficientDet-Lite0 (90 COCO classes) in a background isolate → labelled boxes via previewRectFromFrame, plus a cat-certainty voting trigger. Bundled model is git-tracked but .pubignored from the published package. Adds kotlin.jvm.target.validation.mode=warning for tflite_flutter.
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.
Adds
CameraController.previewRectFromFrame(rect, sourceRotationDegrees:)— maps a normalized detection box from a frame's coordinate space into preview-display space (rotation + front mirror), so ML overlays track the preview at any device orientation. Root cause: the preview rotation and frame orientation are tracked independently (verified on-device:previewRotationstays display-locked whileframe.orientationfollows the physical angle).Example: a real-time Object Detector page drives EfficientDet-Lite0 (90 COCO classes) over the FFI frame pipeline in a background isolate, with labelled boxes + a cat-certainty trigger. Device-verified on Pixel 8 (detection + boxes tracking through rotation). Both platforms build; 14 unit tests pass.