Items with no label
3338 Discussions

GetDistance(x,y) vs Pixel depth

OHoel
Beginner
3,668 Views

(Developing project using D415, C# and Unity (but not using the unity wrapper))

 

I'm getting a bit confused about what exactly the GetDistance() function returns...

I have my sensor fixed ~2m high, looking down vertically and I'd like to retrieve height of each pixels compared to the ground. To get there, should I use:

  • 2 - depthFrame.GetDistance(x,y)
  • 2 - depthFrame[x,y] * depthScale
  • depthFrame -> point cloud; 2-Points[x,y].z
  • Any of the above

It is not clear in the documentation or within the examples if the GetDistance() function returns the corrected depth of a specified pixel, or the distance to the camera sensors...

 

Thanks for advice !

0 Kudos
1 Solution
MartyG
Honored Contributor III
3,194 Views

It is easier to find search results relevant to what you need if you search for 'pixel depth' instead of 'pixel height'.

 

Example code for getting the pixel depth in meters in the SDK's documentation suggests using get_distance(x,y), though it is the nature of programming that multiple approaches to the problem will be valid, depending on how you prefer to approach the problem.

 

https://github.com/IntelRealSense/librealsense/wiki/Projection-in-RealSense-SDK-2.0#depth-image-formats

 

You may find this C# and Unity coordinates tutorial for the 400 Series cameras useful:

 

https://lightbuzz.com/intel-realsense-coordinate-mapping/

View solution in original post

0 Kudos
2 Replies
MartyG
Honored Contributor III
3,195 Views

It is easier to find search results relevant to what you need if you search for 'pixel depth' instead of 'pixel height'.

 

Example code for getting the pixel depth in meters in the SDK's documentation suggests using get_distance(x,y), though it is the nature of programming that multiple approaches to the problem will be valid, depending on how you prefer to approach the problem.

 

https://github.com/IntelRealSense/librealsense/wiki/Projection-in-RealSense-SDK-2.0#depth-image-formats

 

You may find this C# and Unity coordinates tutorial for the 400 Series cameras useful:

 

https://lightbuzz.com/intel-realsense-coordinate-mapping/

0 Kudos
OHoel
Beginner
3,194 Views

Thanks !

Looking at the second link you sent answered my first question: GetDistance(x,y) returns the distance to the camera plane (so the Z coordinate of the reconstructed 3D point) and not the distance to projection center (i.e. magnitude of camera->point vector).

0 Kudos
Reply