-
光场相机的典型代表是Ng等设计的传统光场相机(Plenopic 1.0)。小孔成像模型描述微透镜阵列,薄透镜模型描述主镜头。该成像装置在传统相机的焦平面处放置一个微透镜阵列,并将图像传感器置于微透镜的一倍焦距处。真实场景中特定深度平面上来自同一点的不同方向光束,通过主镜头折射、微透镜聚焦,最终被图像传感器上的成像单元所记录,如图1所示。
如图1所示,
$ A $ 表示图像传感器平面,$ B $ 表示微透镜阵列平面,C表示主透镜平面,$O - XY$ 为图像坐标系,${O_c} - {X_c}{Y_c}{Z_c}$ 为相机坐标系,${O_w} - {X_w}{Y_w}{Z_w}$ 为世界坐标系。光场相机模型表示为光线的路径,以穿过微透镜阵列平面及图像传感器平面的射线作为此光线的开始,即$n = {\left[ {i{\text{ }}j{\text{ }}k{\text{ }}l} \right]^{\rm{T}}}$ ,$ i $ 和$ j $ 为每个微透镜对应像元的索引,$ k $ 和$ l $ 为微透镜的位置索引,完整的转换过程如公式(1)所示[9]。如果每个微透镜对应的像元像素为${N_i} \times {N_j}$ ,那么$ i $ 和$ j $ 的范围为$0 \sim {N_{i,j}}$ ;若有${N_k} \times {N_l}$ 个微透镜,则$ k $ ,$ l $ 的范围为$0 \sim {N_{k,l}}$ 。$$ {\varphi ^A} = H_{{\varPhi }}^\varphi {H^M}{H^{{T}}}H_\varphi ^{{\varPhi }}H_{abs}^\varphi H_{rel}^{abs}n = Hn $$ (1) $$\begin{split} & \mathop H\nolimits_{rel}^{{{abs}}} = \left[ {\begin{array}{*{20}{c}} \begin{gathered} 1 \\ 0 \\ 0 \\ \end{gathered} &\begin{gathered} N \\ 1 \\ 0 \\ \end{gathered} &\begin{gathered} - {c_{pix}} \\ 0 \\ 1 \\ \end{gathered} \end{array}} \right] \mathop H\nolimits_{{{abs}}}^\varphi = \left[ {\begin{array}{*{20}{c}} {1/{F_s}}&0&{ - {c_m}/{F_s}} \\ 0&{1/{F_u}}&{ - {c_u}/{F_u}} \\ 0&0&1 \end{array}} \right] \\ &\mathop H\nolimits_\varphi ^\varPhi = \left[ {\begin{array}{*{20}{c}} 1&0&0 \\ {{{ - }}1/{d_u}}&{1/{d_u}}&0 \\ 0&0&1 \end{array}} \right] \mathop H\nolimits^{{T}} = \left[ {\begin{array}{*{20}{c}} 1&{{{{d}}_u} + {d_M}}&0 \\ 0&1&0 \\ 0&0&1 \end{array}} \right] \\ &\mathop H\nolimits^M = \left[ {\begin{array}{*{20}{c}} 1&0&0 \\ { - 1/{f_M}}&1&0 \\ 0&0&1 \end{array}} \right] \mathop H\nolimits_\varPhi ^\varphi = \left[ {\begin{array}{*{20}{c}} 1&D&0 \\ 0&1&0 \\ 0&0&1 \end{array}} \right] \\[-12pt] \end{split} $$ (2) 为了便于说明,将四维坐标简化为横向的二维坐标,再延伸至四维光场,即
$n = {\left[ {\begin{array}{*{20}{c}} i&k&1 \end{array}} \right]^{\rm{T}}}$ 。$H_{rel}^{abs}$ 是将相对坐标转换为绝对坐标的矩阵,即把$ i $ 转换为${i_{abs}}$ ,如图2所示,$ i $ 是相对坐标,表示每个微透镜下宏像素的索引,把相对坐标加上其对应的微透镜索引$k$ 处的实际像素,即$kN$ ,并减去宏像素的中心${c_{pix}}$ 就得到了绝对坐标${i_{abs}}$ ,其表示在图像传感器平面上相对坐标对应的微透镜图像的实际索引,转换过程为公式(3),$N$ 是每个微透镜下的宏像素大小,${c_{pix}}$ 是每个微透镜下的宏像素的中心,$ {c}_{pix}=N/2 $ 。$$ \left[ {\begin{array}{*{20}{c}} {{i_{abs}}} \\ k \\ 1 \end{array}} \right] = \left[ {\begin{array}{*{20}{c}} 1&N&{ - {c_{pix}}} \\ 0&1&0 \\ 0&0&1 \end{array}} \right]\left[ {\begin{array}{*{20}{c}} i \\ k \\ 1 \end{array}} \right] = \left[ {\begin{array}{*{20}{c}} {i + kN - {c_{pix}}} \\ k \\ 1 \end{array}} \right] $$ (3) 下一步是把绝对坐标转换为光场射线表示,此处与普通相机的小孔成像模型类似,首先通过
$H_{abs}^\varphi$ 将绝对坐标${i_{abs}}$ 与微透镜阵列的索引$k$ 分别减去图像传感器和微透镜阵列的中心位置偏移量,再除以对应的单位物理尺寸(mm)可得到其在图像传感器平面与微透镜阵列平面实际的物理尺寸(mm),$1/{F_s}$ 和$1/{F_u}$ 分别表示图像传感器像素和微透镜的单位物理尺寸(mm),${c_m}$ 和${c_u}$ 分别为图像传感器和微透镜阵列的中心位置偏移量,${F_{s}} = N{F_u}$ ,${c_m} = N{c_u}$ ,转换公式如公式(4)所示:${x_i}$ 表示该点到图像中心主点之间的物理距离,${k'}$ 表示该点所在的微透镜中心到图像中心主点之间的物理距离,如图3所示。图 3 光线在图像传感器平面、微透镜阵列平面、主透镜平面的表示
Figure 3. Representation of light on the plane of the image sensor, the plane of the micro lens array, and the plane of the main lens
$$ \begin{split} &\left[ {\begin{array}{*{20}{c}} {{x_i}} \\ {{k'}} \\ 1 \end{array}} \right] = \left[ {\begin{array}{*{20}{c}} {1/{F_s}}&0&{ - {c_m}/{F_s}} \\ 0&{1/{F_u}}&{ - {c_u}/{F_u}} \\ 0&0&1 \end{array}} \right] \\ &\left[ {\begin{array}{*{20}{c}} {{i_{abs}}} \\ k \\ 1 \end{array}} \right] = \left[ {\begin{array}{*{20}{c}} {({i_{rel}} + kN - {c_{pix}} - {c_m})/{F_s}} \\ {(k - {c_u})/{F_u}} \\ 1 \end{array}} \right] \end{split}$$ (4) 然后通过
$H_\varphi ^{{\varPhi }}$ 推导出其对应光线的角度$\theta $ ,如图3所示,使用宏像素的中心偏移${c_{pix}}$ 减去在该宏像素的相对坐标$i$ ,得到$i$ 与当前微透镜光轴的像素,然后除以${F_s}$ 得到该距离的实际物理尺寸$ {x_i} $ ,最后除以图像传感器平面和微透镜阵列平面的距离$ {d_u} $ ,即可得到该条光线的角度$\theta $ 。转换过程如公式(5)所示:$ {x_i} $ 是光线在图像传感器平面的坐标,$\theta $ 是光线的角度,$ {d_u} $ 代表图像传感器平面和微透镜阵列平面的距离。最后通过$ {H^T} $ 将光线在图像传感器平面的坐标(即光线在${{i}}$ 平面的坐标$ {x_i} $ )延伸至主透镜$ s $ 平面,如图3所示,主透镜与图像传感器平面的距离($ {d_u} + {d_m} $ )乘上光线的角度$\theta $ ,再加上$ {x_i} $ 即可得到延伸至主透镜上的点$ {x_m} $ ,转换过程如公式(6)所示:$ {d_m}$ 代表主透镜平面与微透镜阵列平面的距离,$ {x_m} $ 是光线在主透镜$ s $ 平面的坐标。$$ \begin{split} &\left[\begin{array}{c}{x}_{i}\\ \theta \\ 1\end{array}\right]=\left[\begin{array}{ccc}1& 0& 0\\ -1/{d}_{u}& 1/{d}_{u}& 0\\ 0& 0& 1\end{array}\right] \\ &\left[\begin{array}{c}{x}_{i}\\ {k}^{\text{'}}\\ 1\end{array}\right]=\left[\begin{array}{c}(i+kN-{c}_{pix}-{c}_{m})/{F}_{s}\\ ({c}_{pix}-i)/{F}_{s}{d}_{u}\\ 1\end{array}\right] \end{split}$$ (5) $$ \left[\begin{array}{c}{x}_{m}\\ \theta \\ 1\end{array}\right]=\left[\begin{array}{ccc}1& {d}_{u}+{d}_{m}& 0\\ 0& 1& 0\\ 0& 0& 1\end{array}\right]\left[\begin{array}{c}{x}_{i}\\ \theta \\ 1\end{array}\right]=\left[\begin{array}{c}{x}_{i}+\theta ({d}_{u}+{d}_{m})\\ \theta \\ 1\end{array}\right] $$ (6) 最后通过
$ {H^M} $ 推导出入射光线的方向,如图4所示,主透镜符合薄透镜模型,根据高斯成像公式:$ 1/{f_M} = 1/u + 1/v $ ,$ {f_M} $ 为主透镜的焦距,$ u $ 为物距,$ v $ 为像距,$u = {x_m}/{\theta '}$ ,$ v = {x_m}/\theta $ ,即$1/{f_M} = {\theta '}/{x_m} + \theta /{x_m}$ ,可得到入射光线的角度${\theta '}$ ,转换过程如公式(7)所示。然后通过$H_{{\varPhi }}^\varphi$ 推导出经过$ {x_m} $ 的入射光线与$ u $ 平面的交点,$ D $ 是$ u $ 平面与主透镜$ s $ 平面的距离,入射光线的角度${\theta '}$ 与距离$ D $ 相乘并加上$ {x_m} $ 即可得到该光线与$ u $ 平面的交点$ s $ ,如公式(8)所示:$ s $ 为入射光线在$ u $ 平面的坐标,$ u $ 为入射光线的角度。注意,此时$ u $ 不是双平面模型中的坐标,而是入射角度,此处是为了和Dansereau等提出的经典模型中的$ u $ 做区分。$$ \left[ {\begin{array}{*{20}{c}} {{x_m}} \\ {{\theta '}} \\ 1 \end{array}} \right] = \left[ {\begin{array}{*{20}{c}} 1&0&0 \\ { - 1/{f_m}}&1&0 \\ 0&0&1 \end{array}} \right]\left[ {\begin{array}{*{20}{c}} {{x_m}} \\ \theta \\ 1 \end{array}} \right] = \left[ {\begin{array}{*{20}{c}} {{x_m}} \\ {\dfrac{{{x_m}}}{{{f_M}}} - \theta } \\ 1 \end{array}} \right] $$ (7) $$ \left[ {\begin{array}{*{20}{c}} s \\ u \\ 1 \end{array}} \right] = \left[ {\begin{array}{*{20}{c}} 1&D&0 \\ 0&1&0 \\ 0&0&1 \end{array}} \right]\left[ {\begin{array}{*{20}{c}} {{x_m}} \\ \theta \\ 1 \end{array}} \right] = \left[ {\begin{array}{*{20}{c}} {{x_m} + D{\theta '}} \\ {{\theta '}} \\ 1 \end{array}} \right] $$ (8) 因为垂直和水平方向的索引部分是独立的,所以将2D索引延伸为4D索引是简单的。通过公式(1)将公式(2)中的矩阵相乘可以得到一个具有12个非零项的矩阵的表达式:
$$ \left[ \begin{gathered} {\text{s}} \\ t \\ u \\ v \\ 1 \\ \end{gathered} \right] = \left[ {\begin{array}{*{20}{c}} {{H_{1,1}}}&0&{{H_{1,3}}}&0&{{H_{1,5}}} \\ 0&{{H_{2,2}}}&0&{{H_{2,4}}}&{{H_{2,5}}} \\ {{H_{3,1}}}&0&{{H_{3,3}}}&0&{{H_{3,5}}} \\ 0&{{H_{4,2}}}&0&{{H_{4,4}}}&{{H_{4,5}}} \\ 0&0&0&0&1 \end{array}} \right]\left[ \begin{gathered} i \\ j \\ k \\ l \\ 1 \\ \end{gathered} \right] $$ (9) -
微透镜阵列和主透镜都有可能导致镜头畸变[15],忽略微透镜阵列产生的畸变,考虑主透镜产生的畸变。由透镜的形状引起的径向畸变模型如下:
$$ \left\{ \begin{aligned} &{u}_{d}=\left(1+{k}_{1}{r}^{2}+{k}_{2}{r}^{4}+\cdots \right)u \\ &{v}_{d}=\left(1+{k}_{1}{r}^{2}+{k}_{2}{r}^{4}+\cdots \right)v \\ &r=\sqrt{{u}^{2}+{v}^{2}} \end{aligned} \right. $$ (10) 式中:
$ {k_1} $ 、$ {k}_{2} $ 等是径向畸变系数,根据光场相机的镜头参数,可以选择双参数模型和三参数模型;$ u $ 、$ v $ 和$ {u_d} $ 、$ {v_d} $ 分别为没有畸变和有畸变的光线角度。由相机组装过程中透镜和像面不严格平行引起的切向畸变模型可用畸变系数$ {p_1} $ 和$ {p_2} $ 类似描述为:$$ \left\{ \begin{aligned} & {u_d} = {u_{}} + [2{p_1}uv + {p_2}({r^2} + 2{u^2})] \\ &{v_d} = {v_{}} + [2{p_2}uv + {p_1}({r^2} + 2{v^2})] \\ \end{aligned} \right. $$ (11) -
光场相机的标定有三个主要模块:第一部分是合成所有角度的子孔径图像并提取所有角度子孔径图像的特征点;第二部分是对相机参数进行初始化[16];第三部分根据相机的重投影误差构造函数进行非线性优化,它优化了第二部分产生的初始估计。
-
首先将原始的2D图片解码为4D光场表示,通过得到的微透镜图像合成不同方向的子孔径图像,再对所有子孔径图像进行特征点提取。将每个微透镜宏像素上相同位置的像素点按照顺序进行重排列操作,即可得到该方向的子孔径图像,以此类推,可以得到所有角度的子孔径图像,原理如图5(a)所示。
$ i $ 、$ j $ 是一个微透镜下的宏像素索引,$ k $ 、$ l $ 是微透镜的个数索引。例如:微透镜阵列有$ 381 \times 383 $ 个,即有$ 381 \times 383 $ 个微透镜,每个微透镜下的宏像素有 9 pixel×9 pixel,那么就可以提取$ 9 \times 9 $ 张子孔径图像,每张子孔径图像有381 pixel×383 pixel[17]。对于子孔径图像来说,$ i $ 、$ j $ 是图片索引,$ k $ 、$ l $ 是像素值。中心角度的子孔径图像就是按照顺序提取每一个微透镜宏像素中心位置的像素点,然后把这些像素按顺序重新拼接成的图像,所有角度子孔径图像如图5(c)所示,因为每个微透镜的边缘存在渐晕现象,所以边缘角度的子孔径图像较暗。与传统相机标定类似,光场相机从不同角度拍摄棋盘格图像[18],得到所有角度子孔径图像后对子孔径图像进行灰度化处理,然后通过Harris角点检测[5]方法提取每一幅子孔径图像的特征点。
-
在光场相机的模型中,当
$ u $ 平面在主透镜的焦平面上时,即$ D = {f_M} $ ,光场相机的坐标系原点为主透镜光轴与主透镜焦平面的交点。$ XY $ 轴方向仍是像平面的$ XY $ 方向,$ Z $ 方向垂直于焦平面向外。通过公式(9)可以得出:$ {H_{1,1}} = {H_{2,2}} $ ,$ {H_{3,3}} = {H_{4,4}} $ ,$ {H_{1,3}} = {H_{2,4}} $ ,$ {H_{3,1}} = {H_{4,2}} $ ,$ {H_{1,5}} = {H_{{\text{2}},5}} $ ,$ {H_{{\text{3}},5}} = {H_{4,5}} $ 。对其参数进行化简,可以得出:$ {H_{1,1}} = - \dfrac{{{f_M}}}{{N{F_u}{d_u}}} $ ,${H}_{3,3}=-\dfrac{1}{{F}_{\text{u}}{f}_{M}}$ ,${H_{1,5}} = \dfrac{{{c_{{{pix}}}}{f_M}}}{{N{F_u}{d_u}}}$ ,$ {H_{{\text{3}},5}} = \dfrac{{{c_u}}}{{{F_u}{f_M}}} $ ,$ {H_{1,3}} = 0 $ ,$ {H_{3,1}} = 0 $ 。光场相机的初始化首先要得到主透镜的焦距,在光场相机的模型中,从图像传感器到微透镜的每条相同角度的射线路径(即
$ i $ ,$ j $ 相同)都收敛到主透镜焦平面上的一个点,这个点是虚拟相机的中心位置,即$ {u_i} $ ,如图6所示。此时,每个子孔径图像的成像等效为小孔成像模型,其焦距是主透镜的焦距$ {f_m} $ ,子孔径图像相邻像素之间的距离也就是微透镜的物理尺寸,为$ 1/{F}_{u} $ (mm)。中心角度的子孔径图像(光线角度为0°,即过主透镜光心)所等效的虚拟相机的坐标系为光场相机的坐标系。类似张正友的平面靶标标定方法[14],求解主透镜焦距首先要通过世界坐标系的
$3 {\rm{D}}$ 点和像素坐标系的$2 {\rm{D}}$ 点得到单应矩阵H:$$ H = sK\left[ {\begin{array}{*{20}{c}} {{r_{11}}}&{{r_{21}}}&{{t_1}} \\ {{r_{12}}}&{{r_{22}}}&{{t_2}} \\ {{r_{13}}}&{{r_{23}}}&{{t_3}} \end{array}} \right] = sK\left[ {\begin{array}{*{20}{c}} {{r_1}}&{{r_2}}&t \end{array}} \right] $$ (12) $$ K = \left[ {\begin{array}{*{20}{c}} {{f_x}}&\gamma &{{u_{_0}}} \\ 0&{{f_y}}&{{v_0}} \\ 0&0&1 \end{array}} \right] $$ (13) 式中:
$ s $ 表示尺度因子;$ K $ 表示相机内参矩阵;$ {r_1} $ ,$ {r_2} $ ,$ t $ 为相机外参;$ {f_x} $ ,$ {f_y} $ 为主透镜的等效焦距;$ {u_0} $ ,$ {v_0} $ 为图像的主点,是两个坐标轴的偏斜参数,可以忽略不计。通过将单应矩阵$ H $ 中无关的参数(即主点$ ({u_0},{v_0}) $ )消除,可以求出焦距$ {f_x} $ ,$ {f_y} $ :$$\begin{split} H = {{\rm{Re}}} centerH \cdot H & = s\left[ {\begin{array}{*{20}{c}} {{f_x}}&0&0 \\ 0&{{f_y}}&0 \\ 0&0&1 \end{array}} \right]\left[ {\begin{array}{*{20}{c}} {{r_{11}}}&{{r_{21}}}&{{t_1}} \\ {{r_{12}}}&{{r_{22}}}&{{t_2}} \\ {{r_{13}}}&{{r_{23}}}&{{t_3}} \end{array}} \right] =\\ &s\left[ {\begin{array}{*{20}{c}} {{h_{11}}}&{{h_{21}}}&{{h_{31}}} \\ {{h_{12}}}&{{h_{22}}}&{{h_{32}}} \\ {{h_{13}}}&{{h_{23}}}&{{h_{33}}} \end{array}} \right] \end{split} $$ (14) $$ {{\rm{Re}}} centerH = \left[ {\begin{array}{*{20}{c}} {\text{1}}&{\text{0}}&{{{ - }}{u_0}} \\ {\text{0}}&{\text{1}}&{{{ - }}{v_0}} \\ {\text{0}}&{\text{0}}&{\text{1}} \end{array}} \right] $$ (15) 把公式(14)进一步变换,得到:
$$ \begin{split} \left[ {\begin{array}{*{20}{c}} {{r_{11}}}&{{r_{21}}}&{{t_1}} \\ {{r_{12}}}&{{r_{22}}}&{{t_2}} \\ {{r_{13}}}&{{r_{23}}}&{{t_3}} \end{array}} \right] =& \left[ {\begin{array}{*{20}{c}} {{1 \mathord{\left/ {\vphantom {1 {{f_x}}}} \right. } {{f_x}}}}&0&0 \\ 0&{{1 \mathord{\left/ {\vphantom {1 {{f_y}}}} \right. } {{f_y}}}}&0 \\ 0&0&1 \end{array}} \right]\left[ {\begin{array}{*{20}{c}} {{h_{11}}}&{{h_{21}}}&{{h_{31}}} \\ {{h_{12}}}&{{h_{22}}}&{{h_{32}}} \\ {{h_{13}}}&{{h_{23}}}&{{h_{33}}} \end{array}} \right] = \\ &\left[ {\begin{array}{*{20}{c}} {{{{h_{11}}} \mathord{\left/ {\vphantom {{{h_{11}}} {{f_x}}}} \right. } {{f_x}}}}&{{{{h_{21}}} \mathord{\left/ {\vphantom {{{h_{21}}} {{f_x}}}} \right. } {{f_x}}}}&{{{{h_{31}}} \mathord{\left/ {\vphantom {{{h_{31}}} {{f_x}}}} \right. } {{f_x}}}} \\ {{{{h_{12}}} \mathord{\left/ {\vphantom {{{h_{12}}} {{f_y}}}} \right. } {{f_y}}}}&{{{{h_{22}}} \mathord{\left/ {\vphantom {{{h_{22}}} {{f_y}}}} \right. } {{f_y}}}}&{{{{h_{32}}} \mathord{\left/ {\vphantom {{{h_{32}}} {{f_y}}}} \right. } {{f_y}}}} \\ {{h_{13}}}&{{h_{23}}}&{{h_{33}}} \end{array}} \right] \end{split} $$ (16) 因为相机外参的旋转矩阵是正交的,即
$ {r_1} $ 和$ {r_2} $ 正交,由此可推出相机主透镜的等效焦距$ {f_x} $ 和$ {f_y} $ ,由$\dfrac{{{h_{11}}{h_{21}}}}{{f_x^2}} + \dfrac{{{h_{12}}{h_{22}}}}{{f_y^2}} + {h_{13}}{h_{23}} = 0$ ,$ {f_x} = {f_y} $ 可求得:$$ {f_x} = \sqrt { - \frac{{{h_{11}}{h_{21}} + {h_{12}}{h_{22}}}}{{{h_{13}}{h_{23}}}}} $$ (17) 等效焦距等于焦距
$ {f_M} $ 除以像素之间的物理尺寸$ 1/{F_u} $ ,即$ {f_x} = {f_y} = {f_M}{F_u} $ 。相邻虚拟相机中心之间的距离称为基线(baseline),该基线距可以通过标定时虚拟相机的外参得到,即外参平移量之间的距离,如图7所示。当
$ D = {f_M} $ 时,由图7根据相似三角形可知两个角度$ \theta $ 是相等的,即:$$ \frac{{i - {c_{pix}}}}{{{F_s}{d_u}}} = \frac{u}{{{f_M}}} \text{,} u = \frac{{{f_M}(i - {c_{pix}})}}{{{F_s}{d_u}}} $$ (18) 假如
$ n = 1 $ ,那么基线就是$ {u_{i + 1}} $ 和$ {u_i} $ 之间的距离。即通过公式(18)可以得出:$$ baseline = \left| {{u_{i + 1}}{{ - }}{u_i}} \right| = \frac{{{f_M}}}{{{F_s}{d_u}}} = \frac{{{f_M}}}{{N{F_u}{d_u}}} $$ (19) 图 7 从一个点到两个不同角度子孔径图像的光线
Figure 7. Light rays from one point to two sub-aperture images at different angles
因此,
${H}_{3,3}=-\dfrac{1}{{F}_{{u}}{f}_{M}}=-\dfrac{1}{{f}_{x}}$ 可以通过公式(17)得到,$ {H_{1,1}} = - \dfrac{{{f_M}}}{{N{F_u}{d_u}}} $ 可以通过公式(19)得到,${H}_{1,5}=\dfrac{{c}_{{pix}}{f}_{M}}{N{F}_{u}{d}_{u}}= -{c}_{pix}{H}_{1,1}$ ,$ {H_{{\text{3}},5}} = \dfrac{{{c_u}}}{{{F_u}{f_M}}} = - {c_u}{H_{3,3}} $ 。至此,忽略畸变,得到了所有模型参数的初值。 -
对于传统相机的标定,特征点
$ P $ 对应于图像平面中的某一点,如图8(a)所示,从观测到的和预期得到的投影特征位置$ i $ 和$ \hat i $ 之间的距离称为“重投影误差”,$ \left| E \right| = \left| {i - \hat i} \right| $ ,对这个误差建立目标函数,采用非线性优化方法对相机参数进行优化。但是在光场相机标定中,由于一个特征点会多次出现在成像平面上,重投影误差是比较复杂的,如图8(b)所示,对于光场相机,每个特征点都有多个预期和观测到的图像点$ {\hat i _j} $ ,$ {i_j} $ ,并且它们通常不会出现在相同的微透镜下的宏像素内。从每一个观测到的点$ {i_j} $ 可以得到一条投影光线$ {\phi _j} $ ,每条投影光线与特征点之间的距离$ \left| {{E_j}} \right| $ 称为“光线重投影误差”。图 8 重投影误差模型。 (a) 传统相机的投影误差;(b) 光场相机的投影误差
Figure 8. Reprojection error model. (a) Conventional camera projection error; (b) Light field camera projection error
因为已经得到了
$ {N_i} \times {N_j} $ 的子孔径图像阵列,从其中提取观察到的特征点,从$ M $ 个不同的角度捕获标定板,并且每一个标定板有$ {N_c} $ 个标定特征点,所以优化的总特征集大小为$ {N_c}M{N_i}{N_j} $ 。优化目标是找到内参矩阵$ H $ 、相机姿态$ {T_m} $ (光场相机的外参等于最中心的虚拟相机的外参)、畸变系数$ d $ 、$n = {\left[ {i{\text{ }}j{\text{ }}k{\text{ }}l} \right]^{\rm{T}}}$ ,$ i $ 和$ j $ 为每个微透镜对应像元的索引,即子孔径图像的索引($ 0 - {N_i} $ ,$ 0 - {N_j} $ ),$ k $ 和$ l $ 为微透镜的位置索引,即子孔径图像上像素值。$ \phi $ 表示点$ n $ 通过畸变校正后通过光场相机模型(公式(1))得到光线的位置和角度,优化函数如公式(20)所示:$$ \underset{H,T,d}{\mathrm{arg}\mathrm{min}}{\displaystyle \sum _{c=1}^{{N}_{c}}}{\displaystyle \sum _{m=1}^{M}}{\displaystyle \sum _{s=1}^{{N}_{i}}}{{\displaystyle \sum _{t=1}^{{N}_{j}}\Vert \hat{\phi }(H,d,{n}_{c,m,s,t}),{T}_{m}{P}_{c}\Vert }}^{pt-ray} $$ (20) 式中:
$ {\left\| \cdot \right\|^{pt - ray}} $ 为“光线重投影误差”。对该误差建立目标函数,采用 Levenberg-Marquardt的优化算法对其进行优化,使用
$ {\text{lsqnonlin}} $ 函数得到优化后的结果。 -
利用光场相机Lytro Illum对该方法进行验证。进行标定的实验系统如图9所示,包括光场相机和标定板。从图像传感器上记录的原始
$2 {\rm{D}}$ 图像中恢复$4 {\rm{D}}$ 光场$ L(s,t,u,v) $ ,并使用MATLAB toolbox LFToolbox V0.4[9]进行子孔径图像的提取。使用了相机提供的白图像来定位微透镜图像中心和矫正镜头的渐晕。提取到的四维光场有$ 15 \times 15 $ 个子孔径图像,每个子孔径图像有434 pixel×625 pixel。实验中,使用Lytro光场相机拍摄16个不同视角的棋盘格图片,该棋盘格有$ 12 \times 9 $ 个网格,标定板相邻特征点之间的距离为30.0 mm×30.0 mm。光场相机标定结果详见表1。该模型在非线性优化和畸变校正前后的重投影误差如图10所示。图10(a)中,主透镜边缘的重投影误差相比主透镜中间的重投影误差有较大浮动,而优化校正后的重投影误差大致相同,如图10(b)所示。文中改进的标定方法与Dansereau[9]等人的方法相比,均方根误差由0.363 mm降低到0.332 mm,精度提升
$ 8 \text{%} $ ,如图10(b)、(c)所示。另外,对于Dansereau[9]等人方法中采用的径向畸变模型,文中验证了采用多项式模型中双参数、单参数径向畸变模型以及除法模型,其标定精度不如三参数的径向畸变模型,也说明了原本径向模型的准确性。表 1 光场相机参数优化前与优化后
Table 1. Before and after optimization of light field camera parameters
Parameter Initial value Optimized value H1,1 0.0009 0.0005 H1,3 0 −0.0004 H1,5 −0.0044 0.0812 H2,2 0.0009 0.0005 H2,4 0 −0.0005 H2,5 −0.0044 0.084 H3,1 0 −0.0011 H3,3 0.0018 0.0018 H3,5 −0.3443 −0.3436 H4,2 0 −0.0011 H4,4 0.0018 0.0018 H4,5 −0.3425 −0.3454 k1 - 0.1199 k2 - −0.0426 k3 - 1.4977 p1 - −0.0066 p2 - −0.0094 图 10 30.0 mm标定板棋盘格的重投影误差。 (a) 未非线性优化和失真校正; (b) 非线性优化失真校正; (c) Dansereau的非线性优化和失真校正方法
Figure 10. Reprojection error of 30.0 mm calibration board checkerboard. (a) No nonlinear optimization and distortion correction; (b) Nonlinear optimization distortion correction; (c) The method of Dansereau nonlinear optimization and distortion correction
Light field camera modeling and distortion correction improvement method
-
摘要: 光场相机作为一种新型的成像系统,可以直接从一次曝光的图像中得到三维信息。为了能够更充分有效地利用光场数据包含的角度和位置信息,完成更加精准的场景深度计算,从而提升光场相机的三维重建的精度,需要实现精确的几何建模,并精确标定其模型参数。该方法从薄透镜模型和小孔成像模型出发,将主透镜建模为薄透镜模型,将微透镜建模为小孔成像模型,结合光场相机双平面模型,将每个提取到的特征点与其在三维空间中的射线建立联系,详细解释了内参矩阵中每个参数的物理意义,以及标定过程中初值确定的过程,并在镜头径向畸变模型的基础上进一步应用了相机镜头的切向畸变模型以及基于射线重投影误差的非线性优化方法,改进了光场相机的标定方法。实验显示,该方法的RMS射线重投影误差为0.332 mm,与经典的Dansereau标定方法相比,进行非线性优化后得到的射线重投影误差精度提升了8%。该方法详细分析的场景点与特定像素索引的推导过程对光场相机的标定具有重要的研究意义,为光场相机光学模型的建立与初始化标定奠定了基础。Abstract: As a new type of imaging system, the light field camera can directly obtain 3D information from a single exposure of the image. In order to make more sufficient and effective use of the angle and position information contained in the light field data, complete more accurate scene depth calculation, and thus improve the accuracy of the 3D reconstruction of the light field camera, it is necessary to establish accurate geometric modeling and precisely calibrate its model parameters. This method starts from the thin lens model and pinhole imaging model, the main lens is modeled as the thin lens model, the micro modeling for pinhole imaging model, combined with the two-parallel-plane model of the light field camera, each extracted feature point is associated with its ray in three-dimensional space, the physical meaning of each parameter in the internal reference matrix is explained in detail, as well as the process of determining the initial value in the process of calibration. Furthermore, based on the radial lens distortion model, the tangential lens distortion model and the nonlinear optimization method based on ray reprojection error are further applied to improve the calibration method of light field camera. The experimental results show that the RMS ray reprojection error of this method is 0.332 mm. Compared with the classical Dansereau calibration method, the ray reprojection error accuracy of the proposed method is improved by 8% after nonlinear optimization. The derivation process of scene points and specific pixels analyzed in detail in this method has important research significance for the calibration of optical field cameras, which lays the foundation for establishment of optical model and the initial calibration of light field cameras.
-
Key words:
- machine vision /
- light field camera /
- reprojection error /
- camera calibration /
- lens distortion
-
图 10 30.0 mm标定板棋盘格的重投影误差。 (a) 未非线性优化和失真校正; (b) 非线性优化失真校正; (c) Dansereau的非线性优化和失真校正方法
Figure 10. Reprojection error of 30.0 mm calibration board checkerboard. (a) No nonlinear optimization and distortion correction; (b) Nonlinear optimization distortion correction; (c) The method of Dansereau nonlinear optimization and distortion correction
表 1 光场相机参数优化前与优化后
Table 1. Before and after optimization of light field camera parameters
Parameter Initial value Optimized value H1,1 0.0009 0.0005 H1,3 0 −0.0004 H1,5 −0.0044 0.0812 H2,2 0.0009 0.0005 H2,4 0 −0.0005 H2,5 −0.0044 0.084 H3,1 0 −0.0011 H3,3 0.0018 0.0018 H3,5 −0.3443 −0.3436 H4,2 0 −0.0011 H4,4 0.0018 0.0018 H4,5 −0.3425 −0.3454 k1 - 0.1199 k2 - −0.0426 k3 - 1.4977 p1 - −0.0066 p2 - −0.0094 -
[1] Zhang Xuanzhe, Wang Yan, Wang Jiahua, et al. Image clarification and point cloud calculation under turbulence by light field camera [J]. Infrared and Laser Engineering, 2020, 49(11): 20200053. (in Chinese) doi: 10.3788/IRLA20200053 [2] Zhang Wei, Guo Xin, You Suping, et al. Computer simulation for hybrid plenoptic camera super-resolution refocusing with focused and unfocused mode [J]. Infrared and Laser Engineering, 2015, 44(11): 3384-3392. (in Chinese) doi: 10.3969/j.issn.1007-2276.2015.11.037 [3] Shi Xiao, Ai Lingyu, Yu Miao, et al. Full-parallax three dimensional display based on light field camera [J]. Acta Optica Sinica, 2020, 40(7): 0711005. (in Chinese) doi: 10.3788/AOS202040.0711005 [4] 金冬阳. 基于光场结构点的光场相机内外参标定研究[D]. 西安电子科技大学, 2020. DOI: 10.27389/ d. cnki. gxadu. 2020. 003418. Jin Dongyang. Research on LF-point based plenoptic camera calibration [D]. Xi’an: Xidian University, 2020. (in Chinese) [5] Adelson E H, Wang J Y. Single lens stereo with a light field camera [J]. IEEE Trans Pattern Anal Mach Intell, 1992, 14(2): 99-106. doi: 10.1109/34.121783 [6] Ng R, Levoy M, Brédif M, et al. Light field photography with a hand-held light field camera [J]. Comput Sci Tech Rep, 2005, 2(11): 1-11. [7] Georgiev T, Lumsdaine A. Rich image capture with light field cameras [C]//2010 IEEE International Conference on Computational Photography (ICCP), 2010: 1-8. [8] Georgiev T, Lumsdaine A. Reducing light field camera artifacts [J]. Comput Graph Forum, 2010, 29(6): 1955-1968. doi: 10.1111/j.1467-8659.2010.01662.x [9] Dansereau D G, Pizarro O, Williams S B. Decoding, calibration and rectification for lenslet-based light field cameras [C]//IEEE Computer Society Conference on Computer Vision and Pattern Recognition, 2013: 1027-1034. [10] Bok Y, Jeon H G, Kweon I S. Geometric calibration of microlens-based light-field cameras using line features [C]//Computer Vision–ECCV 2014, 2014: 47-61. [11] Zeller N, Noury C A, Quint F, et al. Metric calibration of a focused light field camera based on a 3D calibration target [J]. ISPRS Ann Photogrammetry Rem Sens Spat Inf Sci, 2016, III-3: 449-456. [12] Johannsen O, Heinze C, Goldluecke B, et al. On the Calibration of Focused Plenoptic Cameras [M]//Grzegorzek M, Theobalt C, Koch R, et al. Time-of-Flight and Depth Imaging. Sensors, Algorithms, and Applications. Lecture Notes in Computer Science, vol 8200. Berlin-Heidelberg: Springer, 2013: 302-317. [13] Zhang C, Ji Z, Wang Q. Decoding and calibration method on focused light field camera [J]. Comput Vis Media, 2016, 2(1): 57-69. doi: 10.1007/s41095-016-0040-x [14] Noury C A, Teuliere C, Dhome M. Light-field camera calibration from raw images [C]//2017 International Conference on Digital Image Computing: Echniques and Applications (DICTA). IEEE, 2017: 1-8. [15] Liu Q S, Xie X F, Zhang X Z, et al. Stepwise calibration of plenoptic cameras based on corner features of raw images [J]. Applied Optics, 2020, 59(14): 4209-4219. doi: 10.1364/AO.387018 [16] Liu Y X, Mo F, Aleksandrov M, et al. Accurate calibration of standard plenoptic cameras using corner features from raw images [J]. Optics Express, 2021, 29(1): 158-169. doi: 10.1364/OE.405168 [17] Chen Wenyi, Xu Jie, Yang Hui. Camera calibration method based on double neural network [J]. Infrared and Laser Engineering, 2021, 50(11): 20210071. (in Chinese) doi: 10.3788/IRLA20210071 [18] Yuan Suochao. Research on the image quality assessment of light field camera [D]. Xi’an: Xi’an Institute of Optics Precision Mechanics, Chinese Academy of Sciences (University of Chinese Academy of Sciences), 2021. (in Chinese)