how to calculate field of view of the camera from camera intrinsic matrix?
Asked Answered
I

2

20

I got camera intrinsic matrix and distortion parameters using camera calibration.

The unit of the focal length is pixels, i guess.

Then, how can i calculate field of view (along y) ?

Is this formula right?

double fov_y = 2*atan(height/2/fy)*180/CV_PI;

I'll use it to parameters of

gluPerspective()
Ironwork answered 12/10, 2016 at 7:34 Comment(0)
F
37

OpenCV has a function that does this. Looking at the implementation (available on GitHub) we have given an image with dimensions w x h and a camera matrix:

    camera intrinsic matrix

the equations for the field of view are:

field of view y    field of view x

Fanfaron answered 14/12, 2016 at 7:39 Comment(2)
what is fx and fy. what is cx and cyHarbison
I'll leave the explanation of those terms to the OpenCV documentation on Camera Calibration and 3D ReconstructionFanfaron
Y
2

In continuation of @mallwright's answer, here is a bit of Python/numpy code to compute the field of view from the image resolution and focal lengths (in pixels):

import numpy as np

# Prepare
w, h = 1280, 720
fx, fy = 1027.3, 1026.9

# Go
fov_x = np.rad2deg(2 * np.arctan2(w, 2 * fx))
fov_y = np.rad2deg(2 * np.arctan2(h, 2 * fy))

print("Field of View (degrees):")
print(f"  {fov_x = :.1f}\N{DEGREE SIGN}")
print(f"  {fov_y = :.1f}\N{DEGREE SIGN}")

Output:

Field of View (degrees):
  fov_x = 63.8°
  fov_y = 38.6°

Note that this assumes that the principal point is at the center of the image and that there is no distortion, see this answer.

Yellows answered 26/5, 2022 at 21:47 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.