## 2 Methodology
### RTAB-Map Method  
In this study, RTAB-Map was utilized to conduct the 3D dense reconstruction of pipes from UAV acquisition video data. RTAB-Map, which stands for real-time appearance-based mapping, consists of two main parts: the front-end and the back-end. The front-end focuses on attitude estimation based on features. For each RGB-D image, we extract GFTT features [21], known for their speed and robustness in low-light and low-texture environments, as opposed to other feature extractors like SIFT, SURF, and ORB. The nearest neighbor distance ratio (NNDR) test is used to identify image correspondence between frames, employing the binary BRIEF descriptor [22]. Once the feature correspondences are established, they are projected from 2D to 3D space using depth information. Relative changes are then computed by solving a least squares problem to optimize the 3D-3D correspondences. Outliers are eliminated using random sample consistency (RANSAC). A keyframe is selected as the input image if it has sufficient correspondence with previous keyframes and its distance/orientation to the nearest keyframe exceeds a certain threshold. Meanwhile, the poses are further optimized using bundle adjustment (BA). The BA is typically formulated as a least squares problem to adjust the camera's pose and the coordinates of the feature points by minimizing the reprojection error. In this process, a point in 3D space is projected onto the image plane to obtain a theoretical value \(u=h(\xi,P)\). \(h\) denotes the imaging process, \(\xi\) represents the camera's position in the camera coordinate  
Figure 2: Hardware architecture of UAV Acquisition System. system (Lie algebra representation), and \(P\) is the coordinate of the 3D point under the world coordinate system. To obtain the reprojection error \(e_{r}\),  
\[e_{r}=(z-u)^{2}=(z-h(\xi,P))^{2}, \tag{1}\]  
where \(z\) is the observed value (i.e., the pixel coordinates of the feature point on the camera image) and u is the theoretical value. Therefore, we construct a least squares problem for  
\[min\frac{1}{2}\sum_{i=1}^{m}|z-h(\xi,P)|_{2}^{2}=min\frac{1}{2}|f(x)|_{2}^{2} \tag{2}\]  
Here, BA optimization is to solve this least square problem. The back-end part incorporates visual loopback detection and graph optimization. Visual loop closure is achieved through bag-of-words modeling and Bayesian filters. The bag of words approach uses a collection of image features as words and focuses on the frequency of these words in the image, rather than their location. It employs binary image features that are more resilient to changes in illumination. Prior to using the bag-of-words model, the dictionary is trained offline. The descriptors of all the extracted image feature points are clustered, putting K-means into K sets. This clustering operation is repeated within each set to obtain the second level of the dictionary tree. The above operation is then repeated for subsequent levels, resulting in a dictionary tree with a branch K and depth L. Each word is assigned a weight based on its frequency of occurrence in the training set. Words that appear more frequently in the training set are assigned lower weights, as they have lower discriminative ability. The visual bag-of-words model is primarily utilized for efficiently calculating the similarity between the current bit-pose node and the candidate nodes. On the other hand, the Bayesian filter is employed to preserve the probability distribution of the similarity of all the candidate nodes. Let the current bit position be \(L_{t}\), and all candidate nodes to be detected are viewed as a whole and described by a random variable \(S_{t}\). Then, the probability of \(S_{t}=i\) indicates the size of the probability that \(L_{t}\) closes the loop with \(L_{i}\).