# UAV-Based Airport Lights Inspection Without GNSS Positioning Support
## 3 Materials and Methods
### Tracking of Airport Lights  
The next step of executing the range imaging technique SfM is the task of estimating the 3D position of the camera--the tracking of the position. This task requires the evaluation of transform coefficients, which indicate the way the UAV changes its space position during the mission. The coefficients are obtained by solving the set of equations describing changes in light positions in the series of images registered during the mission. Function _alamp_ executes the task of tracking lights and maintaining the light data base for evaluating the light conditions. The tracking starts with the operation of computing the first camera position. The camera position is calculated using geodesic data describing the positions of the detected lights and their image pixel coordinates [36; 37]. The position is expressed using pixel coordinates or using a chosen coordinate system, e.g., EPSG: 217x, related to the geodesic documentation of airport lights. To facilitate the calculations, positions are expressed relative to a defined reference point of the airport. The tracking task is reduced to matching pairs of light positions in consecutive video frames. The camera of the ascending UAV views the light from a different height; this causes a change in its position on the image. The change amounts to a few pixels and does not exceed the distance to another light. The search for a match is restricted to the neighbourhood that contains only the new position of the pair. The positions of lights or camera are determined using Perspective-n-Point pose computation [38]. Set of Equation (1) is solved to find the mapping of the set of airport lights in the airport space [X, Y, Z] to the set of light positions on the camera image [x, y]:  
\[ \begin{bmatrix}\mathbf{x}\\ \mathbf{y}\\ 1\end{bmatrix} =s \begin{bmatrix}f_{x}&0&c_{x}\\ 0&f_{y}&c_{y}\\ 0&0&1\end{bmatrix}\begin{bmatrix}r_{11}&r_{12}&r_{13}&t_{x}\\ r_{21}&r_{22}&r_{23}&t_{y}\\ r_{31}&r_{32}&r_{33}&t_{z}\end{bmatrix}\begin{bmatrix}\mathbf{X}\\ \mathbf{Y}\\ \mathbf{Z}\end{bmatrix}  \tag{1}\]  
where  
\(f_{x},f_{y},c_{x},c_{y}\)--camera calibration parameters;  
--scale mapping of airport coordinates to image space;  
\(r_{ii}\)--rotation matrix of the camera (converted to vector _rvec_);  
\(t_{i}\)--translation vector of the camera (_tvec_). The number of equations is equal to the number of paired lights. At least 3 pairs are needed to calculate the camera position--_rvec_, _tvec_. Increasing the number of lights enhances the robustness of calculation but requires more computing power. Once the camera position is determined, it is saved in the camera position table. The consecutive positions are used to calculate the light positions in the following images. The calculated light positions are paired with the geodesic documentation of the airport. Figure 3: Description of an airport light. Paired lights constitute the data base for evaluating the light conditions at the airport. Light descriptions are added to the data base until the light moves outside the view of the camera during the UAV flight. Changes in the parameters of the light during observation are collected. These changes are the result of changes in the angle of observation of the camera during the flight. Figure 4 presents an example of detected and described lights. Blue rectangles indicate detected lights and white numbering confirms the identification. Violet rectangles contain objects outside the detection area. Blue crosses show the calculated positions of lights using the elaborated camera position. The crosses do not fall exactly at the centres of the lights but are sufficiently near to prevent the miss pairing of the lights. Analysis of the course of the change in the light size related to the position in space of the UAV enables the assessment of the angle of illumination of the light. The maximum light size indicates the direction of illumination and can be compared with the airport documentation. Correct angles of illumination secure the safe operation of the airport runways.