feat: read signs from the rear camera too - #19
Merged
Merged
Conversation
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.
The front camera only helps when you are the one signing. If a Deaf person is signing to you — the actual situation this app exists for — you need the rear camera pointed at them.
The part that would have broken quietly
MediaPipe reports handedness for a mirrored view, which is what a selfie camera gives: its
Leftis the signer's right hand. The rear camera is not mirrored, so that mapping inverts.Get it wrong and nothing errors. Every hand is silently swapped, and because
normalizeHandmirrors left hands into the right hand's space, two-handed signs arrive at the model reflected. Extracted tohandednessFor(label, facing)and tested — including a test asserting the two cameras disagree for the same label, so the fix cannot be undone without a red test.The same reasoning applies to the overlay: the canvas is mirrored to match the video, so both un-mirror together or the skeleton lands on the wrong side of the screen.
Restarting the stream rather than reconfiguring it is deliberate —
getUserMediacannot changefacingModeon a live track, and phones expose the two cameras as separate devices.