How to compute intrinsic camera matrix for a camera

The intrinsic camera matrix is useful in depth cameras to obtain the 3D position of any given pixel in the camera coordinate system. The pinhole camera model used for the intrinsic camera matrix is explained beautifully here.

The intrinsic camera matrix is of the form:

f_x s   x
0   f_y y
0   0   1

Here, f_x and f_y are the focal lengths of the camera in the X and Y directions. s is the axis skew and is usually 0. x and y are the X and Y dimensions of the image produced by the camera, measured from the center of the image. (So, they are half the length and width of the image.)

We typically know the dimensions of the image produced by the camera. What is typically not provided are the focal lengths. Instead camera manufacturers provide the field of view (FOV) angle in the horizontal and vertical directions.

Using the FOV angles, the focal lengths can be computed using trigonometry. For example, given the FOV a_x in the horizontal direction, the focal length f_x can be computed using:

f_x = x / tan(a_x / 2)

We divide the FOV by 2 because this angle spans the entire horizontal or vertical view.

As an example, consider the Primesense Carmine 1.09 depth camera. It produces a VGA (640×480) image. Its specifications state a horizontal FOV of 57.5 degrees and vertical FOV of 45 degrees.

Using the above information, we can compute its intrinsic camera matrix as:

583.2829786373293 0.0               320.0
0.0               579.4112549695428 240.0
0.0               0.0               1.0
Advertisements

2 thoughts on “How to compute intrinsic camera matrix for a camera”

  1. Hello. This is really useful. So for a new image of width x and height y, is there a way to calculate a useable FOV for x and y? What is a_x and a_y for a random image, of unknown origin?

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s