Ask Your Question

Focal length from calibration parameters

asked 2017-04-10 23:26:22 -0500

Sarat gravatar image

updated 2017-04-11 02:34:04 -0500

pklab gravatar image

I am trying to calibrate my camera (sony alpha 6000 20mm lens) using open CV. In the parameters list, I can find the focal length coefficient as 5192. How can I calculate the corresponding focal length from that ?

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2017-04-11 02:32:59 -0500

pklab gravatar image

You already know the focal lengths is 20mm, but you might want to compare/check calibration results.

In camera matrix the focal lengths fx,fy are expressed in pixel units. To convert focals in World units Fx, Fy you need sensor size in same units using similar triangle

Fx = fx * W /w or Fy = fy * H /h


  • W: is the sensor width expressed in world units, let's say mm
  • w: is the image width expressed in pixel
  • fx: is the focal length expressed in pixel units (as is in the camera matrix )

Your Sony α6000 is 6000x4000pix and sensor size is 23.5 x 15.6mm hence:

Fx = fx * W /w = 5192pix * 23.5mm / 6000pix = 20.33mm
Fy = fy * H /h =  5192pix * 15.6mm / 4000pix = 20.25mm

At the end your calibration looks good

edit flag offensive delete link more


I am trying to solve the same problem but I do not know the camera sensor width (W) nor height (H). The camera I am using is the built-in back camera of the Samsung Galaxy A5 (2015). The only information I found are the focal length (3.69 mm), the focal length 35mm (28mm) and the image resolution is 2448x3264. Is there any way to transform the intrinsic matrix from pixel to world unit using these info? Extracting the ratios W/w and H/h by doing W/w = Fx/fx seems odd to me because I am assuming that Fx=Fy=3.69mm.

lcit gravatar imagelcit ( 2017-05-30 04:25:07 -0500 )edit

To transform from pixel to world you need to know the object distance and orientation too. N pixels can refer to small near object or large far object, rotation of camera axis changes resulting size of same object at same distance

More in general, you need to calculate extrinsic parameter, rotation and translation matrix for the scene you are viewing. You can use some well know markers in the scene you are viewing. See real-world-camera-position-knowing-marker-geometry

pklab gravatar imagepklab ( 2017-05-31 02:14:46 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-04-10 23:26:22 -0500

Seen: 6,023 times

Last updated: Apr 11 '17