Abstract
Industrial computed tomography (CT) crack segmentation is a key technology in industrial CT image processing. Unfortunately, the interference of artifact and noise in CT image often bring great trouble to the crack segmentation. In order to improve the segmentation accuracy of cracks in CT images, we propose to develop and test a new crack segmentation algorithm based on linear feature enhancement by analyzing the features of cracks in CT images. Firstly, the total variational model is used to denoise the input image. Next, a Frangi multiscale filter is used to extract linear structures in the image, and then the extracted linear structures are used to enhance the contrast of the image. Finally, the cracks in the image are detected and segmented by Otsu algorithm. By comparing with the manual segmentation results, the average intersection-over-union (IOU) reaches 86.10% and the average F1 score reaches 92.44%, which verifies the effectiveness and correctness of the algorithm developed in this study. Overall, experiments demonstrate that the new algorithm improves the accuracy of crack segmentation and it is effective applying to industry CT images.
Introduction
Cracks and other defects often appear in the production and work of industrial parts, which shorten the life of the workpiece. Therefore, cracks detection is extremely important, especially for the further analysis of cracks, and accurate extraction of cracks is particularly important. CT technology can image the interior of the sample without destroying it, and intuitively display the internal structure, composition, material and defect of the detected object. However, noise, artifact and other disturbances in the process of CT imaging may affect crack segmentation to varying degrees, so industrial CT image segmentation is still a challenging problem.
At present, many scholars have proposed a variety of crack-related segmentation methods. Bhowmik proposed a two-dimensional matched filtering technique followed by local entropy-based thresholding, morphological operators and length filtering to detect and segment cracks from the cross-sectional images of rock [1]. Liu proposed a method for segmenting cracks in 3D ICT images based on wavelet transform and Chan and Vese (CV) model [2]. Zuo according to the features of pavement surface cracks, proposed a novel image segmentation method based on fractal theory [3]. Cuan applied whale optimization algorithm to crack image segmentation of symmetric cross entropy and adopted the chaotic search strategy in the initialization stage of the original algorithm, which effectively improves the speed and accuracy of crack image segmentation [4]. Wu proposed a cascaded U-net architecture to segment the vascular intensity image and its corresponding phase image for the outer vessel wall boundary and the inner blood flowing lumen contour [5]. Alonso-Caneiro proposed an automatic segmentation technology based on graph search theory to achieve the segmentation of the inner choroidal boundary and the outer choroidal boundary [6]. At the same time, with the development of deep learning theory, more deep learning methods are used in the field of image segmentation [7–10].
In this context, combined the requirements of CT image crack segmentation with the characteristics of crack structure, this paper proposes a CT image crack segmentation algorithm based on linear feature enhancement, which improves the accuracy of crack structure segmentation in CT images by reducing noise and artifacts in the image and improving the contrast of the crack structure.
Methods
CT image crack segmentation method based on linear feature enhancement mainly involves TV model, Frangi filtering algorithm and Otsu algorithm. The algorithm steps are shown in Fig. 1.

