-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Get depth pixel to corresponding color pixel in Unity without aligning #12324
Comments
Hi @Niclas1997 One possible approach would be to call the C++ rs2_project_color_pixel_to_depth_pixel instruction from C# via JNI. Please see the comment at #5440 (comment) and the comments beneath it regarding doing so. An alternative approach would be a RealSense C# tutorial at the link below that has scripting under the Mapping 2D to 3D heading for transforming 2D XY coordinates to 3D XYZ coordinates. |
Thanks for the quick reply. The comment you linked talks about Android and Java, so I don't think that I can use JNI (Java Native Interface) for C#. The second link sadly doesn't help, because I want to project a pixel to another pixel and in the article it says that you should use align for that. Is there a reason why these mathematical helper functions are not a part of the C# and Unity wrapper? |
I see, #5440 began as a C# case and turned into an Android case. My apologies. I believe that an equivalent of the Android extrinsics script in that link would be one in the RealSense SDK's C# Cookbook page of C# example code at the link below that calculates the extrinsics between the depth and color streams in order to obtain and print XYZ instead of using depth-color alignment. C# is not as widely used a language for RealSense applications compared to C++ and Python, and its instructions for performing a particular action tend to be quite different compared to Python, where each C++ instruction should automatically have a Python equivalent. For this reason, a C# script for performing a certain function may not be available unless somebody has already written a script that demonstrates it. It is possible to access C++ instructions in the RealSense DLL library through the C# wrapper's Platform Invoke (pinvoke) system described at the link below. |
Hi @Niclas1997 Do you require further assistance with this case, please? Thanks! |
Hey @MartyG-RealSense,
Thank you and best Regards |
I cannot see any obvious problems in your code. Does it make a difference if your var d line is altered to use the structure of the C# Cookbook example that puts e on the outside of the bracket?
|
Hey, |
I am not able to test code on my computer, unfortunately. I do apologize. |
Hi @Niclas1997 Do you require further assistance with this case, please? Thanks! |
Case closed due to no further comments received. |
Issue Description
Hello,
I'm using the Realsense camera in Unity and try to get the depth pixel to the corresponding color pixel without aligning them. I can't align them, because I use the Vuforia framework and need the RGB stream for that. In Python and C++ there is a rs2_project_color_pixel_to_depth_pixel method, but I couldn't find it in the Unity package and not in the C# wrapper.
Does someone have an idea how I can get the depth pixel without aligning the streams in Unity or C#?
Can I compute it manually?
Or is it possible to align depth to color and then stop the color stream without losing the aligned depth stream?
Thanks in advance
The text was updated successfully, but these errors were encountered: