# Automated Ground Truth Generation for Learning-Based Crack Detection on Concrete Surfaces
## 2 Proposed Method
### First-Round GT Generation
#### 2.1.2 Crack Pixel Segmentation
Hence, \(T_{\text{U}}=\overline{T}_{\text{B}}\), which implies that the pixels were inside the rectangle. Step 2: Perform an initial segmentation of the original color image. All background pixels were categorized into the background class. Unmarked pixels were tentatively categorized into the foreground class. Step 3: Initialize two Gaussian mixture models (GMMs). Figure 3: Results of connected component labeling of (**a**) Figure 2b; (**b**) a significant portion of the crack in Figure 1a. Figure 2: Results of (**a**) thresholding the gradient image; (**b**) performing a closing operation. The background and foreground GMMs, denoted by \(GMM_{\text{BG}}\) and \(GMM_{\text{RG}}\), respectively, were created separately using the initial segmentation results obtained in the previous step. Every GMM was a full-covariance Gaussian mixture with \(K\) components. The \(k\)-th component comprised four parameters: the mean \(\mu_{k}\) (a tuple in the RGB color space), covariance matrix \(\Sigma\) (a \(3\times 3\) matrix), determinant of the covariance matrix \(|\Sigma|\), and component weight \(\varpi\). Step 4: Assign each pixel belonging to the foreground class to the Gaussian component. Each pixel in the foreground class was assigned to the component \(GMM_{\text{FG}}\), which has the maximum likelihood. This was performed by evaluating the Gaussian distribution on the basis of considering the pixel's RGB triple as the input. Similarly, each pixel in the background class was assigned to the maximum-likelihood component of \(GMM_{\text{BG}}\). Step 5: Learn new parameters of GMMs. The current GMMs were discarded, and the new parameters of the background and foreground GMMs were learned using the pixel sets that were assigned in Step 4. Step 6: Conduct image segmentation. Graph cut was performed to obtain a new tentative classification of the background and foreground for all pixels. The entire GrabCut procedure is presented above. The iterative scheme begins with repeating Steps 4-6 until the classification result converges. Figure 4 shows the result of GrabCut from Figure 3b, in which the pixels belonging to the foreground class are preserved, and the background pixels are set to zero (black pixels). The foreground pixels are further refined by categorizing them into brighter and darker groups, and only the darker pixels are regarded as cracks. Therefore, the crack pixels in the original image are indicated. Figure 5 shows the preliminary result of crack segmentation by employing the GrabCut method and image processing techniques. It is noteworthy that the crack pixels are depicted by white pixels and can be directly applied to train a deep learning-based model since the crack and non-crack pixels are labeled by 1 and 0, respectively. In this study, we named this binary map the first-round GT. Figure 4: Result of foreground extraction by GrabCut algorithm from Figure 3b. Figure 5: Preliminary result of crack segmentation by preserving darker pixels in the foreground from Figure 4. Crack pixels are denoted by white color in this plot.