Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add depth to Frame #3328

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

feat: Add depth to Frame #3328

wants to merge 8 commits into from

Conversation

mrousavy
Copy link
Owner

@mrousavy mrousavy commented Dec 11, 2024

What

TL;DR: Adds Frame.depth, a nullable CMSampleBuffer that holds depth data.

If enableDepthData is true (a prop passed to <Camera>), the Camera will be configured to set up a depth data output pipeline in addition to the video data output pipeline.
Ontop of that, a synchronizer output is created to sync depth data and video data buffers together for timestamps.

const device = Camera.getAvailableCameraDevices().find((d) => d.formats.some((f) => f.supportsDepthCapture))
const format = useCameraFormat(device, [{ depth: true }])

const fp = useFrameProcessor((frame) => {
  'worklet'
  console.log(frame.depth)
})

if (device == null) throw new Error(`Device does not support depth data!`)
return (
  <Camera
    device={device}
    format={format}
    enableDepthData={true}
    video={true}
    frameProcessor={fp}
  />
)

Changes

Tested on

Related issues

Copy link

vercel bot commented Dec 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-native-vision-camera ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 13, 2024 1:27pm

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