The flow chart of the algorithm in this paper.
Osher [11] combined partial difference equation denoising theory [12] and the boundary variation denoising theory [13], proposed the TV model, which has the characteristics of anisotropy and can better retain the linear structure of image edge while removing noise in the image. TV model introduced the global variation into the field of image denoising for the first time [14]. TV model considers that the energy of the noisy image is higher than that of the original image without noise, and the noisy image has the basic characteristics of the original image without noise. Therefore, this model proposed a minimization energy function model with constraints, which makes the original image denoising problem become a problem of finding the optimal solution of the minimization function. In other words, image denoising is achieved by minimizing the energy function [15]. The energy function of TV model is shown in formula (1)
In order to minimize the energy function shown in formula (1), the corresponding Euler-Lagrange equation is derived by using the variational method:
Frangi filter based on Hessian matrix has been widely used in image enhancement [17–19]. In a two-dimensional image, the basic form of Hessian matrix at each pixel can be expressed as formula (3).
Matrix H has two eigenvalues λ1, λ2 and corresponding eigenvectors, the eigenvalue and corresponding eigenvector represent the curvature magnitude and direction of a certain direction at the point respectively. Let λ1 and λ2 satisfy 0 ⩽ |λ1| ⩽ |λ2|, then λ2 represents the largest local gray scale change, and the direction indicated by the corresponding eigenvector represents the direction of image change.
Frangi A F [20] proposed the Frangi filter by combining the eigenvalues of Hessian matrix:
The image usually contains linear structures of various sizes, and the linear structures of each scale cannot be well detected only by using a single scale. By analyzing the size of the target linear structure in the image, the range of scale factor σ of the Gaussian function is set as [σmin, σmax], and the maximum response value of pixel points at multiple scales is selected as the output of the filter, and the mathematical expression is
In view of the low contrast of quite a few CT images in engineering applications, there are more noise, artifacts and other interferences, which seriously affect the accuracy of later image segmentation. This paper proposes a CT image crack segmentation method based on linear feature enhancement. First use the TV model to denoise the image, then use the Frangi multi-scale filter to extract the linear structure in the image, then use the extracted linear structures to enhance the contrast of the image, and finally use the adaptive threshold segmentation method to get the crack in the CT image.
TV model noise reduction
Definition: In the image matrix, any 3×3 neighborhood with the center pixel O is expressed as formula (7):
TV method realizes image denoise by minimizing the energy model E (u) shown in formula 1. In this paper, the iterative method is used to find the minimum value of E (u). The parameters involved are: Lagrange weight coefficient λ, iteration times and iteration step size dt. In formula (2):
The size information of linear structure in image was analyzed, the iteration range [σmin, σmax] and iteration step of Gaussian function scale factor σ were set, and the response of image at each scale was calculated by iteration method. In each iteration, follow these steps: Calculate the Hessian matrix corresponding to the image, as shown in formula (4). Calculate the eigenvalues of Hessian matrix, as shown in formula (9).
Solve equation (9) to get Construct two variables R
B
= λ1/λ2 and Set the appropriate step size of σ and σ
i
⊂ [σmin, σmax], repeat S1∼S4, then select the maximum response value of the filter as the output of the filter.
To segment cracks in CT images, the Otsu algorithm is used. Otsu, proposed by Japanese scholar Otsu in 1979, is an algorithm to determine the threshold of binary image segmentation. In this algorithm, the interclass variance between background image and foreground image is calculated under different gray threshold values. When the inter-class variance reaches the maximum value, the corresponding gray level is the threshold value, and the image binarization is completed.
The assumption of Otsu algorithm is that there is threshold TH to divide all pixels of the image into two types C1(less than TH) and C2(greater than TH). Then the mean values of these two types of pixels are respectively M1 and M2, and the global mean value of the image is mG. Meanwhile, the probability of pixel being classified into C1 and C2 is P1 and P2, respectively. Hence:
According to the concept of variance, the expression of interclass variance is:
It can be obtained from formula 10 and 12:
Let TH ∈ [1, 255], when equation 13 achieves the maximum value, the corresponding gray level k, it is the Otsu threshold.
In order to verify the correctness of the algorithm segmentation, this paper compares the results of the algorithm segmentation and manual segmentation and uses the confusion matrix to evaluate the segmentation results. Taking cracked pixels as positive samples and non-cracked pixels as negative samples, the confusion matrix is shown in Table 1.
Confusion matrix
Confusion matrix
Precision of an algorithm is represented as the ratio of correctly classified pixels with the cracks to the total pixels predicted to cracked pixels.
Specificity is the true negative rate, which is the ratio between the actual number of background pixels and the number of pixels predicted to be background.
Recall metric is defined as the ratio of the number of pixels predicted to be cracked to the number of actual cracked pixels.
The F1 score states the equilibrium between the precision and the recall.
The Intersection-over-Union, also known as The Jacquard coefficient, is the ratio of the intersection area and union area of the predicted result and the actual result. It is used to measure the similarity of the set. When evaluating the image segmentation result, the image is regarded as the set of pixels.
In order to verify the effectiveness of the proposed method, three groups of representative CT image samples were selected for processing. The sample images are shown in Fig. 2. The characteristics of these images are shown in Table 2.

