## 2 Digital Image Processing
### Crack Extraction
#### 2.2.3 Information Enhancement of Fracture Area Based on Contrast Characteristics  
In image processing, contrast represents the intensity difference between adjacent regions in the image [19; 20]. The contrast of the crack information intensity image is very low, and the spatial correlation of adjacent pixels is high. The target, background, details, and noise in the image exist in a narrow gray range, so it is not meaningful to evaluate the contrast of a crack pixel alone. Candidate crack regions and absolute non-crack regions have been defined in the intensity image. When these regions are mapped to the original image, the crack and background regions have a strong contrast relationship. The contrast relationship between the crack region and the background region is defined as the contrast feature of the crack. Therefore, after obtaining the intensity image, the information on the crack area is enhanced based on the contrast feature. In image processing, the contrast \(C\) between the target area and the background area can be calculated using Formula (14):  
\[C= |\overline{B}_{T}-\overline{B}_{B}|/\sigma_{B} \tag{14}\]  
where \(\overline{B}_{T}\) represents the average gray value of the target area, \(\overline{B}_{B}\) represents the average gray value of the background area, and \(\sigma_{B}\) represents the mean square deviation of the background area. The contrast feature describes the significant difference between the fracture and background areas. Combined with the previous non-negative features, the fracture area and the edge of the landmark can be well distinguished. According to the relevant mathematical definitions of contrast features, combined with the distribution of gray values in the crack area on the intensity map and the original image, the contrast between the target area and the background area is calculated by calculating the mean gray value and mean square deviation. When calculating the mean grayscale of a region, considering the occurrence of sudden changes in the grayscale values of individual pixels, extreme values are generally removed. The formula for calculating the mean grayscale and mean square deviation of the target region is shown in Formula (15):  
\[\left\{ \begin{array}{l}M_{1}=\frac{\sum\limits_{i=0}^{i\leq N}F_{i}(x,y)-F_{ \max}(x,y)-F_{\min}(x,y)}{N-2}\\ \sigma_{1}=\sqrt{\frac{\sum\limits_{i=0}^{i\leq N}[F_{i}(x,y)-M_{1}]^{2}}{N}} \end{array} \right. \tag{15}\]  
The calculation formula for the grayscale mean and mean square deviation of the background area is shown in Formula (16):  
\[\left\{ \begin{array}{l}M_{2}=\frac{\sum\limits_{i=0}^{i\leq n}f_{i}(x,y)-f_{ \max}(x,y)-f_{\min}(x,y)}{n-2}\\ \sigma_{2}=\sqrt{\frac{\sum\limits_{i=0}^{i\leq n}[f_{i}(x,y)-M_{2}]^{2}}{n}} \end{array} \right. \tag{16}\]  
where \(M_{1}\) is the average gray value of the target area Area 1; \(M_{2}\) is the average gray value of the background Area 2; \(\sigma_{1}\) is the mean square deviation of the target Area 1; \(\sigma_{2}\) is the mean square deviation of the background Area 2. \(F_{i}(x,y)\), \(F_{\max}(x,y)\) and \(F_{\min}(x,y)\), \(f_{i}(x,y)\), \(f_{\max}(x,y)\), \(f_{\min}(x,y)\) represent the gray value of each pixel in Area 1 and Area 2. 2, the maximum gray value of the region, and the minimum gray value of the region, respectively; \(N/n\) is the number of pixels in each area. Based on the characteristics of the crack area in the image, the calculation formula for the contrast \(C\) between the target area and the background area is defined as Formula (17):  
\[C=\left\{ \begin{matrix}|M_{1}-M_{2}|/\sqrt{\sigma_{1}\sigma_{2}}&|M_{1}-M_{2}| >T\\ 0&|M_{1}-M_{2}|<T\end{matrix} \right. \tag{17}\]  
If Area 1 is a crack area, then \(|M_{1}-M_{2}|\) is larger. However, if Area 1 is a non-fracture candidate area, then the value of \(|M_{1}-M_{2}|\) is smaller. The proposed method sets an intensity factor \(T\) to make a judgment.