Items with no label
3335 Discussions

Given a ply file from D435, how to retrieve distances in meters between points and camera POV?

NCacc
Beginner
2,364 Views

Hi everyone! I was successfully able to export a ply file from my D435 using Pyrealsense 2, now I want to measure some distances among points belonging to the pointcloud and the POV (also the distance between the camera frame plane and the point is ok) of the camera, but I'm missing some informations.

  • I want to know this distance in meters, how can I retrieve it?

My approach:

I know that i can get the depth scale:

pipeline = rs.pipeline() profile = pipeline.start(config) depth_sensor = profile.get_device().first_depth_sensor() depth_scale = depth_sensor.get_depth_scale()

and I read (somewhere, apologise I can't recover the link) that depth_scale*depth_pixel_value=distance_in_meters (is this right? PLEASE CONFIRM), I then assume that my "depth_pixel_value" is the Z coordinate of the point.

So my final attempt to measure distance between point and camera frame plane is:

- choose the point

- extract the Z coordinate, retrieve the data in meters

- assume tht the POV of the camera is the origin (0,0,0) (is this right? PLEASE CONFIRM)

- calculate the distance using the difference between 0 and the vale in meters of the Z coordinate.

does this make sense?

  • (assuming the previous point is correct) What if I want to know the distances in meters of all the coordinates (not only Z) of all the points of the pointcloud ?

 

Hope I've been clear in my request, seeking for answer! cheers

0 Kudos
1 Solution
Alexandra_C_Intel
1,553 Views
Hi NCacc, The exported PLY file contains points that were created using the pointcloud.calculate() function which returns points with coordinates that are expressed in meters. See this write-up for more details on Points coordinates: https://github.com/IntelRealSense/librealsense/wiki/Projection-in-RealSense-SDK-2.0#point-coordinates. Regards, Alexandra

View solution in original post

4 Replies
Alexandra_C_Intel
1,553 Views
Hi NCacc. Thank you for your interest in the Intel RealSense D435 camera. To get the distance values, you can run the code here: https://github.com/IntelRealSense/librealsense/tree/master/examples/C/distance You may find more information on how to retrieve the intrinsic parameters here: https://github.com/IntelRealSense/librealsense/wiki/Projection-in-RealSense-SDK-2.0 Regards, Alexandra
0 Kudos
NCacc
Beginner
1,553 Views

Thank you for the quick reply, but I still have no answer for what I asked.

I'm working with ply files, in this format for every point i have three coordinates, e.g. for a point p I have p[x]=0.5, p[y]=0.41, p[z]=0.21, with your link I realized that the origin (0,0,0) is the left imager but I still miss how to retrieve the position of point p in meters [m].

  • Are the coordinates already in meters?
  • if not, how can I find a proper scale to have data in meters?

 

The example in C you provided relates to distance taken from frames, but I don't know how data in ply files are treated.

0 Kudos
Alexandra_C_Intel
1,554 Views
Hi NCacc, The exported PLY file contains points that were created using the pointcloud.calculate() function which returns points with coordinates that are expressed in meters. See this write-up for more details on Points coordinates: https://github.com/IntelRealSense/librealsense/wiki/Projection-in-RealSense-SDK-2.0#point-coordinates. Regards, Alexandra
NCacc
Beginner
1,553 Views

ok perfect, thank for your patience! ^^

0 Kudos
Reply