-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
ARKit TrueDepth front facing camera depth map #615
Comments
You can get ARKit's ARFrame pointer with ARFoundation. If you are willing to write Objective-C code to get at the ARFrame's capturedDepthData, then you should have no problem accessing it. |
@tdmowrer I posted an issue earlier this year trying to do something very similar: #517 The final question which was never solved was if there is any available documentation or code to convert |
You can get the |
As I mentioned in the previous issue, it would be great to use a function like |
The bulk of the usefulness of the image converter is combining dual-channel video stream into an RGB image, which isn't relevant to depth data. What transformations to you want to apply? |
I'm looking to convert a I could use a similar technique to the old ARKit for Unity plugin by converting it to a Metal texture and updating it through an external Unity texture. But it is not clear if this is the best method or if AR Foundation is using a more efficient technique. And again, it would be nice to keep the extension consistent with how AR Foundation works. |
That makes sense, but that is not what the XRCpuImage does.
That is exactly what we do in ARFoundation.
I'm not sure what ARFoundation API you are expecting to be able to use. If your goal is to get a |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Thanks for confirming @tdmowrer. If I get around to making the extension I will post it here. However with depth cameras becoming more and more prevalent on XR devices AR Foundation should probably have a proper unified way of accessing depth maps, especially since they are not always going to be "environment depth". |
I would love this feature too - being able to get the front depth map as we can currently with the rear view would be very useful. I've given a try at working on some kind of plugin as @tdmowrer hinted, but I got lost converting the ARFrame depthdata into something that can be used within Unity. @sam598 did you manage to sort this issue? |
@momorprods it ain't pretty, but it works. TrueDepthMap.mm
TrueDepthMap.cs
The original UnityARKitPlugin has some async methods I took out to try and make sure that the depth frame is converted as soon as Unity receives the color frame. Because this workaround is a strange ping-pong loop I'm sure the AR Foundation team could make a version that is more efficient and safe. Keep in mind that current iOS devices run at about 60hz on the front facing color camera, while the true depth camera runs at about 15hz, so only 1 out of every 4 frames will have depth data. |
OMG you made my day @sam598 👍 🥇 |
Thank you so much @sam598 it works as expected! Unity people, please do integrate this natively in Unity. |
Thanks for the script! Unity, please expose depth information from the face camera as well! It's a shame ARKit doesn't do this and certain functionality is limited by-camera-basis, but would be a great feature in ARFoundation without using native code, especially if it's possible with certain ease. |
Unity, please please please integrate the depth map on the ARKit/iphone forward camera. It works for Android. I have an app that uses the Android depth map on forward camera, which is supported by AR Foundation. Seem logical to keep the platforms in sync and that it should be integrated for ARKit too. Don't want to have to wait until all my users iphones have lidar to implement the app. Many thx, KnewK |
@knewk May I ask for a sample of how you did that for the front facing camera on android? We are trying to accomplish the same |
Can you outline how you got this to work. Sample scene perhaps. I can't seem to get any depth image to display to a raw image. Set AR Session, AR Camera Manager and Raw Image components but no luck. |
AR Core Depth Lab on github has been converted to AR Foundation using AR Core Extensions for AR Foundation. Instructions in the hub. https://github.com/googlesamples/arcore-depth-lab |
@sam598 @momorprods @cecarlsen @sek19 Can you please help me how to set this up in order to recieve depth data from true depth sensor?
Can you please provide a demo project. I need help getting real-time depth in unity |
@knewk @alithediscover did you ever manage to get TrueDepth from the user facing cam (using this method or another?). I am also getting no data. |
ARKit provides access to the depth map from the TrueDepth camera. ARFoundation provides access to depth maps from the rear facing camera (if available) but not the front facing camera.
Currently the only way to access the TrueDepth camera's depth map in Unity is to modify the objective-c source of the deprecated ARKit Unity plugin. That plugin has also been deleted by Unity and is no longer accessible (see #190).
The text was updated successfully, but these errors were encountered: