Items with no label
3335 Discussions

How to get usable depth values for calculation?

MWalz1
Beginner
1,111 Views

Dear Intel® RealSense Community,

I am a mechanical engineer at a Chinese robot company. My current task is to get the Intel® RealSense R200 to work. Our use cases would be real-time obstacle avoidance and 3D mapping. So I am currently trying to get usable depth values from the camera's raw data, which I can use for calculation (e.g. X=420 Y=120 Z=1.23234). But unfortunately from the example source code files I can't figure out how to get access to these values. Maybe you can help me?

I know that I need to initialize the camera with a valid configuration first. And I should use a separated thread for running the stream handling. So far I can follow the code. But my programming skills are lacking of deeper knowledge to understand how the image processing is working. Maybe you could explain it to me?

Thank you a lot!

Best Regards,

Martin

0 Kudos
5 Replies
MartyG
Honored Contributor III
202 Views

In the '2016 R2' Windows SDK, the instruction ProjectDepthToCamera can be used to map depth coordinates to the world coordinates.

https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?projectdepthtocamera_pxcprojection.html Intel® RealSense™ SDK 2016 R2 Documentation

If you need the reverse of this process, ProjectCameraToDepth maps world coordinates to the depth.

https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?projectcameratodepth_pxcprojection.html Intel® RealSense™ SDK 2016 R2 Documentation

0 Kudos
MWalz1
Beginner
202 Views

Hi Marty,

Thank you for your answer. https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?projectdepthtocamera_pxcprojection.html ProjectDepthToCamera seems to be a good choice. Unfortunately, I don't know how to call this function. I always get an error when I try to compile this:

PXCMPoint3DF32[] pos_uvz;

PXCMPoint3DF32[] pos3d;

PXCMProjection.ProjectDepthToCamera(pos_uvz, pos3d);

I am pretty sure I am using the function in a wrong way…

Besides this, am I right when I assume that this function returns the XYZ world coordinates from XY depth picture coordinates? This means I put a captured 3D frame and XY coordinates (pixel) into that function and it returns the XYZ world coordinates? Maybe you can tell me an example project where I can see the use of a PXCMProjection?

Thanks for supporting me!

Best regards,

Martin

0 Kudos
MartyG
Honored Contributor III
202 Views

You are very welcome, Martin!

ProjectDepthToCamera would return the depth coordinates based on the world coordinates. If you wanted the XYZ world coordinates, you would use the ProjectCameraToDepth instruction instead.

I see your script is in the C# language (PXCM), whereas a C++ script would be PXC.

I do not know of a C# script for ProjectDepthToCamera, but there is a C++ script. You may be able to get some useful indicators from that.

https://software.intel.com/en-us/forums/realsense/topic/604114 ProjectDepthToCamera

0 Kudos
MWalz1
Beginner
202 Views

Hi Marty,

So far I think I got it now. But in the example he uses PCL (= http://www.pointclouds.org/ Point Cloud Library), which seems to be already included into the RealSense SDK. When I try to compile the code I either can successfully include the RSSDK or the PCL. Both together seems to overwrite some of the other's functions. Any ideas? Can I use the RSSDK's PCL functions?

Also I now use C++

Best regards,

Martin

0 Kudos
MartyG
Honored Contributor III
202 Views

The article below describes using point clouds with the RealSense SDK:

https://software.intel.com/en-us/articles/intel-realsense-technology-and-the-point-cloud Archived - Intel® RealSense™ Technology and the Point Cloud | Intel® Software

0 Kudos
Reply