## 4 Methods
### Mosaic of borehole Video
#### 4.3.2 Proposed PTSAD Algorithm
Thus, the sum of the correlation coefficients for the horizontal projection vector and vertical projection vector could be used to distinguish the candidate image matching with the template from other candidate images. The quantity of candidate images that are input to the GPT module can affect the speed and accuracy of template matching. We calculated the matching accuracy of a different number of candidate images for testing 60 continuous borehole-wall unfolded images. The result shows that matching accuracy achieved the best results when the number of candidate images exceeded three. Therefore, to reduce the matching time, we extracted three candidate images with minimum SAD values to be input to the GPT module. The feature-based SIFT is another commonly used method in template matching, thus we conducted the same experiments with SIFT template matching. The results of SIFT matching are shown in Figure 20. Among these, Figure 20(a1,b1) are two successive frames of a borehole-wall unfolded image, which contain more texture features. Therefore, more feature points could also be detected and then elaborated by image descriptors in both images, as shown in Figure 20(a1,b1). Given enough feature points of potent matches, it was possible to achieve matching between the two images as shown in Figure 20(c1). The feature-based methods depend on supposing that enough effective feature points can be detected and paired successfully. If there were no clear features in the images, these methods would have a high matching error rate. Due to the decrease of effective feature points (in Figure 20(a2,b2)), there were a certain amount of mismatching points in the SIFT matching result, as shown in Figure 20(c2). Figure 19: Correlation coefficients of the three candidate images. Figure 20: The result of SIFT matching. (**a1**) and (**b1**) are SIFT extraction results of two successive frames of fracture images, (**c1**) is the matching result; (**a2**) and (**b2**) are SIFT extraction results of two successive frames of intact rock mass images and (**c2**) is the matching result. Finally, traditional template matching algorithms such as NCC and SAD, were also compared. An experiment was performed on the same two borehole-wall unfolded images to analyze the accuracy and efficiency of different template matching algorithms. A template of size 25 \(\times\) 40 pixels (Figure 21b) was extracted from the source image of size 660 \(\times\) 60 pixels (Figure 21a). Then the template was used in the examined image (Figure 21c) for the template matching process. Figure 21c-e shows the matching result of full-search NCC, full-search SAD and the proposed PTSAD methods, respectively. The experimental results indicate that the NCC and SAD algorithms could not locate the template accurately because of the interference of several factors such as image rotation, image blur, scale variation and illumination change between the examined image and source image. Apparently, it is obvious that the proposed method performed better than NCC or SAD, as shown in Figure 21e. ### Mosaic Results of Cylindrical Panorama

In this experiment, two videos obtained by AVBCS, recorded in a practical mining engineering application, were provided to verify the performance of our system. These two videos had 225 frames and 571 frames respectively. The first video sequence was inputted into the image filtering module to identify the invalid frames. The center offset \(d_{c}\), horizontal offset \(d_{h}\) and vertical offset \(d_{v}\) for 225 frames were acquired and are shown in Figure 14:0 In Figure 22, the values of \(d_{c}\) and \(d_{v}\) for most frames were limited to a small range, indicating that the vibration and rotation of the probe were generally minimal. However, for frame 26 to frame 51, these two values exceeded the permitted value. Meanwhile, the values of \(d_{h}\) for these frames were always 0 or 1. This means that the probe had stopped, accompanying strong vibration and rotation. Therefore, these frames should be considered as invalid frames.