Nov 012018
 

A depth camera measures the distance from the camera to a point in 3D space. For a given point, the camera supplies the row and column on its ‘screen’ and the depth towards the point. It is worth pointing out here that classic depth cameras like the Kinect supply the length of the ray; RealSense cameras supply the range, or Z component.

Calculating the coordinates of the point is fairly straightforward trigonometry. Suppose a D435 camera is mounted 500mm off the ground, pointing at the horizon. 1000mm away there is an object 101.5mm high:

To warm up, the camera’s vertical field of view is 56°, so at 1’000mm half of the height is

    \[1000*tan(56/2)=531.7mm\]

The camera has 480 rows, so it will see the 101.5mm-high object at row

    \[((480-1)/2)+(-398.5)/531.7*((480-1)/2)=row\ 60\]

Bonus: It sees the object at an angle of

    \[Atan⁡(398.5/1000)=-21.7^\circ\]

Now we define constants for the Fx intrinsics, the centre row and the height of a pixel:

    \[VFov2=VFov/2\]

    \[VSize=Tan(VFov2)*2\]

    \[VCentre=(Rows-1)/2\]

    \[VPixel=VSize/(Rows-1)\]

    \[VRatio=(VCentre-row)*VPixel\]

    \[Y=Range*-VRatio\]

Notice the ‘Rows-1’ because there are 479 intervals between 480 pixels: row 239 points just under the horizon and row 240 points just above the horizon.

Then, for the example above we define our constants:

    \[VFov2=56/2=28\]

    \[VSize=Tan(28)*2=1.0634\]

    \[VCentre=(480-1)/2=239.5\]

    \[VPixel=1.0634/(480-1)=0.00222\]

and calculate the Y coordinate:

    \[VRatio=(239.5-60)*0.00222=0.3985\]

    \[Y=1000*-VRatio=-398.5 mm\]

The calculations for the X-coordinate are identical, replacing ‘Vertical’ with ‘Horizontal’ and Z is simply the supplied range.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

*