CT sample images (a) rock core image, (b) rail_1 CT image, (c) rail_2 CT image.
Different samples and their characteristics
Taking Fig. 2(b) as an example, there are many noises and artifacts in the original image. Figure 3 shows the results of direct linear structure extraction.

Linear structures extracted from Fig. 1(b).
In order to reduce the interference caused by noise and artifacts in the image to crack structure extraction, the TV algorithm is used to smooth the original image, and the noise reduction effect is shown in Fig. 4(a). Figure 4(b) shows the linear structure extracted from Fig. 4(a) using Frangi filtering algorithm. Using the Otsu algorithm to obtain the binary image of Fig. 4(b), as shown in Fig. 4(c).

Intermediate results (a) The result of TV algorithm noise reduction, (b) The linear structure extracted from Fig. 4(a), (c) The Otsu segmentation result of Fig. 4(b).
As there is too little pixel information in Fig. 4(b), the segmentation results of Otsu algorithm contain many non-cracked pixels. To solve this problem, Fig. 4(a) and 4(b) are subtracted to enhance the linear structure in the noise reduction image, as shown in Fig. 5(a). Then the Otsu algorithm is used, and the result is shown in Fig. 5(b).

The results of the algorithm in this paper (a) image enhancement result, (b) segmentation result.
To verify the effectiveness of the TV-Frangi algorithm in image enhancing, the TV-Frangi algorithm is compared with some common enhance algorithms such as mean filtering algorithm, median filtering algorithm, non-local mean (NLM) filtering algorithm and TV algorithm. To compare the experimental results more clearly, the box area was magnified. The effect of the five algorithms on rock core CT image, rail_1 CT image and rail_2 CT image are shown in Figs. 6–8 respectively.

Comparison of different enhancement methods for rock core CT image (a) median filtering, (b) mean filtering, (c) NLM, (d) TV, (e) TV-Frangi.

Comparison of different enhancement methods for rail_1 CT image (a) median filtering, (b) mean filtering, (c) NLM, (d) TV, (e) TV-Frangi.

Comparison of different enhancement methods for rail_2 CT image (a) median filtering, (b) mean filtering, (c) NLM, (d) TV, (e) TV-Frangi.
The conclusions that can be drawn from Figs. 6 ∼8 are as follows: Among the five algorithms, median filter, mean filter, NLM filter and TV have a certain ability to suppress noise and artifacts in the image, but do not improve the contrast of the crack structure in the CT image. Among the first four algorithms, median filter and mean filter excessively smooth the crack structure in the original image, while NLM and TV maintain the crack structure well and have good suppression effect on noise and artifacts. TV-Frangi can suppress artifact and noise in CT image and enhance crack structure.
In order to verify the effectiveness of the segmentation algorithm in this paper, the Otsu was used to extract the crack structures in the preprocessed images shown in Figs. 6 to 8. The results are shown in Fig. 9.

Segmentation results of Otsu algorithm (a) median-Otsu, (b) mean-Otsu, (c) NLM-Otsu, (d) TV-Otsu, (e) TV-Frangi-Otsu.
In order to objectively evaluate the correctness of the segmentation results enhanced by different preprocessing algorithms, the results of manual segmentation are used as a reference (as shown in Fig. 10).

