# Visual-Inertial Method for Localizing Aerial Vehicles in GNSS-Denied Environments
## 2 Materials and Methods
Considering Figure 3, the Z-axis is pointing downward in the relative system, while it would be upward in a world coordinate system like UTM. The X-axis and Y-axis are instead oriented in the same way. Therefore, the conversion from relative to world system will require a reflection around the XY-plane, defined by the transformation matrix (10), which needs to be multiplied by the coordinates of the three points, generating three new points, O\({}_{R}\), G\({}_{R}\), and F\({}_{R}\), in the world coordinate system. \[ \begin{bmatrix}1&0&0\\ 0&1&0\\ 0&0&-1\end{bmatrix}  \tag{10}\]  
In this condition, O\({}^{\prime}\)\({}_{R}\) would be located in the origin of the axes, G\({}^{\prime}\)\({}_{R}\) and F\({}^{\prime}\)\({}_{R}\) would have the same X and Y coordinates, but Z would be negative. The distances, called DG and DF (see Figure 3), and the relative angles between the points remain unchanged. Let us now translate the points O\({}^{\prime}\)\({}_{R}\), G\({}^{\prime}\)\({}_{R}\), and F\({}^{\prime}\)\({}_{R}\) considering an ideal vector that goes from G\({}^{\prime}\)\({}_{R}\) to G\({}_{W}\). The transformation matrix would be as described in (11). \[\begin{bmatrix}1&0&0&X_{G_{W}}-X^{\prime}_{G_{R}}\\ 0&1&0&Y_{G_{W}}-Y^{\prime}_{G_{R}}\\ 0&0&1&Z_{GLet us call these points \(\mathrm{O^{\prime\prime}}_{R}\), \(\mathrm{G^{\prime\prime}}_{R}\) and \(\mathrm{F^{\prime\prime}}_{R}\), Figure 3a describes graphically this step. We need to underline that after this transformation, \(\mathrm{G^{\prime\prime}}_{R}=\mathrm{G_{W}}\) (real-world position of the reference point G). Moreover, once again, the distances (\(\mathrm{D_{G}}\) and \(\mathrm{D_{F}}\)) and relative angles remain unchanged.  
Let us now calculate the angle \(\beta\) between \(\overrightarrow{G_{W}F_{R}^{\prime\prime}}\) and \(\overrightarrow{G_{W}F_{W}}\) as follows:  
\[\beta=arccos\overrightarrow{\frac{G_{W}F_{R}^{\prime}}{|G_{W}F_{R}^{\prime \prime}|}\cdot\overrightarrow{G_{W}F_{W}}} \tag{12}\]  
The cross product will then indicate the sign (positive in the counterclockwise direction). Figure 3: Three-dimensional graphical representation of the transformations applied to retrieve the location of the camera center in the world coordinates system. Points \(\mathrm{O^{\prime}}_{R}\), \(\mathrm{G^{\prime}}_{R}\), and \(\mathrm{F^{\prime}}_{R}\), are translated considering the vector that goes from \(\mathrm{G^{\prime}}_{R}\) to \(\mathrm{G_{W}}\). Euclidean distances from \(\mathrm{O^{\prime}}_{R}\) to \(\mathrm{G^{\prime}}_{R}\) and \(\mathrm{O^{\prime}}_{R}\) to \(\mathrm{F^{\prime}}_{R}\) are called DG and DF, respectively. The relative coordinate system is indicated in light brown (**a**). The points generated after the translation are called \(\mathrm{O^{\prime\prime}}_{R}\), \(\mathrm{G^{\prime\prime}}_{R}\), and \(\mathrm{F^{\prime\prime}}_{R}\) In this condition, \(\mathrm{G^{\prime\prime}}_{R}\) overlaps \(\mathrm{G_{W}}\). Distances DG and DF and relative angles between the points remain the same. \(\mathrm{O^{\prime\prime}}_{R}\) and \(\mathrm{F^{\prime\prime}}_{R}\) are rotated by the angle \(\beta\) around the point \(\mathrm{G^{\prime\prime}}_{R}\). The world coordinate system is indicated in light blue (**b**). The rotation generates the point \(\mathrm{F^{\prime\prime\prime}}_{R}\), which overlaps the world point \(F_{W}\). Again, distances and relative angles between the points remain the same. The point \(\mathrm{O^{\prime\prime\prime}}_{R}\) is generated after the rotation is the wanted camera center in world coordinates \(\mathrm{O_{W}}\) (**c**). Finally, we can retrieve the real location of the camera in the world coordinate system. This can be achieved by rotating O\({}^{\prime\prime}{}_{R}\) horizontally by the angle \(\beta\) around the point G\({}_{W}\), generating a point that we may call O\({}^{\prime\prime\prime}{}_{R}\) (see Figure 3c). This can be obtained using the combined transformation matrix C given by the following:  
\[C=T_{G}^{i}\times R_{Horizontal}\times T_{G} \tag{13}\]  
where  
\[T_{G}=