双目视觉三维重建公式推导

推导

记左目像平面坐标$(u_1,v_1)$,右目像平面坐标$(u_2,v_2)$。

左目相机内参数$(f_{x1}、f_{y1}、u_{01}、v_{01})$,右目相机内参数$(f_{x2}、f_{y2}、u_{02}、v_{02})$,世界点$P(X,Y,Z)$。

\[Z_{c1} \left[\begin{array}{l} u_1 \\ v_1 \\ 1 \end{array}\right]=\left[\begin{array}{lll} f_{x1} & 0 & u_{01} \\ 0 & f_{y1} & v_{01} \\ 0 & 0 & 1 \end{array}\right]\left[\begin{array}{l} X \\ Y \\ Z \end{array}\right] \tag{1}\] \[\begin{aligned} Z_{c2}\left[\begin{array}{c} u_2 \\ v_2 \\ 1 \end{array}\right] &=\left[\begin{array}{cccc} f_{x2} & 0 & u_{02} & 0 \\ 0 & f_{y2} & v_{02} & 0 \\ 0 & 0 & 1 & 0 \end{array}\right]\left[\begin{array}{cc} R & t \\ 0^{T} & 1 \end{array}\right]\left[\begin{array}{c} X \\ Y \\ Z \\ 1 \end{array}\right]=M_{1} M_{2} X=M X \end{aligned} \tag{2}\]

式(2)有:

\[\begin{eqnarray} Z_{c 2}\left[\begin{array}{l} u_{2} \\ v_{2} \\ 1 \end{array}\right] & = & \left[\begin{array}{llll} m_{11} & m_{12} & m_{13} & m_{14} \\ m_{21} & m_{22} & m_{23} & m_{24} \\ m_{31} & m_{32} & m_{33} & m_{34} \end{array}\right]\left[\begin{array}{l} X \\ Y \\ Z \\ 1 \end{array}\right] \end{eqnarray} \tag{3}\]

消元有:

\[\begin{eqnarray} f_{x 1} X+\left(u_{01}-u 1\right) Z & = & 0 \\ f_{y 1} Y+\left(v_{01}-v 1\right) Z & = & 0 \end{eqnarray} \tag{4}\] \[\begin{eqnarray} \left(u_{2} m_{31}-m_{11}\right) X+\left(u_{2} m_{32}-m_{12}\right) Y+\left(u_{2} m_{33}-m_{13}\right) Z & = & m_{14}-u_{2} m_{34} \\ \left(v_{2} m_{31}-m_{21}\right) X+\left(v_{2} m_{32}-m_{22}\right) Y+\left(v_{2} m_{33}-m_{23}\right) Z & = & m_{24}-v_{2} m_{34} \end{eqnarray} \tag{5}\]

联立式(4)式(5),记:

\[\begin{eqnarray} A X & = & b \end{eqnarray} \tag{6}\]

式(6)有三个未知数与四个方程,显然 $ R(A)<R(A|b) $ 无解。 使用最小二乘法求其 极小范数最小二乘解

求式(6)中$A$的Moore-Penrose逆$A^{+}$:

\[\begin{eqnarray} A^{+} & = & \left(A^{T} A\right)^{-1} A^{T} \end{eqnarray} \tag{7}\]

其极小范数最小二乘解为:

\[\begin{eqnarray} x & = & A^{+} b & = & \left(A^{T} A\right)^{-1} A^{T} b \end{eqnarray} \tag{8}\]