Results of manual segmentation (a) rock core CT image, (b) rail_1 CT image, (c) rail_2 CT image.
The evaluation indicators introduced in section 2.5 are used to evaluate the segmentation results. In the evaluation process, only the pixels of the workpiece area are considered, and the pixels of the background area are not considered. The calculation results are shown in Tables 3∼5.
Evaluation value of core CT image segmentation results
Evaluation value of rail_1 CT image segmentation results
Evaluation value of rail_2 CT image segmentation results
The conclusions that can be drawn from the Figs. 9, 10 and Tables 3∼5 are as follows: There is serious under-segmentation in the segmentation results of the first four methods, and many crack pixels are not correctly extracted, resulting in low R
e
and F in the evaluation indicators; The algorithm in this paper can segment the cracks in the image more completely and correctly, so the corresponding R
e
and F evaluation values are higher. All five algorithms can segment the background pixels correctly, so the corresponding P
r
evaluation value is high. The IOU index indicates the similarity between the segmentation results and the real results. Since the first four methods have serious under-segmentation, the similarity with the real results is poor; The segmentation accuracy and completeness of the method in this paper are better, thus the corresponding IOU value is higher.
In order to further analyze the information of cracks in the scanned workpiece, all CT slices of the workpiece and the crack images segmented from each CT slice were used to make a 3D model of the workpiece. Before making the 3D model, aiming to make the cracks in the model easy to analyze and observe, the flooding filling algorithm was used to fill the segmentation results obtained by the method in this paper, only the crack structures in the image were retained, and the results were inverted, as shown in Fig. 11.

Results of filling (a) Rock core CT image, (b) rail_1 CT image, (c) rail_2 CT image.
Taking the rail_2 CT image as an example, without preprocessing, the region-based level set method (RSF), mathematical morphology and Otsu are used to segment, and the obtained results are shown in Fig. 12. It shows that the similarity between the segmentation results and the real results is poor, the under-segmentation phenomenon is serious, and a large number of cracked pixels are not correctly segmented.

Segmentation result without preprocessing (a) RSF, (b) mathematical morphology, (c) Otsu.
Using the preprocessing algorithm proposed in this paper to enhance the image quality, and then using the segmentation algorithm, the results are shown in Fig. 13. It can be seen that after preprocessing, the segmentation results have good similarity with the real results. To better evaluate the segmentation results, the segmentation results are evaluated using the evaluation method in section 2.5, as shown in Table 6.

The segmentation result preprocessed by the TV-Frangi algorithm (a) RSF, (b) mathematical morphology, (c) Otsu.
Evaluation values of different segmentation algorithms
The bolded data in Table 6 is the maximum value in each column. It can be seen from Fig. 13 and Table 6 that the correctness of the three segmentation algorithms are all high, and the Otsu algorithm is higher in the three indicators of R e , F and IOU, indicating that the correctness and accuracy of the algorithm are better.
Figure 14 shows the generalization of the method in this paper. It can be seen that using the TV-Frangi algorithm to enhance the CT image and then using the Otsu method can significantly improve the integrity and accuracy of the crack segmentation results, especially in the places marked in red in the figure.

Generalization Verification (a) original image, (b) Otsu algorithm segmentation result, (c) the proposed method in this paper.
Using the above method, 58 2D rail CT images and 59 2D rock core CT images were segmented to obtain the crack structures in the 2D slice image. Then the crack images were used to make 3D model of the workpiece. The direction and distribution of cracks of the workpiece can be seen more intuitively through the synthetic 3D pictures. Figures 15 and 16 are the synthetic 3D renderings of rock core and rail respectively.

The 3D model of the oil rock cracks (a) viewing angle 1, and (b) viewing angle 2.

The 3D model of the rail cracks (a) viewing angle 1, and (b) viewing angle 2.
In view of the problem that some CT images have low quality, serious noise and artifact, this paper proposes a CT image crack segmentation method based on linear feature enhancement. The algorithm first pre-processes the image with TV-Frangi algorithm, and then uses adaptive threshold segmentation to obtain the cracks and verifies the validity of the algorithm. The experimental results suggest that the TV-Frangi pre-processing algorithm has the ability of noise reduction and edge protection and can enhance the linear structure within the specified size range in the image. The cracks in the original image can be segmented more completely by using the adaptive threshold segmentation algorithm after this pre-processing algorithm. Comparing the segmentation results of the method in this paper with the manual segmentation results, the average intersection-over-union (IOU) reaching 86.10% and the average F1 score reaching 92.44%, which verifies the effectiveness and correctness of the algorithm.
Funding
National Natural Science Fund (11827809).
Footnotes
Acknowledgments
Supported by National Natural Science Fund (11827809).
Data availability
Data underlying the results presented in this paper are not publicly available at this time but may be obtained from the authors upon reasonable request.
Disclosures
The authors declare no conflicts of interest.
