## 4 Methods
### Mosaic of borehole Video
#### 4.3.2 Proposed PTSAD Algorithm
1: Set \(T_{u\times v}\left(x,y\right)=P_{u\times v}\left(x,y\right)\), \(P^{u\times v}\in P^{m\times n}\), where \(u\times v\) is the size of image, Search area \(S_{\text{a}}\in R^{m\times n}\)
2: Obtain: Candidate images set {\(C\left(1\right)\), \(C\left(2\right)\),..., \(C\left(k\right)\)}, with step size 1 pixel
3: Compute: SAD value of \(T_{u\times v}\left(x,y\right)\) and {\(C\left(1\right)\), \(C\left(2\right)\),..., \(C\left(k\right)\)}
4:for\(s\) = 1, 2,..., \(k\)
5:\(C_{SAD}(s)=\sum\limits_{i=0}^{U-1}\sum\limits_{j=0}^{V}\left|C_{s}(x+i,y+i)-T( i,j)\right|\)
6:endfor
7: Obtain: SAD value of candidate images {\(C_{SAD}\) (1), \(C_{SAD}\) (2),..., \(C_{SAD}\) (k)}
8: Candidate images of three minimum SAD value: \(C\left(R\right)\), \(C\left(G\right)\), \(C\left(B\right)\), where \(C\left(R\right)<C\left(G\right)<C\left(B\right)\)
9: Compute: Projection vectors in \(X\)-axis of \(T\left(x,y\right)\), \(C\left(R\right)\), \(C\left(G\right)\) and \(C\left(B\right)\)
10:for\(i\) = 1,



### Image Filtering Module

Ideally, the probe goes forward along the central axis of the pre-drilled borehole with uniform motion and without any shaking. However now this process works in manual mode, it will affect the motion of the probe directly. The irregular movement of the probe usually involves vibration, rotation and stagnation. Vibration and rotation will cause deviation between the geometric center of the image and the drilled hole center, which can lead to serious image geometric distortion during the image unwrapping process. Stagnation produces a large number of duplicate images. In general, the vibration and rotation of a probe are always accompanied with the stagnation of probe. The impact of slight vibration and stagnation can be resolved by the center location module (Section 4.1) and horizontal offset correction of unfolded images (Section 4.3), respectively. However, the stagnation of a probe, and severe vibration and stagnation are very hard to settle by image processing techniques. Therefore, the invalid video frames caused by these factors should be identified and removed before generating a cylindrical panorama. After locating the drilled hole center, the offset between the geometric center and the drilled hole center can be computed, which is represented by \(d_{c}\). The horizontal and vertical offset can be obtained from the matching parameters, which are represented by \(d_{h}\) and \(d_{v}\) respectively. The parameters \(d_{c}\), \(d_{h}\) and \(d_{v}\) are used to monitor the vibration, rotation and stagnation respectively. Before generating the cylindrical panorama, if the value of one of the three parameters value exceeds the normal range value, the frame is regarded as an invalid frame and cannot be used in the image mosaic process. The threshold range for \(d_{c}\), \(d_{h}\) and \(d_{v}\) is preset by the following. \[\left\{ \begin{array}{l}0\leq d_{c}\leq 7\\ 0\leq d_{h}\leq 3\\ d_{v}>2\end{array} \right.. \tag{6}\]

## 5 Experimental Results and Analysis

### Image Acquisition System

In this paper, the YTJ20 type of axial view borehole camera system (AVBCS) was selected, which was composed of a camera, video transmission line, digital depth counter and control box. (as illustrated in Figure 11). The diameter and length of the probe was 25 mm and 100 mm respectively. The equipment had 8 h of continuous running time and 2 GB of storage capacity. In order to observe the geological structure, engineers position the probe in a pre-drilled borehole to capture videos. A camera was mounted on the top of the probe, which could obtain videos of the effective lighting area, as illustrated in Figure 12. The resolution of video sequences obtained by the AVBCS was about 0.1 mm and the acquired images were both of 320 pixels \(\times\) 240 pixels. Figure 11: YTJ20 type of an axial view borehole camera system (AVBCS). During the detection process of the drilling hole, the AVBCS captured borehole videos and sent them to our data-processing system.