# とらりもん - RPC Diff

• Added parts are displayed like this.
• Deleted parts are displayed like this.

2017/06/02 Jin Katagi

Keep writing.

{{toc}}

! What is RPC

It is used when we convert geometry space (3D) to image space (2D).

!! The concept of RPC

!! Definition of the RPC equation

There are 80 parameters.

! How to solve RPC

In this page, I just only show Terrain-dependent Approach (= using GCPs approach).

!! Least-Squares solutions[1]

r をベクトルの内積の形で表すと

{{dmath '
r = \frac{(1, Z, Y, X, \ldots , Y^3, X^3)\cdot(a_{0}, a_{1}, \ldots , a_{19})^T}{(1, Z, Y, X, \ldots , Y^3, X^3)\cdot{(1, b_{1}, \ldots , b_{19})^T}}
'}}

となる。
この誤差を{{math 'v_r'}}とすると、

{{dmath '
v_r = \frac{(1, Z, Y, X, \ldots , Y^3, X^3)\cdot(a_{0}, a_{1}, \ldots , a_{19})^T}{(1, Z, Y, X, \ldots , Y^3, X^3)\cdot{(1, b_{1}, \ldots , b_{19})^T}} - r
'}}

となる。ここでrの右辺の分母をB（{{math '=(1, Z, Y, X, \ldots , Y^3, X^3)\cdot{(1, b_{1}, \ldots , b_{19})^T}'}}）と置くと

{{dmath '
\begin{array}{lll}
v_r  & = & \frac{(1, Z, Y, X, \ldots , Y^3, X^3)\cdot(a_{0}, a_{1}, \ldots , a_{19})^T}{\cdot{B}} - r \\
& = & \frac{(1, Z, Y, X, \ldots , Y^3, X^3)\cdot(a_{0}, a_{1}, \ldots , a_{19})^T}{\cdot{B}} - \frac{r}{B}B \\
& = & \frac{(1, Z, Y, X, \ldots , Y^3, X^3)\cdot(a_{0}, a_{1}, \ldots , a_{19})^T}{\cdot{B}} - \frac{r}{B}(1 + (Z, Y, X, \ldots , Y^3, X^3)\cdot(b_{1}, \ldots , b_{19})^T) \\
& = & \frac{(1, Z, Y, X, \ldots , Y^3, X^3)\cdot(a_{0}, a_{1}, \ldots , a_{19})^T}{\cdot{B}} - \frac{r}{B} - \frac{(Z, Y, X, \ldots , Y^3, X^3)\cdot(b_{1}, \ldots , b_{19})^T)}{B} \\
& = & \frac{1}{B}((1, Z, Y, X, \ldots , Y^3, X^3)\cdot(a_{0}, a_{1}, \ldots , a_{19})^T - r(Z, Y, X, \ldots , Y^3, X^3)\cdot(b_{1}, \ldots , b_{19})^T) - \frac{r}{B} \\
& = & \frac{1}{B}((1, Z, Y, X, \ldots , Y^3, X^3 , rZ, rY, rX, \ldots , rY^3, rX^3)\cdot(a_{0}, \ldots , a_{19}, b_{1}, \ldots , b_{19})^T) - \frac{r}{B} \\
& = & \frac{1}{B}((1, Z, Y, X, \ldots , Y^3, X^3 , rZ, rY, rX, \ldots , rY^3, rX^3)\cdot {\bm j} - \frac{r}{B}
\end{array}
'}}

ここで{{math '{\bm j}=(a_{0}, \ldots , a_{19}, b_{1}, \ldots , b_{19})^T)'}}とした。

この{{math '{\bm j}'}}を、最小二乗法を用いて求めていく。

k番目のGCPを{{math '{(X_k, Y_k, Z_k)}'}}とし、対応する誤差を{{math 'v_{rk}'}}とするとすべてのGCPにおける誤差は

{{dmath '
\begin{array}{lll}
\begin{bmatrix}
v_{r1} \\
v_{r2} \\
\vdots \\
v_{rn}
\end{bmatrix}
& = &
\begin{bmatrix}
\frac{1}{B_1} & 0 & \ldots& 0 \\
0 & \frac{1}{B_2} & 0 & \vdots \\
\vdots & & & \\
0 & \ldots & 0 & \frac{1}{B_n}
\end{bmatrix}
\cdot
\begin{bmatrix}
1 & Z_1 & \ldots & -r_{1} X^3_{1} \\
1 & Z_2 & \ldots & -r_{2} X^3_{2} \\
\vdots & & & \\
1 & Z_n & \ldots & -r_{n} X^3_{n}
\end{bmatrix}
\cdot
{\bm j}
-
\begin{bmatrix}
\frac{1}{B_1} & 0 & \ldots& 0 \\
0 & \frac{1}{B_2} & 0 & \vdots \\
\vdots & & & \\
0 & \ldots & 0 & \frac{1}{B_n}
\end{bmatrix}
\cdot
\begin{bmatrix}
r_1 \\
r_2 \\
\vdots \\
r_n
\end{bmatrix}
\end{array}
'}}

よって

{{dmath '
{\bm v_r} = {\bm W_r} {\bm M} {\bm j} - {\bm W_r} {\bm R}
'}}

これを最小化するために、{{math 'v_{r}^T \cdot v_r'}}を求めると

{{dmath '
\begin{array}{lll}
v_{r}^T \cdot v_r
& = & ({\bm W_r} {\bm M} {\bm j} - {\bm W_r} {\bm R})^T \cdot ({\bm W_r} {\bm M} {\bm j} - {\bm W_r} {\bm R}) \\
& = & {\bm j^T}{\bm M^T}{\bm W^T}{\bm W}{\bm W_r^T}{\bm W_r}{\bm M}{\bm j} - 2{\bm j^T}{\bm M^T}{\bm W^T}{\bm W}{\bm W_r^T}{\bm W_r}{\bm R} + {\bm R^T}{\bm W^T}{\bm W}{\bm W_r^T}{\bm W_r}{\bm R} \\
& = & {\bm j^T}{\bm M^T}{\bm W^2}{\bm W^2_r}{\bm M}{\bm j} - 2{\bm j^T}{\bm M^T}{\bm W^2}{\bm W^2_r}{\bm R} + {\bm R^T}{\bm W^2}{\bm W^2_r}{\bm R}
\end{array}
'}}

{{math 'f({\bm j})=v_{r}^T \cdot v_r'}}とし、jについて微分すると

{{dmath '
\begin{array}{lll}
f({\bm j} + \delta {\bm j}) - f({\bm j})
& = & 2 \delta {\bm j^T}{\bm M^T}{\bm W^2}{\bm W^2_r}{\bm M}{\bm j} - 2 \delta {\bm j^T}{\bm M}{\bm W^T}{\bm W}{\bm R}
\end{array}

'}}

よって

{{dmath '
{\bm M^T} {\bm W^2_r} {\bm M} {\bm j} - {\bm M^T} {\bm W^2_r} {\bm R} = 0
'}}

!! Regularization of the Normal Equation[1]

! How to convert 3D to 2D using RPC parameters

! Bibliography
# Tao, v., Hu, Y., 2001. A Comprehensive Study of the Rational Function Model for Photogrammetric Processing, PE&RS, 67(12), pp. 1347-1357.[[link|http://info.asprs.org/publications/pers/2001journal/december/2001_dec_1347-1357.pdf]]
# Hu, Y., Tao V., Croitoru A.,  ISPRS 2004.