Depthmap definition

I want to calculate the 3D camera coordinates of a point using the 2D image coordinates, the depth information given by the ZED 2i camera and the intrinsic camera matrix. My problem is that I am not sure how the depth is encoded. I simply use the ZED SDK to generate a depth map. If I look at my object’s depthmap value, is it the distance to the object (d) or is it the z-coordinate in camera coordinates (z_c^{(P)})?

I upload an image illustrating my question. I am interested in object P (it is in the x-z plane with y=0 for simplicity). Does the depthmap encode the distance d or the camera z-coordinate?

Hi @KieDani,
You can find the formulas to compute these values here:

From what I understand, you want the point cloud information of a given point in the image. This is what the zed.retrieveMeasure method is for, and you can find an example of how to use it in our documentation: Using the Depth Sensing API - Stereolabs.

The depthmap would encode the d z_c distance, and the point cloud encodes the XYZ (or even XYZRGB) data.

Thank you for your answer.
By looking at the link you sent, I am pretty sure that the depthmap encodes z_c instead of d. See:

Z = depth value of the pixel (u,v) from the depth map
X = (( u - c_x) * Z) / (f_x)
Y = (( v - c_y) * Z) / (f_y)

This would not be correct if the depthmap encodes d.
Can you confirm that the depthmap encodes z_c?

Hi @KieDani,

I apologize, you are correct the depth map does indeed encode the z_c distance.