DSCope: Development of Automatic Program for Detecting Fractures and Measuring Dip Angles

: Changes in underground environments have been predicted by investigating underground bedrock conditions and analyzing the shapes of discontinuities in the rocks. The most commonly used method is to drill a borehole, insert a camera inside and capture the wall of the borehole in a photograph to investigate the discontinuities. However, if the images of the borehole cannot be captured, the characteristics of the discontinuities in the bedrock are analyzed by capturing the drilling cores in photographs. In this case, considerable time is required to analyze the drilling cores with the naked eye and measure the attitudes of the discontinuities developed in the cores in detail. Moreover, the results may vary depending on the researcher’s perspective. To overcome these limitations, this study develops a program for analyzing photographs of drilling cores. The program can automatically identify discontinuities in drilling cores and measure the attitudes through linear ﬁtting using only drilling core photographs. In addition, we apply the program to practical ﬁeld data to verify its applicability. We found that the program could provide more accurate and objective information on drilling cores than the currently used method and could more effectively organize the characteristics of fractures in the study area.


Introduction
Groundwater containing oxygen flowing underground can lead to changes in the underground environment. Drilling investigations are generally conducted for geological surveys of the deep underground, which is analyzed based on the drilling cores identified during drilling investigations. The types of rocks underground, the tectonic features and the attitude of discontinuities can be verified through drilling. Various characteristics can be analyzed through borehole logging and by capturing photographs during the drilling operation. In particular, photographs of boreholes are generally used to analyze the distribution or attitude of discontinuities. The distribution characteristics of discontinuities are examined to predict the movement of surface water or groundwater as well as the distribution of the results of tectonic movements such as faults or folds.
In most cases, excluding the one in which the borehole is captured in a photograph during drilling, the recovered drilling core is analyzed and organized with the naked eye to identify the distribution and attitude of any discontinuities. The dip angle among the elements indicating the attitude of the discontinuities can play a key role in predicting the flow of surface water or groundwater [1][2][3]. The most commonly used method is to drill a borehole, insert a camera inside and capture the wall of the borehole in a photograph to investigate the discontinuities. However, this method requires specialists and is expensive. It is therefore inconvenient for the investigator to directly measure the discontinuities of the lifted drilling cores with the naked eye. It is easy to visually analyze a shallow drilling core, but that is not the case with a deep drilling core.
Some researchers published papers analyzing the value of rock quality designation (RQD) or the distribution of fractures using photos of core samples [4,5]. Some of these methods can be analyzed only when expensive software is used [6]. However, the method in this study used simple tools that investigators could carry around to take pictures and used them to analyze the slope angles of drilling cores in the field easily and quickly.
This study develops an automated program written in Python for accurate and rapid analysis of drilling cores, thereby addressing the inconvenience of visual inspection in determining the dip angle of discontinuities for drilling cores. This automated program can quickly and accurately measure the dip angle of discontinuities in an indoor space by using photographs of the drilling cores. The reliability of the program is verified by applying it to the representative granite of South Korea. The results show that the developed program is satisfactorily reliable and can measure the dip angle of discontinuities quickly and accurately.

Development of an Automated Program (DSCope)
The Detecting Structures (of Cores) Code Over Practical Eyes (DSCope) program automatically detects fractures in the photographs of drilling cores and determines the dip angles of the detected fractures through linear function fitting. It was developed using Python; therefore, it can be used regardless of the operating system (e.g., Windows or Linux). Because the version of the package differs from the Python version, the results obtained can vary even if the same photograph and settings are given as the input. To prevent this, DSCope was developed using Python version 2.7. The update for Python 2 is no longer supported after Python version 2.7 released in January 2020. Therefore, the same result could be obtained using Python 2.7 regardless of the computer environment. Moreover, the standard library can be installed easily using Anaconda, and the DSCope code was written with the packages of the standard library that support convenient installation on Anaconda.
DSCope progresses in three steps. For DSCope to work, the setting file is created first as shown in Figure 1. A list of drilling core photographs is generated based on the input values of the setting file. Next, the number of cores is input into the list of drilling core photographs. Each core photograph is obtained by equally splitting the drilling photographs by the number of cores. During this process, each drilling core photograph is converted into grayscale. They are then rotated 90 • clockwise to sort the direction and determine the depth from top to bottom. A list of each drilling core photograph is simultaneously created and used in the subsequent step. Finally, the fractures are identified, and the dip angles are measured by receiving the setting file created in the first step and the list of each drilling core photograph created in the previous step. sive. It is therefore inconvenient for the investigator to directly measure the discontinuities of the lifted drilling cores with the naked eye. It is easy to visually analyze a shallow drilling core, but that is not the case with a deep drilling core. Some researchers published papers analyzing the value of rock quality designation (RQD) or the distribution of fractures using photos of core samples [4,5]. Some of these methods can be analyzed only when expensive software is used [6]. However, the method in this study used simple tools that investigators could carry around to take pictures and used them to analyze the slope angles of drilling cores in the field easily and quickly.
This study develops an automated program written in Python for accurate and rapid analysis of drilling cores, thereby addressing the inconvenience of visual inspection in determining the dip angle of discontinuities for drilling cores. This automated program can quickly and accurately measure the dip angle of discontinuities in an indoor space by using photographs of the drilling cores. The reliability of the program is verified by applying it to the representative granite of South Korea. The results show that the developed program is satisfactorily reliable and can measure the dip angle of discontinuities quickly and accurately.

