# DSCope: Development of Automatic Program for Detecting Fractures and Measuring Dip Angles
## 2 Development of an Automated Program (DSCope)
### Detecting Fractures in Drilling Cores  
The fractures in each drilling core photograph processed in grayscale contain discontinuous lines in the cores. In other words, fractures in drilling core photographs can be detected if an edge can be identified. The edge in the photograph is taken using the Canny edge detector module in the scikit-image package [7]. This algorithm involves multi-step edge detection and was devised by [PERSON] [8], an Australian computer scientist. In the first step, the noise is reduced by applying a Gaussian filter. Then, the gradients in the x-axis direction (row direction) and y-axis direction (column direction) are calculated. Finally, the edge is extracted based on the maximum value of the gradient (G), which is calculated using Equation (1). If a gradient exists between the minimum and maximum, only the line connected to the maximum is recognized as the edge, and the rest are excluded. When this step, known as the hysteresis threshold method, is completed, the connected edge is treated as one, and the rest are considered to be zero:  
\[\text{G}=\sqrt{G_{x}^{2}+G_{y}^{2}} \tag{1}\]  
Figure 3 illustrates the Canny edge detection process. The original photograph is shown in the left column of the first row. The results of applying the Gaussian filter are shown in the middle and right columns of the same row. The difference between these two photographs is the difference in the \(\sigma\) values of the Gaussian filter. The larger the \(\sigma\) value, the more blurred the photograph becomes. This implies that the noise is blurred. In the second row, the gradient values calculated using Equation (1) are shown in grayscale. The gradient becomes blacker as it gets closer to 0 and white as it gets closer to 0.5. It can be seen that the larger \(\sigma\) is, the less detailed the features captured are. Finally, the edge is extracted by connecting the maximum parts as shown in the last row. In the original photograph, \(\sigma\) is considered to be zero. This example shows that selecting an appropriate value is crucial for edge extraction.  
Figure 2: Example of splitting three cores into separate cores and combining the RGB channel into grayscale.  
We present an example of applying this program to real drilling core photographs in Figure 4. During the process, 15% of both the left and right sides (a total of 30%) was excluded because those parts corresponded to the drilling core boxes. This could prevent detecting vertical boundaries which were not discontinuities on both transverse sides. The left part of Figure 4 is a photograph processed in grayscale after being split into each drilling core, and the red square indicates the area in which the Canny edge detector was applied. The original photograph of this area and the extracted edge are presented on the right. The blue shaded parts indicate parts expected to have fractures, depending on the settings. The applied settings included the size of the scanbox and threshold as well as \(\sigma\). The scanbox corresponded to the approximate longitudinal size (in pixels) of the fracture. Indeed, the size of the scanbox was the unit box to check whether there were fractures in the area. Finally, the threshold value was used to determine the existing fractures by counting the edge pixels in the scanbox. For example, if the threshold was set to 0.015 when the number of pixels was greater than 1.5% of the number of pixels constituting the scanbox area, the program recognized that the scanbox area had more than one fracture.  
Figure 3: Steps of Canny edge detection simulations with different sigma values.