Technical - How do I find the vertical Field of View

July 31, 2012 - 1:11pm #1

Sometimes it is necessary to find the field of view of the camera, especially when integrating with third party rendering engines. This can be calculated from the CameraCalibration size and focal length parameters. This article describes the relationship between field of view and focal length: http://paulbourke.net/miscellaneous/lens/

 

Here's a code snippet for finding the vertical field of view:

const QCAR::CameraCalibration& cameraCalibration =
                            QCAR::CameraDevice::getInstance().getCameraCalibration();

QCAR::Vec2F size = cameraCalibration.getSize();
QCAR::Vec2F focalLength = cameraCalibration.getFocalLength();

float fovRadians = 2 * atan(0.5f * size.data[1] / focalLength.data[1]);
float fovDegrees = fovRadians * 180.0f / M_PI;

 

Topic locked