Camera angle of view from focal length

The camera angle of view can be calculated with trigonometry using the focal length and sensor width.

$${\theta \over 2} = \tan^{-1}\Biggl({{\frac{sw}{2}} \over {fl} }\Biggr)$$

Looking at the right triangle formed by the half of the full drawn triangle: half of the angle \(\theta\) is the inverse tangent of the fraction of half of the sensorwidth and focal length.

This simplifies to:

\(\theta = 2\tan^{-1}\biggl({{ sw }\over{ 2fl }}\biggr)\)

In VEX code:

float sensor_width;
float focal_length;

//radians
float aov = 2*atan( sensor_width / ( 2*focal_length ) );

//convert to degrees
aov *= 180/PI;
Previous
Previous

Group points inside camera view in Houdini with VEX (camera culling)

Next
Next

Get camera transform matrix and optical axis in Houdini