I have a course problem that asks to calculate the focal length of a camera with the following specifications:

  1. Field of view along the horizontal axis (X): 60 deg.
  2. Field of view along the vertical axis (Y): 45 deg.
  3. Image plane size: (640) pixels along X-axis and (480) pixels along Y-axis.

and it requires to compute the focal length (in pixels) along X-axis and Y-axis, and I don't know how to start.

  • \$\begingroup\$ What is the formula your course gave you for field (or angle) of view? \$\endgroup\$
    – scottbb
    Jul 26, 2020 at 17:39
  • \$\begingroup\$ Oh, I have searched and found One and it worked. Unfortunately, the course didn't discuss the focal length in-depth cause it is a part of perception for robotics. I'm now facing another problem actually if you have time :) \$\endgroup\$
    – Ammar Taha
    Jul 26, 2020 at 17:44
  • 4
    \$\begingroup\$ Expressing focal length in pixels is weird \$\endgroup\$
    – hpchavaz
    Jul 26, 2020 at 20:20
  • \$\begingroup\$ For computing Field of View, you must use the sensor dimensions in mm instead of pixels. The focal length is also in mm. \$\endgroup\$
    – WayneF
    Aug 3, 2020 at 14:31

3 Answers 3


To work such a problem you need to know the dimensions of the imagining chip. Chips with 480 x 640 and labeled VGA resolution and typically they are CCD’s containing 0.3 megapixels. Typical is a chip measuring 6.6mm height by 8.8mm length. Now using trigonometry we can compute the focal length of a lens that delivers a horizontal angle of view of 60° and a vertical angle of view of 45°.

This works out to 7.9mm focal length.


You can draw a right triangle from the center of the lens to the center of the sensor to the edge of the sensor. The angle at the lens is half the field of view. The leg opposite the angle is half the width of the sensor. The focal length is the other leg. You can find the focal length by trig. The two axes have inconsistent data, so will result in different focal lengths.


I wrote in the comment section then "Expressing focal length in pixels is weird"

After thinking about it, expressing the data in pixels has a kind of interest.

To answer the question:

With the following definition:

  • Aof: Angle of view
  • f: focal length
  • W: Sensor width H: Sensor height

From the formula:

tan(AoF/2) = (W/2) / f

=> f = W/2 / tan(Aof/2)

So in this case (Aof: 60°, W:640px):

f = 640px /2 / tan(60°/2) = 320 * sqrt(3) = 554.256px


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.