Development of an Automated Program (DSCope)
The Detecting Structures (of Cores) Code Over Practical Eyes (DSCope) program automatically detects fractures in the photographs of drilling cores and determines the dip angles of the detected fractures through linear function fitting. It was developed using Python; therefore, it can be used regardless of the operating system (e.g., Windows or Linux). Because the version of the package differs from the Python version, the results obtained can vary even if the same photograph and settings are given as the input. To prevent this, DSCope was developed using Python version 2.7. The update for Python 2 is no longer supported after Python version 2.7 released in January 2020. Therefore, the same result could be obtained using Python 2.7 regardless of the computer environment. Moreover, the standard library can be installed easily using Anaconda, and the DSCope code was written with the packages of the standard library that support convenient installation on Anaconda.
DSCope progresses in three steps. For DSCope to work, the setting file is created first as shown in Figure 1. A list of drilling core photographs is generated based on the input values of the setting file. Next, the number of cores is input into the list of drilling core photographs. Each core photograph is obtained by equally splitting the drilling photographs by the number of cores. During this process, each drilling core photograph is converted into grayscale. They are then rotated 90° clockwise to sort the direction and determine the depth from top to bottom. A list of each drilling core photograph is simultaneously created and used in the subsequent step. Finally, the fractures are identified, and the dip angles are measured by receiving the setting file created in the first step and the list of each drilling core photograph created in the previous step. In DSCope, multiple drilling cores are taken in a single box to capture multiple photographs of the drilling core boxes and analyze them. It assumes that the drilling core box gets deeper from the top to bottom and from left to right. Based on this assumption, each core photograph is generated and numbered sequentially, starting with the top core. These photographs are then arranged in terms of the depth direction after being rotated clockwise. Under the assumption that they are color photographs, the RGB channel is combined into the average value to transform them into grayscale (see Figure 2).  In DSCope, multiple drilling cores are taken in a single box to capture multiple photographs of the drilling core boxes and analyze them. It assumes that the drilling core box gets deeper from the top to bottom and from left to right. Based on this assumption, each core photograph is generated and numbered sequentially, starting with the top core. These photographs are then arranged in terms of the depth direction after being rotated clockwise. Under the assumption that they are color photographs, the RGB channel is combined into the average value to transform them into grayscale (see Figure 2).

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 John F. Canny [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:

G
(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 σ values of the Gaussian filter. The larger the σ 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 whiter as it gets closer to 0.5. It can be seen that the larger σ is, the less detailed the features captured are. Finally, the

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 John F. Canny [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: 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 σ values of the Gaussian filter. The larger the σ 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 whiter as it gets closer to 0.5. It can be seen that the larger σ 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, σ is considered to be zero. This example shows that selecting an appropriate value is crucial for edge extraction.
Appl. Sci. 2021, 11, x FOR PEER REVIEW 4 of 14 edge is extracted by connecting the maximum parts as shown in the last row. In the original photograph, σ is considered to be zero. This example shows that selecting an appropriate value is crucial for edge extraction. 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 σ.
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. 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 σ.
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. Appl. Sci. 2021, 11, x FOR PEER REVIEW 5 of 14

Measuring the Dip Angle of a Frature
Linear fitting was performed based on the pixel position of the detected edge. The polyfit module of the Numpy package [9] was used for linear fitting. This module uses the least squares method to estimate values corresponding to the coefficients and constants. Fitting was performed in such a way that the squared residual (r), composed of the expected function and the actual observation y , became the smallest according to Equation (2). Subsequently, the arctangent (tan ) could be obtained from the coefficient ( ), derived through linear fitting, and was converted to an angle: Three or more data points were required to perform the linear fitting. Thus, the code was written such that fitting was not performed at the edges with fewer than six pixels. This can be useful in cases where the spots on drilling cores or patterns on rocks can also be captured as edges. In other words, linear fitting may be performed for four or five pixels when a small scanbox and a low threshold are applied to detect as many fractures as possible. However, since it is difficult to consider them as real fractures, linear fitting with fewer than six pixels is excluded from the fractures. Figure 5 shows an example of the detection of fractures and dip angle measurements. The red solid line indicates the edge detected using Canny edge detection. The result of linear fitting to the pixel coordinates of the edge is indicated by a blue dashed line. In the lower right, the dip angles measured through linear fitting are depicted. The DSCope program detected five fractures, as shown in Figure 5, but the wood chip that was added to indicate the depth could not be considered a fracture. Therefore, the other four results are presented.

Measuring the Dip Angle of a Frature
Linear fitting was performed based on the pixel position of the detected edge. The polyfit module of the Numpy package [9] was used for linear fitting. This module uses the least squares method to estimate values corresponding to the coefficients and constants. Fitting was performed in such a way that the squared residual (r), composed of the expected function f (x i ) and the actual observation y i , became the smallest according to Equation (2). Subsequently, the arctangent (tan −1 (a)) could be obtained from the coefficient (a), derived through linear fitting, and was converted to an angle: Three or more data points were required to perform the linear fitting. Thus, the code was written such that fitting was not performed at the edges with fewer than six pixels. This can be useful in cases where the spots on drilling cores or patterns on rocks can also be captured as edges. In other words, linear fitting may be performed for four or five pixels when a small scanbox and a low threshold are applied to detect as many fractures as possible. However, since it is difficult to consider them as real fractures, linear fitting with fewer than six pixels is excluded from the fractures. Figure 5 shows an example of the detection of fractures and dip angle measurements. The red solid line indicates the edge detected using Canny edge detection. The result of linear fitting to the pixel coordinates of the edge is indicated by a blue dashed line. In the lower right, the dip angles measured through linear fitting are depicted. The DSCope program detected five fractures, as shown in Figure 5, but the wood chip that was added to indicate the depth could not be considered a fracture. Therefore, the other four results are presented. Appl. Sci. 2021, 11, x FOR PEER REVIEW 6 of 14

Field Drilling Data
The rocks used in this study were biotite granites from the Jurassic Period of the Mesozoic Era belonging to the Okcheon Metamorphic Belt. The Precambrian gneiss complex was located in the southeastern part of the study area. The quartzose dike partially penetrated the Jurassic biotite granites during the Cretaceous Period of the Mesozoic Era. Faults were found in the surroundings of this area due to the effect of the Okcheon Metamorphic Belt ( Figure 6 [10]).
The samples used in this study had a diameter of 55 mm from the surface down to 700 m underground ( Figure 7). As described above, the majority of the rocks were Mesozoic biotite granites. There are fault zones and fracture zones in some sections of this area. The sample colors consisted of typical bright white granite and dark spots. The fault zone and fracture zone showed a complex fracture composition resulting from the various fractures generated during the formation process. In our study area, there was an alteration zone along the fault zone. This alteration zone was characterized by its red color, which was a result of oxidation.

Field Drilling Data
The rocks used in this study were biotite granites from the Jurassic Period of the Mesozoic Era belonging to the Okcheon Metamorphic Belt. The Precambrian gneiss complex was located in the southeastern part of the study area. The quartzose dike partially penetrated the Jurassic biotite granites during the Cretaceous Period of the Mesozoic Era. Faults were found in the surroundings of this area due to the effect of the Okcheon Metamorphic Belt (Figure 6 [10]).
The samples used in this study had a diameter of 55 mm from the surface down to 700 m underground ( Figure 7). As described above, the majority of the rocks were Mesozoic biotite granites. There are fault zones and fracture zones in some sections of this area. The sample colors consisted of typical bright white granite and dark spots. The fault zone and fracture zone showed a complex fracture composition resulting from the various fractures generated during the formation process. In our study area, there was an alteration zone along the fault zone. This alteration zone was characterized by its red color, which was a result of oxidation. Appl. Sci. 2021, 11, x FOR PEER REVIEW 7 of 14

Comparision of Differences Arccording to the Settings
We verified the effect of σ as it is one of the most important factors that must be considered when detecting fractures. For this purpose, we defined the bottom threshold (B-threshold) to not miss any fractures, even though non-fractures were detected as fractures. In other words, the B-threshold was the minimum value for detecting most fractures. Approximately 50 drilling cores down to a depth of 50 m were compared using field data. The differences in the B-threshold when it was set to 4.5σ and 5.0σ were examined, and they are shown in Figure 8.

Comparision of Differences Arccording to the Settings
We verified the effect of σ as it is one of the most important factors that must be considered when detecting fractures. For this purpose, we defined the bottom threshold (B-threshold) to not miss any fractures, even though non-fractures were detected as fractures. In other words, the B-threshold was the minimum value for detecting most fractures. Approximately 50 drilling cores down to a depth of 50 m were compared using field data. The differences in the B-threshold when it was set to 4.5σ and 5.0σ were examined, and they are shown in Figure 8.

Comparision of Differences Arccording to the Settings
We verified the effect of σ as it is one of the most important factors that must be considered when detecting fractures. For this purpose, we defined the bottom threshold (Bthreshold) to not miss any fractures, even though non-fractures were detected as fractures. In other words, the B-threshold was the minimum value for detecting most fractures. Approximately 50 drilling cores down to a depth of 50 m were compared using field data. The differences in the B-threshold when it was set to 4.5σ and 5.0σ were examined, and they are shown in Figure 8.

Comparison with Visual Analysis
The red and blue indicate the settings of 4.5σ and 5.0σ, respectively. The bars indicate the distribution of the B-threshold, and the dashed line indicates the Gaussian profile fitting of each distribution. When the σ value increases, a lower B-threshold is required because the drilling core fractures become weaker. Nevertheless, neither the histogram (bar in Figure 8) nor the Gaussian profile fitting (dashed line in Figure 8) showed significant differences.
The averages obtained by Gaussian profile fitting for the B-thresholds of 4.5σ and 5.0σ were 7.101‰ and 6.126‰, indicated by the red and blue letters, respectively, in Figure 8. The standard deviations were 0.003680 and 0.002922, respectively. These values were tested for statistical significance at a confidence level of 95% (Z 1.960) using the Z-test as presented in Equation (3). The Z-test value was 1.438, which was smaller than 1.960, indicating that the two groups did not have a statistically significant difference: In addition, the effect of the σ value on the result was verified once again using a scatter plot and Pearson correlation. Because the corresponding relation could not be recognized by the average and standard deviation, the actual linear correlation was established and examined. Figure 9 shows the results, where the x-axis and y-axis represent Bthresholds of 4.5σ, and 5.0σ, respectively. The solid line corresponds to where both the Bthresholds were identical, and the dashed lines indicate values ±0.002. The color of the dot represents the discrepancy between the two B-thresholds. If the color is closer to black, it means the B-threshold of 4.5σ had a larger value. Conversely, if the color is closer to white, it means that the B-threshold of 5.0σ had a larger value. It can be seen that most dots are located above the solid line or within the range of the dashed lines. In the additional analysis, the Pearson correlation was found to be approximately 0.87, indicating that the two values had high correlation.

Comparison with Visual Analysis
The red and blue indicate the settings of 4.5σ and 5.0σ, respectively. The bars indicate the distribution of the B-threshold, and the dashed line indicates the Gaussian profile fitting of each distribution. When the σ value increases, a lower B-threshold is required because the drilling core fractures become weaker. Nevertheless, neither the histogram (bar in Figure 8) nor the Gaussian profile fitting (dashed line in Figure 8) showed significant differences.
The averages obtained by Gaussian profile fitting for the B-thresholds of 4.5σ and 5.0σ were 7.101‰ and 6.126‰, indicated by the red and blue letters, respectively, in Figure 8. The standard deviations were 0.003680 and 0.002922, respectively. These values were tested for statistical significance at a confidence level of 95% (Z = 1.960) using the Z-test as presented in Equation (3). The Z-test value was 1.438, which was smaller than 1.960, indicating that the two groups did not have a statistically significant difference: In addition, the effect of the σ value on the result was verified once again using a scatter plot and Pearson correlation. Because the corresponding relation could not be recognized by the average and standard deviation, the actual linear correlation was established and examined. Figure 9 shows the results, where the x-axis and y-axis represent B-thresholds of 4.5σ, and 5.0σ, respectively. The solid line corresponds to where both the B-thresholds were identical, and the dashed lines indicate values ±0.002. The color of the dot represents the discrepancy between the two B-thresholds. If the color is closer to black, it means the B-threshold of 4.5σ had a larger value. Conversely, if the color is closer to white, it means that the B-threshold of 5.0σ had a larger value. It can be seen that most dots are located above the solid line or within the range of the dashed lines. In the additional analysis, the Pearson correlation was found to be approximately 0.87, indicating that the two values had high correlation. Appl. Sci. 2021, 11, x FOR PEER REVIEW 9 of 14

Distribution of Fracture Dip Angles
Based on the above results, analysis was conducted to statistically set values such as the thresholds. To achieve this, the background noise of the rock needed to be set. The results of analyzing 4.5σ and 5.0σ showed that at a difference of 0.5σ, the standard deviation of the B-threshold for detecting fractures increased by 0.001. Hence, the noise distribution of the rock background was assumed to have a normal distribution with an average of 0 and a standard deviation of 0.011. Figure 10 presents this as a graph. The black line indicates the background noise, and the red dashed line and blue dotted line indicate the settings for 4.5σ and 5.0σ, respectively. According to these settings, the ranges with higher detection rates than noise are indicated by arrows of different colors. In the setting for 4.5σ, using a threshold value between 1.6% and 14.4% could detect fractures well. The point with the maximum difference of 7.3% is the red vertical line. In the setting for 5.0σ, the threshold value needed to be set to 1.4% or higher or 11.8% or lower. The threshold value showing the largest difference with the background noise was 6.2% (blue vertical line).

Distribution of Fracture Dip Angles
Based on the above results, analysis was conducted to statistically set values such as the thresholds. To achieve this, the background noise of the rock needed to be set. The results of analyzing 4.5σ and 5.0σ showed that at a difference of 0.5σ, the standard deviation of the B-threshold for detecting fractures increased by 0.001. Hence, the noise distribution of the rock background was assumed to have a normal distribution with an average of 0 and a standard deviation of 0.011. Figure 10 presents this as a graph. The black line indicates the background noise, and the red dashed line and blue dotted line indicate the settings for 4.5σ and 5.0σ, respectively. According to these settings, the ranges with higher detection rates than noise are indicated by arrows of different colors. In the setting for 4.5σ, using a threshold value between 1.6% and 14.4% could detect fractures well. The point with the maximum difference of 7.3% is the red vertical line. In the setting for 5.0σ, the threshold value needed to be set to 1.4% or higher or 11.8% or lower. The threshold value showing the largest difference with the background noise was 6.2% (blue vertical line).
Reliability was verified by comparing the results from the visual analysis with the results obtained from the DSCope program. The data used for verifying reliability were the same as the data used to verify the differences according to the settings. Around 50 cores down to 50 m in depth were used for comparison with the results from the visual analysis. The settings used in this analysis were σ = 4.7 and threshold = 7%. In addition, only the middle parts of the core photographs were used after cutting off approximately 30% from both sides.
The DSCope program recognized 366 fractures in total. However, 87 of them were in the fracture zone and thus excluded, because it was impossible to measure the dip angles using linear fitting. Furthermore, 173 wood chips inserted in the middle to mark the depth of the drilling cores and parts of the tops and bottoms of the drilling cores were excluded from the results because they were not fractures. In other words, 106 fractures were automatically measured by DSCope. Among the 138 fractures whose dip angles could be measured, 106 fractures (77%) were automatically measured by DSCope, and 32 fractures were manually detected and added. Of the 32 fractures, 6 parts were detected and measured manually because they could not be detected by DSCope. When two or more fractures were detected in one scanbox, the fractures were measured after changing the scanbox to a smaller size (i.e., 14 parts). However, two of them were excluded because they could not be automatically measured by the program. When the dip angle measurement was inaccurate due to noise, the angle was measured again. A total of 16 fractures were measured again, but 2 of them could not be measured due to noise hindering the marking of the edges. We present the results in Figure 11. Reliability was verified by comparing the results from the visual analysis with the results obtained from the DSCope program. The data used for verifying reliability were the same as the data used to verify the differences according to the settings. Around 50 cores down to 50 m in depth were used for comparison with the results from the visual analysis. The settings used in this analysis were σ 4.7 and threshold = 7%. In addition, only the middle parts of the core photographs were used after cutting off approximately 30% from both sides.
The DSCope program recognized 366 fractures in total. However, 87 of them were in the fracture zone and thus excluded, because it was impossible to measure the dip angles using linear fitting. Furthermore, 173 wood chips inserted in the middle to mark the depth of the drilling cores and parts of the tops and bottoms of the drilling cores were excluded from the results because they were not fractures. In other words, 106 fractures were automatically measured by DSCope. Among the 138 fractures whose dip angles could be measured, 106 fractures (77%) were automatically measured by DSCope, and 32 fractures were manually detected and added. Of the 32 fractures, 6 parts were detected and measured manually because they could not be detected by DSCope. When two or more fractures were detected in one scanbox, the fractures were measured after changing the scanbox to a smaller size (i.e., 14 parts). However, two of them were excluded because they could not be automatically measured by the program. When the dip angle measurement was inaccurate due to noise, the angle was measured again. A total of 16 fractures were measured again, but 2 of them could not be measured due to noise hindering the marking of the edges. We present the results in Figure 11.
The results of the visual analysis and DSCope analysis are summarized in Table 1. The DSCope code detected 86% of the fractures at low angles (0-30°) and reproduced 64% of the fractures at medium angles (30-60°). However, it could measure only 8% of the fractures at high angles (60-90°), which were believed to be influenced by the fracture zones. The reason this problem happened was that most fractures with high angles were located in the fracture zones, which excluded them from the DSCope results.

Discussion
The DSCope program measured the dip angles of the fractures by analyzing photographs of drilling cores. The fracture angles could be measured more precisely and accurately if the existing televiewers were used. However, televiewer exploration is disadvantageous because accurate data cannot be obtained unless the survey is performed simultaneously with the drilling or immediately after drilling. The advantage of DSCope is that it is not limited by time, because the core photographs are taken and analyzed after drilling. Moreover, the fractures can be analyzed by additionally shooting photographs if the drilling core is stored.
However, the results obtained can vary depending on the camera settings and environmental conditions under which the photographs were taken. Even if all the photographs are captured under the same environmental conditions, the results may still vary due to different camera settings such as the ISO, aperture value (f value), shutter speed and white balance. To avoid this, the photographs were analyzed after converting them into grayscale. This minimized the discrepancies related to color.
The DSCope program developed in this study was designed to estimate the dip angles of the fractures (discontinuities) through linear fitting. Therefore, an incorrect result was produced when it was applied to nonlinear fractures. When there were two or more The results of the visual analysis and DSCope analysis are summarized in Table 1. The DSCope code detected 86% of the fractures at low angles (0-30 • ) and reproduced 64% of the fractures at medium angles (30-60 • ). However, it could measure only 8% of the fractures at high angles (60-90 • ), which were believed to be influenced by the fracture zones. The reason this problem happened was that most fractures with high angles were located in the fracture zones, which excluded them from the DSCope results.

Discussion
The DSCope program measured the dip angles of the fractures by analyzing photographs of drilling cores. The fracture angles could be measured more precisely and accurately if the existing televiewers were used. However, televiewer exploration is disadvantageous because accurate data cannot be obtained unless the survey is performed simultaneously with the drilling or immediately after drilling. The advantage of DSCope is that it is not limited by time, because the core photographs are taken and analyzed after drilling. Moreover, the fractures can be analyzed by additionally shooting photographs if the drilling core is stored.
However, the results obtained can vary depending on the camera settings and environmental conditions under which the photographs were taken. Even if all the photographs are captured under the same environmental conditions, the results may still vary due to different camera settings such as the ISO, aperture value (f value), shutter speed and white balance. To avoid this, the photographs were analyzed after converting them into grayscale. This minimized the discrepancies related to color.
The DSCope program developed in this study was designed to estimate the dip angles of the fractures (discontinuities) through linear fitting. Therefore, an incorrect result was produced when it was applied to nonlinear fractures. When there were two or more fractures in one scanbox or multiple fractures were generated in a fracture zone, they could be detected, but their dip angles could not be measured. To address this problem, we developed a GUI to select only those results that had a good linear fit, because the existence or absence of a fracture zone could be easily distinguished with the naked eye. The selected results could be organized separately.
Lastly, the resolution (size) of the photographs also affected the analysis of DSCope. A resolution of 4000 × 3000 pixels was considered appropriate for effective analysis using DSCope.

Conclusions
Analysis of the drilling cores obtained from drilling investigations is essential for determining the rock conditions and geotechnical properties of the target area. Previously, however, expensive televiewer or 3D laser systems were required to conduct quantitative and precise analyses. In addition, methods for finding the discontinuities of drilling cores and roughly estimating the dip angles with visual analysis were used. For such a visual analysis, a drilling core is cut to a certain depth (e.g., 1 m), placed in a box and then photographed. Analyzing photographs with the naked eye is a general method that has wide applications. However, the results obtained using this method may vary significantly because of the differences in the ways different researchers analyze photographs.
To address this, we developed a program in Python to automatically identify discontinuities and measure the dip angles of the identified discontinuities by analyzing existing photographs of drilling cores without the use of expensive systems. The program automatically performs analysis under the condition that the settings (e.g., number of cores, σ, threshold, scanbox and trimming) are in the text file, which can be modified by a user for analyzing drilling core photographs. Furthermore, the same criteria can be applied to multiple photographs collectively, and it only takes approximately 10 s to analyze a single photograph. Therefore, several photographs can be analyzed at a much faster rate than in conventional visual analysis. Furthermore, the program is numerically more precise, accurate and objective than visual analysis.
To verify the applicability of the program to actual field data, it was applied to the drilling cores in the granite area of the Mesozoic Jurassic Period, and the results were compared with those of visual analysis. Based on the comparison results, the program automatically recognized 83% of the discontinuities that were confirmed with the naked eye. In particular, the results for the low angles reproduced approximately 86% of the visual analysis results. Notably, a distinct feature of our program is that discontinuities that are not automatically identified can be added to the results using GUIs, which were separately developed. To be precise, three additional GUIs were developed: one GUI for finding the appropriate value for batch application by immediately reflecting the settings, one GUI for splitting the core box photographs, including the drilling cores, into each drilling core photograph and one GUI for checking and selecting the results (see Figure 12). These GUIs were used to overcome the shortcomings of batch analysis.
for analyzing drilling core photographs. Furthermore, the same criteria can be applied to multiple photographs collectively, and it only takes approximately 10 s to analyze a single photograph. Therefore, several photographs can be analyzed at a much faster rate than in conventional visual analysis. Furthermore, the program is numerically more precise, accurate and objective than visual analysis.
To verify the applicability of the program to actual field data, it was applied to the drilling cores in the granite area of the Mesozoic Jurassic Period, and the results were compared with those of visual analysis. Based on the comparison results, the program automatically recognized 83% of the discontinuities that were confirmed with the naked eye. In particular, the results for the low angles reproduced approximately 86% of the visual analysis results. Notably, a distinct feature of our program is that discontinuities that are not automatically identified can be added to the results using GUIs, which were separately developed. To be precise, three additional GUIs were developed: one GUI for finding the appropriate value for batch application by immediately reflecting the settings, one GUI for splitting the core box photographs, including the drilling cores, into each drilling core photograph and one GUI for checking and selecting the results (see Figure  12). These GUIs were used to overcome the shortcomings of batch analysis.
In conclusion, the program developed in this study can provide more reliable information than visual analysis for drilling cores and help determine the characteristics of an area more precisely and accurately. Furthermore, it does not require the use of expensive new systems, and existing drilling cores can be reanalyzed using only photographs. We believe that this program will find application in various geotechnical fields.
Appl. Sci. 2021, 11, x FOR PEER REVIEW 13 of 14 Figure 12. Examples of the second and third GUIs. The left panel shows that the second GUI displays the results as different parameters (e.g., Canny σ, scanbox size, threshold and trimming ratio) immediately. Then, saving only the selected output about each core is possible. Meanwhile, the right panel shows that the third GUI is helpful after obtaining the results through the last stage's code. The third GUI helps to save the correct output by checking the box. Figure 12. Examples of the second and third GUIs. The left panel shows that the second GUI displays the results as different parameters (e.g., Canny σ, scanbox size, threshold and trimming ratio) immediately. Then, saving only the selected output about each core is possible. Meanwhile, the right panel shows that the third GUI is helpful after obtaining the results through the last stage's code. The third GUI helps to save the correct output by checking the box.
In conclusion, the program developed in this study can provide more reliable information than visual analysis for drilling cores and help determine the characteristics of an