Rendering a scene and writing the 'Z-buffer' into an EXR file using 'Blender Cycles', I get a depth map. That depth map differs from the depth map which is produced by 'Blender Render'. Given its shape, I was assuming that the depth map corresponds to the 'sight ray's length'. However, that did not work out.
I derived my formula as follows:
ys [px]: y-coordinate of the pixel
cy [px]: y-coordinate of the principal point.
d [m/px]: density, i.e. length / pixel on the camera sensor
(y_size [m] / y_size [px])
f [m]: focal length
zs [m]: length of the 'sight ray'
zc [m]: orthogonal distance to lense's plane
(z-coordinate in camera centered coordinates)
Then,
$$z_c=z_s\cos(\alpha)$$
assume
$$\alpha=\arctan\frac{(c_y-y_s)d}{f}$$
applying
$$\cos\arctan(x)=\frac{1}{\sqrt{1+x^2}}$$
delivers
$$z_c=\frac{fz_s}{\sqrt{f^2+(y_s-c_y)^2d^2}}$$
But, that does not seem to work out. What am I doing wrong? What would be the formula?