Depth map values and their relative location

We use ZED 2i outdoors. The task is to determine the distance to two points on the ground and then calculate the distance between them. Specifically, to calculate the width of the roadway.

However, even the error in calculating the distance to a point on the road is currently around 10-15%. This is not even considering the calculated width of the road.

We came across a topic - Improving 3D Reconstruction and Distance Accuracy with ZED X Camera - #3 by MaelCap2

Quote from the support response: “Furthermore, please consider that you are not calculating an Euclidean distance, but you are retrieving the perpendicular distance of the ball from the camera sensor plane.”

But in the documentation ( Depth Sensing Overview - Stereolabs ) we read: “The distance is expressed in metric units (meters for example) and calculated from the back of the left eye of the camera to the scene object”

Questions:

  1. Please explain what are the values in the depth map?
  2. How to correctly get the Euclidean distance from the camera to a point on the image?
  3. How to measure euclidian distance between two point on image?

P.S. Tell me how to do this with a depth map. It’s not very convenient for us to use a point cloud, as we are using a self-written library in C++. However, if this is not possible, please provide guidance on using a point cloud.

The graphical representation is clearer to me. I drew a picture for understanding. Which distance is valid for depth image? x1,x2 or y1,y2

Hi @PaginDm
Welcome to the Stereolabs community.

The depth map contains the perpendicular distance of each pixel to the plane of the camera sensor.

You must calculate the value d = √(X²+Y²+Z²).
Where X, Y, and Z are the 3D coordinates of each point P(X,Y,Z) of the retrieved Point Cloud (not depth map).

You must apply the formula: d_1_2 = √((X1-X2)²+(Y1-Y2)²+(Z1-Z2)²).
Where the two points are identified as P1(X1,Y1,Z1) and P2(X2,Y2,Z2)

Thank you! Now I’m closer to right solution.
There is one more question.

Quote: ”Where X, Y, and Z are the 3D coordinates of each point P(X,Y,Z) of the retrieved Point Cloud (not depth map).”

Do I understand correctly - I can use this formules(https://support.stereolabs.com/hc/en-us/articles/4554115218711-How-can-I-convert-3D-world-coordinates-to-2D-image-coordinates-and-viceversa) with 2D-depth image(to get the 3D coordinates of an image pixel) instead of point cloud using?

Yes, you can use these formulas too.