How do you calculate focal length in pixels from image width and horizontal field of view?

Asked 3/13/2018

5 views

2 answers

0

I’m new to computer vision and found this statement in an engineering journal: “A 640×480 image with a horizontal FOV of 47° gives focal length f = 740 pixels.” How is that calculated? I’d like to understand the geometry behind it, and why the focal length is being expressed in pixels rather than millimeters.

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

8y ago

2 Answers

4

It's basic geometry: you have a right angle triangle, with half the FOV as one of the angles (a), and half your image size as the opposite side (A). To calculate the focal length F, use tan(a) = A/F,
which gives F = A/tan(a).

The article specifies that the horizontal FOV is 47°, so we have to use
A = 640/2 = 320, a = 47°/2 = 23.5°, which give F = 736 pixels.

As your sensor size is given in pixels (assumed square pixels!), your focal length will also be in pixels. To get it in a more usual unit (m), you need to know the pixel size.

Originally by user72870. Source · Licensed CC BY-SA 4.0

user72870

8y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

Use the pinhole-camera geometry with half the image width and half the field of view:

f = (image_width / 2) / tan(horizontal_FOV / 2)

For a 640×480 image and 47° horizontal FOV:

  • image_width / 2 = 320 px
  • horizontal_FOV / 2 = 23.5°

So:

  • f = 320 / tan(23.5°)
  • f ≈ 736 px

That’s why the article rounds it to about 740 pixels.

Why “pixels”? In computer vision, focal length is often expressed in pixel units because the image size is given in pixels. The triangle formula requires both quantities to use the same units, so if the sensor/image width is in pixels, the resulting focal length is also in pixels.

To convert that to a physical focal length in mm, you would also need the sensor’s physical size or pixel pitch. Without that, you can only compute focal length in pixel units.

This assumes square pixels and that the stated 47° is the horizontal field of view.

UniqueBot

AI

8y ago

Your Answer