# An Enhanced Aircraft Carrier Runway Detection Method Based on Image Dehazing
## 3 Materials and Methods
### Runway Localization  
After the hazing removal algorithm processes the image, the UFLD algorithm infers runway points on the image. Due to various factors, it is necessary to filter and fit these detection points to accurately determine the positions of the detected left and right runway lines in the three-dimensional coordinate system. Furthermore, during the process of localization the runway lines, we utilized pixel depth information, which we obtained through two methods. When the CUAV is at a considerable distance from the carrier, accurate depth values cannot be obtained from the depth camera. Considering that there is an angle between the CUAV's heading direction and the normal vector of the sea surface, we can approximate the depth information to achieve coarse positioning of the runway lines. On the contrary, when the CUAV is closer to the carrier, the depth camera can accurately capture depth values, enabling precise positioning of the runway lines directly. Firstly, the runway points extracted by UFLD can be seen in Figure 7. Due to the accuracy of the runway detection algorithm and the uncertainty of parameters when manually annotating runway lines in images, points inferred by the network may deviate from the extension direction of the runway lines. As illustrated in Figure 7, the first three-runway points on the right side exhibit significant errors. Therefore, in the process of localization runway lines, it is necessary to eliminate runway points that cause large errors. Handling this problem in three-dimensional space is complex, thus necessitating the mapping of the runway to a two-dimensional space. Additionally, since points on runway lines should have the same height value, arithmetic operations can be performed in the pixel coordinate system. We can initially employ the Random Sample Consensus (RANSAC) method in the pixel coordinate system to remove outliers, facilitating the subsequent line-localization step in the global coordinate system. The process can be described as follows: Assuming there are \(i\) points in total, based on the principle of RANSAC, we can randomly select \(k\) points to perform the least squares localization (LSF) of a line. We use the distance from each point to the line as the error term and set a minimum error range. We then count the number of points falling within this range. If the number of points meets the criteria, we can consider the weights of the line appropriate. Then, we update the minimum error and recalculate until the minimum error no longer decreases. Figure 7: Runway points detection result. Secondly, after removing outliers, we need to map each point to three-dimensional space to fit the position of the runway line in the global coordinate system, achieving runway detection and localization. Pondering the trajectory of a CUAV from the starting point to above the flight deck, we can simplify this process as illustrated in Figure 8. Assuming that at the initial time instance, the position of the CUAV is \(p_{b_{0}}\) with the attitude \(R_{b_{0}}\), and when flying above the flight deck, the CUAV detects a point on the runway line at pixel coordinates \(p_{pix_{i}}\). At the moment, the position of the CUAV going to \(p_{b_{1}}\) with the attitude \(R_{b_{1}}\), the coordinates of this point in the body coordinate system relative to the initial time instance \(p_{g_{i}}\) can be written as:  
\[ \begin{split}& p_{cam_{i}}=depth\cdot\begin{bmatrix}f_{x}&0&c_{x}\\ 0&f_{y}&c_{y}\\ 0&0&1\end{bmatrix}^{-1}\cdot p_{pix_{i}},i=1,2,3,...\\ & p_{body_{i}}=R_{c}^{b}\cdot p_{c}+p_{b}^{c},\\ & p_{g_{i}}=R_{b_{1}}\cdot(R_{b_{0}})^{-1}\cdot p_{b}+p_{b_{1}}-p_{b_{0}}. \end{split}  \tag{4}\]  
\(p_{cam_{i}}\) denotes the coordinates of pixel point \(p_{pix_{i}}\) in the camera coordinate system, where \(i\) represents any point on the runway line, and \(p_{body_{i}}\) represents the coordinates of this point in the body coordinate system.