How do I convert focal length in pixels to millimeter (mm)?

j1897 picture j1897 · Aug 19, 2014 · Viewed 12.8k times · Source

I am using OpenCV calibration method to determine the focal length of my endoscope.

http://docs.opencv.org/doc/tutorials/calib3d/camera_calibration/camera_calibration.html

And I am getting a focal length which is in pixels. But I want this to be in millimeter and I do not know the sensor dimensions. How can I calculate the focal length in millimiter (mm)?

Answer

Zaphod picture Zaphod · Aug 19, 2014

Refer to this article, and this answer.

The intrinsic matrix contains 5 intrinsic parameters. These parameters encompass focal length, image format, and principal point. The parameters \alpha_{x} = f \cdot m_{x} and \alpha_{y} = f \cdot m_{y} represent focal length in terms of pixels, where m_{x} and m_{y} are the scale factors relating pixels to distance and f is the focal length in terms of distance.

So if you know the size of the sensor and hence the physical size of every pixel, you can derive the focal length in mm, albeit an approximation. Still best to look up the endoscope's datasheet if you need a more precise number.