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

✨ Support depth data streaming #2628

Open
2 tasks done
mrousavy opened this issue Mar 4, 2024 · 5 comments
Open
2 tasks done

✨ Support depth data streaming #2628

mrousavy opened this issue Mar 4, 2024 · 5 comments
Labels
✨ feature Proposes a new feature or enhancement

Comments

@mrousavy
Copy link
Owner

mrousavy commented Mar 4, 2024

What feature or enhancement are you suggesting?

It would be great to have depth data streaming support in VisionCamera Frame Processor plugins.
Something like this:

const frameProcessor = useFrameProcessor((frame) => {
  'worklet'
  const depthData = frame.depth
  if (depth != null) {
    console.log(`Depth data: ${depth.width} x ${depth.height}`)
    const data = depth.toArrayBuffer() // <-- depth is also a `Frame`!
  }
}, [])

...assuming the CameraDevice supports depth data streaming (supportsDepthData)

What Platforms whould this feature/enhancement affect?

iOS, Android

Alternatives/Workarounds

Currently I need to create a custom fork of VisionCamera to add depth data streaming and synchronization (AVCaptureSynchronizedDepthData ) to it.

Also, @thomas-coldwell created a public PR for this here: #745

..but it is quite old already and would need an update.

On Android, there is no such thing as depth data streaming I think.

Additional information

@mrousavy mrousavy added the ✨ feature Proposes a new feature or enhancement label Mar 4, 2024
@thomas-coldwell
Copy link
Collaborator

Hey 👋 I have an updated depth implementation in a Vision Camera fork so I can add this here.

One important API consideration though is that the depth map returned from the LiDAR or TrueDepth camera on iOS is just a CVPixelBuffer - no CMSampleBuffer container. I've tried to create one but it never creates successfully due to there not being a compatible format description for the CMSampleBuffer for the depth pixel format. This means it can't be wrapped in a Frame HostObject itself and instead I just have a depthMap on the native Frame class and report a hasDepthMap on the Frame HostObject. Maybe there is a better approach here e.g. an ImageBuffer HostObject that can wrap the CVPixelBuffer and expose all of its properties in a similar way to the Frame setup with a CMSampleBuffer - wdyt?

@mrousavy
Copy link
Owner Author

mrousavy commented Mar 4, 2024

Yup, good idea - a minimal Frame instance that just holds pixels. I can reshape the API for that

@gianfelipe93
Copy link

any updates on this?

@lucasjohnston
Copy link

Hey @thomas-coldwell could you link your updated fork? 🙇

@harrigee
Copy link

harrigee commented Apr 23, 2024

@thomas-coldwell A link to the updated fork would be great :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ feature Proposes a new feature or enhancement
Projects
None yet
Development

No branches or pull requests

5 participants