## 3 The Practical Method of Automatic Recognition for Rock Structures
### Feature Matching of Structural Planes Based on the Sine Function  
Since the structural plane fracture in the expanded panoramic borehole image is a characteristic curve similar to a sine curve, this paper takes a sine curve as the characteristic function and then changes the parameters of the characteristic function in turn. We change the position, phase, and amplitude of the sine function to iteratively match the structural plane in the borehole image. We take each line as the initial position of the sine function,  
Figure 5: Results of the classification of structural planes. (**a**) Area division of the structural planes shown in Figure 3a; (**b**) Area division of the structural planes shown in Figure 3b. change the amplitude and phase of the sine function in turn at this position, and analyze the sum of the feature values of the pixels at the position where the sine curve passes each time. The sine curve with the smallest sum of grey values is selected as the characteristic curve of the structural plane. The characteristic function taken in this paper is shown in Equation (2):  
\[y(x)=y_{0}-\frac{D}{2}\tan\beta\cdot\sin(x\cdot\frac{2\pi}{W}+\alpha) \tag{2}\]  
In the equation, \(y_{0}\) is the initial position of the sine function, increasing and decreasing by line moving unit; \(D\) is the diameter of the borehole aperture; \(\alpha\) is the dip direction of the structural plane; \(\beta\) is the dip of the structural plane; and W is the width of the expanded view of the panoramic borehole image. For specific engineering conditions, the borehole diameter, \(D\), and the image width, W, are generally known constants. Among them, (\(D/2^{\star}\)tan \(\beta\)) constitutes the amplitude of the sine function, and the structural plane dip \(\beta\) increases and decreases sequentially from \(0^{\circ}\) to \(90^{\circ}\). In addition, the structural plane dip direction \(\alpha\) also constitutes the phase angle of the sine function, and the dip direction \(\alpha\) increases and decreases sequentially from \(0^{\circ}\) to \(360^{\circ}\). In engineering, the method for calculating the feature value of the pixel point of the panoramic borehole image can be expressed by the extreme value (or the opposite value) of the point and the sum of the horizontal and vertical gradients. The calculation equation is:  
\[g(i,j)=255-f(i,j)+|f(i+1,j)-f(i-1,j)|+|f(i,j+1)-f(i,j-1)| \tag{3}\]  
In the equation, \(f(i,j)\) represents the grey value of the pixel in the original image at \((i,j)\), while \(g(i,j)\) represents the feature value of the grey value of the pixel \((i,j)\) after calculation. The feature value of the pixel is used to determine whether the pixel is on the structure plane, and the sum of the feature values of the pixel is used to determine whether the sine curve is optimal under a certain condition. Thus, determining eigenvalue \(g(i,j)\) is the key to using the sine function to match structural plane parameters. It is also the basis for the feature point decision of Equation (2). The implementation steps of using the sine function to match the feature function of the panoramic borehole image structural plane are as follows. First, according to the result of the division of the structural plane area in part 2.1, starting from the position of the first row of each structural plane area, increase the dip and dip direction corresponding to the phase-amplitude value in turn (\(0^{\circ}\) to \(360^{\circ}\) and \(0^{\circ}\) to \(90^{\circ}\)). Next, statistically analyze the sum of the eigenvalues of the pixels passed by each sine curve. Then, select the sine curve with the largest sum of eigenvalues as the sine curve of the structural surface that may exist in the row, and perform the same operation in the next row. Finally, select one or more optimal sine curves from the possible sine curves of all lines as the characteristic curve of the structural plane of the area. Repeat until the entire structure area has been operated upon.