# A Visual Odometry Pipeline for Real-Time UAS Geopositioning
## 3 Methodology
### Attitude Control  
As was discussed, attitude changes cause landmark matching problems (see Figure 7), which results in geopositioning errors. As shown in Tables 2 and 3, with the change in altitude, especially when the platform is below 100 m, landmark matching efficiency significantly reduces, resulting in geopositioning errors. This is due to the scale difference between reference orthophoto and UAS-acquired images. \begin{table}
\begin{tabular}{c c c c} \hline \hline  & **DoF 1** & **Matrix** & **Propieties** \\ \hline Pseudo-Perspective & 4 & \(\left[\begin{array}{ccc}sr_{11}&sr_{12}&t_{x}\\ sr_{21}&sr_{22}&t_{y}\\ 0&0&1\end{array}\right]\) & Rotation, Translation, Scaling \\ \hline Affine & 6 & \(\left[\begin{array}{ccc}a_{11}&a_{12}&t_{x}\\ a_{21}&a_{22}&t_{y}\\ 0&0&1\end{array}\right]\) & Pseudo-Perspective, Shearing \\ \hline Homography & 8 & \(\left[\begin{array}{ccc}h_{11}&h_{12}&h_{13}\\ h_{21}&h_{22}&h_{23}\\ h_{31}&h_{32}&1\end{array}\right]\) & Affine, non-Parallelism \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Transformation variants in 2D space. Figure 8: (a) Assuming camera model is a pinhole, features from the 3D world coordinates are projected to 2D image coordinates. Taking the ground plane as the reference, the features on the building roof diverge when extending the projection lines to the ground. (b) The pseudo-perspective model is a constrained projective model that assumes 3D features have the same depth by ignoring the height of the building. (c) The orthographic model is based on the orthographic projection; it preserves parallel lines and does not contain perspective effects. To overcome the landmark-matching problems related to rotation and scaling, we designed an attitude control module that enables UAS to freely change attitude and altitude during flight while ensuring good landmark matching despite the scale and orientation differences between the acquired image and the reference dataset. Using the pseudo-perspective transformation, we estimated the control module transformation as follows:  
\[P_{L}=\underbrace{ \begin{pmatrix}\cos\theta_{\text{offs}}*s_{\text{offs}}&- \sin\theta_{\text{offs}}*s_{\text{offs}}&t_{x}\\ \sin\theta_{\text{offs}}*s_{\text{offs}}&\cos\theta_{\text{offs}}*s_{\text{offs }}&t_{y}\end{pmatrix} }_{S_{2\times 3}}*P_{I} \tag{2}\]  
where \(\theta_{\text{offs}}\) is the rotation offset in reference to the north, \((t_{x},t_{y})\) is UAS translation, \(s_{offs}\) is the offset ratio from landmark scale between resized UAS acquired image and the landmarks generated from the reference orthophoto. For a UAS with a fixed focal length camera, the scale has a linear relationship with the drone's altitude (see Figure 9):  
\[Scale=0.01114674+0.0895404*Altitude \tag{3}\]  
where the slope and intercept are computed from the plot Figure 9, and the slope would change with a change in lens parameters. This equation converts the initial UAS attitude \(A_{0}\) to the same scale at which the look-up landmark descriptors are generated. By activating the attitude control, we observe increased accuracy and precision in landmark matching as shown in Table 1, especially at low attitudes. The algorithm used by the attitude control is given in Algorithm 1. \begin{table}
\begin{tabular}{l c c c c c c} \hline \multirow{2}{*}{**Altitude (m)**} & \multicolumn{4}{c}{**Not Adjusted 1**} & \multicolumn{4}{c}{**Adjusted**} \\ \cline{2-7}  & **Feat. 2** & **Matches 3** & **Pct. (\%) 4** & **Feat.** & **Matches** & **Pct.** \\ \hline
50 & 3488 & 343 & 9.83 & 1059 & 301 & **28.42** \\
60 & 3568 & 406 & 11.38 & 1459 & 343 & **23.51** \\
70 & 3749 & 470 & 12.54 & 1947 & 396 & **20.34** \\
80 & 3954 & 546 & 13.81 & 2434 & 510 & **20.95** \\
90 & 4085 & 639 & 15.64 & 2956 & 604 & **20.43** \\
100 & 4137 & 746 & 18.03 & 3489 & 700 & **20.06** \\ \hline \end{tabular} \({}^{\dagger}\) Disabling altitude control applied using Equation (3). 2 Extracted landmarks from UAS imagery. 3 Matched landmarks to the reference dataset. 4 Valid landmarks pct., matches/feat.  
\end{table}