def focal_length(image_width, image_height, fov):
"""Calculate focal length in the x and y axis from:
- image width
- image height
- field of view
Parameters
----------
image_width : int
Image width
image_height : int
Image height
fov : float
Field of view
Returns
-------
(fx, fy) : (float, float)
Focal length in x and y axis
"""
fx = (image_width / 2.0) / tan(deg2rad(fov) / 2.0)
fy = (image_height / 2.0) / tan(deg2rad(fov) / 2.0)
return (fx, fy)
评论列表
文章目录