Skip to content

Preview coordinate mapping + Object Detector example (0.0.6) - #4

Merged
JenteJan merged 2 commits into
mainfrom
feat/preview-coordinate-mapping
Jun 27, 2026
Merged

Preview coordinate mapping + Object Detector example (0.0.6)#4
JenteJan merged 2 commits into
mainfrom
feat/preview-coordinate-mapping

Conversation

@JenteJan

Copy link
Copy Markdown
Owner

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: previewRotation stays display-locked while frame.orientation follows 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.

JenteJan added 2 commits June 27, 2026 23:44
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.
@JenteJan
JenteJan merged commit e2be943 into main Jun 27, 2026
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.

1 participant