# Revision history [back]

### How to convert stereo camera distances, pixels to mm

Hello.

I calibrated and stereo-parallelized the stereo camera.I would like to know how to find the coefficient to convert from pixels to mm.

From the Q matrix obtained by stereo rectification, Tx: baseline and f: focal length were determined. As you know, the depth z is found by the following formula

z = Bf/(x-x') z:[pixels]

However, the units of z obtained from this formula are pixels. A factor k[mm/pixel] is needed to convert it to mm. Then the equation is as follows

z = (Bf/(x-x'))*k z:[mm]

Is there a smart way to find this coefficient k? Please use something other than how to actually measure z several times to derive k, or how to examine the pitch pixels of the camera's image sensor.

In the case of HALCON, I was able to find it by a function instead of using the method described above.

Couldn't it be calculated from the camera and Q matrices obtained from calibration and stereo parallelization? Thank you.