# Three-Dimensional Real-Scene-Enhanced GNSS/Intelligent Vision Surface Deformation Monitoring System
## 4 Data Processing
### Video Data Processing
#### 4.1.3 Edge Detection  
This study employs edge detection for crack extraction [35; 36]. Initially, the image undergoes grayscale conversion, contrast enhancement, and denoising processes. Subsequently, it is segmented through a dynamic thresholding algorithm, effectively separating the crack foreground from the background [37]. The largest connected region is then  
Figure 5: An example of the image-based rendering effect. selected, and any breaks within it are repaired. Following that, merged bounding boxes are employed to calculate the aspect ratio, as illustrated in Figure 6. Finally, row-column projections are analyzed. Following is a detailed description of the process. The base image, composed of red, green, and blue channels (Figure 6a), is converted to grayscale using an averaging method. Gray values are redistributed, and pixel traversal is performed to count the frequency of each gray level. For an image with \(L\) gray levels, the frequency of gray level \(r_{k}\) in the original image is denoted as \(n_{k}\), \(k=0,1,2,\cdots,L-1\). The cumulative distribution function \(S_{k}\) is calculated for each gray level. \[S_{k}=\sum_{j=0}^{k}P_{r}\big{(}r_{j}\big{)}=\sum_{j=0}^{k}\frac{n_{j}}{n} \tag{1}\]  
where \(n\) is the total number of pixels in the image and \(P_{r}\big{(}r_{j}\big{)}\) is the probability of gray level \(r_{j}\). The cumulative distribution function \(S_{k}\) is multiplied by \((L-1)\) to obtain the histogram-equalized gray value \(S_{out}=\lfloor(L-1)S_{k}\rfloor\). Each pixel's gray value in the original image is then replaced with its corresponding equalized gray value, resulting in a histogram-equalized image (Figure 6b). When a \(3\times 3\) neighborhood is defined, median filtering is used to remove impulse noise, such as salt-and-pepper noise, from the image. The denoised image is then normalized, and its brightness and contrast are adjusted using gamma correction (Figure 6c). An iterative thresholding segmentation algorithm is subsequently employed to determine a suitable threshold. The iteration count depends on the characteristics of the crack image. A suitable global threshold \(T_{0}\) is selected as the initial value. Based on the threshold discrimination rule, the image is segmented into two subregions: \(G_{1}\), consisting of pixels with gray values greater than \(T_{0}\), and \(G_{2}\), consisting of pixels with a gray value less than \(T_{0}\). The average gray values of the pixels in \(G_{1}\) and \(G_{2}\) are calculated and denoted as \(M_{1}\) and \(M_{2}\), respectively, and the average of \(M_{1}\) and \(M_{2}\) is the new threshold \(T_{1}\). \[T_{1}=\frac{1}{2}(M_{1}+M_{2}) \tag{2}\]  
Figure 6: Crack identification process. (**a**) Original image. (**b**) Histogram equalization to enhance contrast. (**c**) Contrast adjustment to refine details. (**d**) Binarization for segmentation. (**e**) Binary filtering to suppress noise. (**f**) Crack demarcation (highlighted in green) for precise localization. If \(|T_{1}-T_{0}|<0.5\), the threshold \(T_{1}\) is output as the final threshold. Otherwise, assign the value of \(T_{1}\) to \(T_{0}\) and repeat the above steps. Through iterative threshold adjustment, the algorithm achieves a more accurate segmentation of the image into foreground and background parts (Figure 6d). After segmentation, smaller connected regions are filtered out by labeling, calculating areas, and sorting, leaving the required number of large connected regions. Then, row and column projections are performed to obtain pixel sums. The average gray value at the center-of-mass position of each connected region is compared with the average gray value of the whole region. If the difference is less than a predefined threshold, the pixel values of the region in the binary image are set to 0. After identifying the boundaries between neighboring connected regions, the image undergoes a crack splice-and-fill operation (Figure 6e). The areas of the connected regions are sorted in descending order, and the two largest bounding boxes are identified.