Getting distance from depth map

Forgive me if this is a silly question but I just found there is something wrong with what I think of this.

image

In the playground, I think the black part should be yellow but they are not.
The left point and the center point have different distance to camera but they have same depth value, it is strange for me.

1 Like

Hello :slight_smile:

It’s the normal behavior of OpenGL based rendering, and by the way that’s why it’s called “Depth”. Best way to understand this is taking the camera as a boat over the see :

The “Depth” is indeed the same for points A and B, even if the distance is not the same. Depth map is a depth map, not a distance map.


Now, if you need the distance you can easily create a function depth_to_distance which compute distance from depth map. It’s just a matter of trigonometric cosinus computation, using the FOV of the camera, the image size, and the 2D coordinates of the considered point :slight_smile:

++
Tricotou

4 Likes

Thanks for your explainations! I’ve made a playground that work.

2 Likes