GSLAM
3.0.0
|
A Camera describes the corrospondence of image coordinates and 3D directions.
For direction \((x,y,1)\): \( \left[\begin{array}{c}u \\ v\end{array} \right]= \left[\begin{array}{c}cx \\ cy\end{array} \right]+ \left[\begin{array}{cc}fx&\\ &fy\end{array} \right]* \left[\begin{array}{c}x \\ y\end{array} \right] \)
For direction \((x,y,1)\):
\( r =sqrt(x^2+y^2) \)
\( r'=atan(r * tan2w) / w \)
\( tan2w=2.0 * tan(w / 2.0) \)
\( \left[\begin{array}{c}u \\ v\end{array} \right]= \left[\begin{array}{c}cx \\ cy\end{array} \right]+ \left[\begin{array}{cc}fx&\\ &fy\end{array} \right]* \left[\begin{array}{c}x \\ y\end{array} \right]*r'/r \)
The UnProject:
\( \left[\begin{array}{c}x' \\ y'\end{array} \right]= \left( \left[\begin{array}{c}u \\ v\end{array} \right]- \left[\begin{array}{c}cx \\ cy\end{array} \right] \right)* \left[\begin{array}{cc}fx^{-1}&\\ &fy^{-1}\end{array} \right]*r/r' \)
\( r' =sqrt(x'^2+y'^2) \)
\( r =(tan(r' * w) / tan2w)\)
For direction \((x,y,1)\):
\( r^2= x^2+y^2 \)
\( x_1= x*(1+k1*r^2 + k2*r^4+k3*r^6) + 2*p1*xy + p2*(r^2 + 2*x^2) \)
\( y_1= y*(1+k1*r^2 + k2*r^4+k3*r^6) + 2*p2*xy + p1*(r^2 + 2*y^2) \)
\( \left[\begin{array}{c}u \\ v\end{array} \right]= \left[\begin{array}{c}cx \\ cy\end{array} \right]+ \left[\begin{array}{cc}fx&\\ &fy\end{array} \right]* \left[\begin{array}{c}x_1 \\ y_1\end{array} \right] \)