一、前提与符号定义
设相机的内参矩阵为:
K=[fx0cx0fycy001] K = \begin{bmatrix} f_x & 0 & c_x \\ 0 & f_y & c_y \\ 0 & 0 & 1 \end{bmatrix} K=fx000fy0cxcy1
其中:
- fx,fyf_x, f_yfx,fy:以像素为单位的焦距(x 和 y 方向);
- cx,cyc_x, c_ycx,cy:主点(principal point),即光轴在图像平面上的投影坐标(单位:像素)。
图像分辨率为:
- 宽度:WWW(像素)
- 高度:HHH(像素)
我们假设相机遵循针孔成像模型(无畸变),这是标准 FOV 定义的基础。
二、几何模型回顾
在针孔模型中,成像平面位于焦距 fff 处(单位需一致)。当使用像素单位时,焦距 fx,fyf_x, f_yfx,fy 已隐含了像素尺寸信息。
从相机光心出发,到图像平面上某一点 (u,v)(u, v)(u,v) 的射线与光轴(z 轴)之间的夹角即为该方向的视角。
因此:
- 水平视场角(HFOV) 是从光轴向左到图像最左列(u=0u=0u=0)、向右到最右列(u=Wu=Wu=W)的总张角;
- 垂直视场角(VFOV) 是从光轴向上到最上行(v=0v=0v=0)、向下到最下行(v=Hv=Hv=H)的总张角。
三、精确视场角推导
1. 水平视场角(HFOV)
考虑图像平面上的 x 方向:
- 光轴对应 u=cxu = c_xu=cx
- 左边缘:u=0u = 0u=0,距离光轴的像素偏移为 cxc_xcx
- 右边缘:u=Wu = Wu=W,偏移为 W−cxW - c_xW−cx
在针孔模型中,角度由反正切函数给出:
θleft=arctan(cxfx),θright=arctan(W−cxfx) \theta_{\text{left}} = \arctan\left( \frac{c_x}{f_x} \right), \quad \theta_{\text{right}} = \arctan\left( \frac{W - c_x}{f_x} \right) θleft=arctan(fxcx),θright=arctan(fxW−cx)
因此,总水平视场角为两者之和:
HFOV=arctan(cxfx)+arctan(W−cxfx)(1) \boxed{ \text{HFOV} = \arctan\left( \frac{c_x}{f_x} \right) + \arctan\left( \frac{W - c_x}{f_x} \right) } \tag{1} HFOV=arctan(fxcx)+arctan(fxW−cx)(1)
若主点居中(cx=W/2c_x = W/2cx=W/2),则简化为:
HFOV=2arctan(W2fx) \text{HFOV} = 2 \arctan\left( \frac{W}{2 f_x} \right) HFOV=2arctan(2fxW)
2. 垂直视场角(VFOV)
同理,在 y 方向:
- 上边缘:v=0v = 0v=0,偏移 cyc_ycy
- 下边缘:v=Hv = Hv=H,偏移 H−cyH - c_yH−cy
θup=arctan(cyfy),θdown=arctan(H−cyfy) \theta_{\text{up}} = \arctan\left( \frac{c_y}{f_y} \right), \quad \theta_{\text{down}} = \arctan\left( \frac{H - c_y}{f_y} \right) θup=arctan(fycy),θdown=arctan(fyH−cy)
故:
VFOV=arctan(cyfy)+arctan(H−cyfy)(2) \boxed{ \text{VFOV} = \arctan\left( \frac{c_y}{f_y} \right) + \arctan\left( \frac{H - c_y}{f_y} \right) } \tag{2} VFOV=arctan(fycy)+arctan(fyH−cy)(2)
若 cy=H/2c_y = H/2cy=H/2,则:
VFOV=2arctan(H2fy) \text{VFOV} = 2 \arctan\left( \frac{H}{2 f_y} \right) VFOV=2arctan(2fyH)
四、对角线视场角(DFOV)——可选
若需对角线 FOV,通常近似使用平均焦距并基于图像对角线长度:
- 图像对角线半长(像素):
d=12W2+H2 d = \frac{1}{2} \sqrt{W^2 + H^2} d=21W2+H2 - 平均焦距(各向同性近似):
favg=fx+fy2 f_{\text{avg}} = \frac{f_x + f_y}{2} favg=2fx+fy
则:
DFOV≈2arctan(W2+H2/2favg)=2arctan(W2+H2fx+fy)(3) \boxed{ \text{DFOV} \approx 2 \arctan\left( \frac{\sqrt{W^2 + H^2}/2}{f_{\text{avg}}} \right) = 2 \arctan\left( \frac{\sqrt{W^2 + H^2}}{f_x + f_y} \right) } \tag{3} DFOV≈2arctan(favgW2+H2/2)=2arctan(fx+fyW2+H2)(3)
注意:此为近似。严格来说,对角线方向的焦距应沿该方向投影,但因 fx≈fyf_x \approx f_yfx≈fy 在多数相机中成立,上述近似足够实用。
五、关于畸变的说明
- 上述推导基于理想针孔模型。
- 实际镜头存在径向/切向畸变(如你提供的畸变参数),会导致图像边缘“拉伸”或“压缩”。
- 但视场角(FOV)的标准定义不包含畸变,它描述的是校正后(去畸变)图像的视角范围。
- 因此,FOV 计算仅依赖内参 KKK,无需畸变参数。
六、总结公式(通用形式)
给定:
- 内参 fx,fy,cx,cyf_x, f_y, c_x, c_yfx,fy,cx,cy
- 图像尺寸 W,HW, HW,H
则:
HFOV=arctan(cxfx)+arctan(W−cxfx)VFOV=arctan(cyfy)+arctan(H−cyfy) \begin{aligned} \text{HFOV} &= \arctan\left( \frac{c_x}{f_x} \right) + \arctan\left( \frac{W - c_x}{f_x} \right) \\ \text{VFOV} &= \arctan\left( \frac{c_y}{f_y} \right) + \arctan\left( \frac{H - c_y}{f_y} \right) \end{aligned} HFOVVFOV=arctan(fxcx)+arctan(fxW−cx)=arctan(fycy)+arctan(fyH−cy)
所有角度单位为弧度,若需度,乘以 180π\frac{180}{\pi}π180。
1万+

被折叠的 条评论
为什么被折叠?



