# Research on Defect Detection of Bare Film in Landfills Based on a Temperature Spectrum Model
## 5 Image Analysis
### Improved Guided Image Filtering  
The smoothing coefficients \(\varepsilon\) for different regions of the image are adjusted by introducing the edge-aware weights from WGF [27]; the formula for \(a_{k}\) becomes:  
\[a_{k}=\frac{\sigma^{2}{}_{k}}{\sigma^{2}{}_{k}+\varepsilon/\zeta(k)} \tag{11}\]  
Among them:  
\[\zeta(i)=\frac{1}{N}\sum\limits_{i^{\prime}=1}^{N}\frac{\sigma^{2}{}_{Ii}(i)+ \rho^{\prime}}{\sigma^{2}{}_{I,i}(i^{\prime})+\rho^{\prime}} \tag{12}\]  
In Equation (12), \(\sigma^{2}{}_{I,i}(i)\) is the variance of the \(3\times 3\) window centered on pixel \(i\) in \(I\), \(N\) is the number of pixels, \(i^{\prime}\) is used to traverse the variance of all the windows, and \(\rho^{\prime}\) is a very small number that prevents \(\zeta(i)\) and the denominator from being 0.  
The weighted aggregation mechanism is introduced in WAGIF [28]. The GIF obtains the filtered pixel values by calculating the weighted average of the pixels within a local window, and averaging when the edge points are on the same and different sides of the window will weaken the edges; thus, the mean square error is proposed as an exponential mapping for the allocation of the local window of the new aggregated weights, which can greatly minimize the appearance of halos with the expression:  
\[e_{k}=\frac{1}{N}\sum\limits_{i\in w_{k}}(a_{k}I_{i}+b_{k}-I_{i})^{2}\]  
\[r_{k}=\exp(-  
Using the Canny operator for edge detection in Figure 14, the results of its processing are shown in Figure 17, from which it can be seen that the defect contour of No. 1 is almost completely lost after GIF-Canny and WGIF-Canny processing, while the defect contour is partially lost after WGIF-Canny and improves the GIF-Canny processing. No. 2 defect still has noise interference after GIF-Canny and WGIF-Canny processing, while the interference noise is significantly reduced after WGIF-Canny and improves the GIF-Canny. The edge contour of defect No.3 can be shown better after GIF-Canny and WGIF-Canny processing but there is noise interference, and the defect contour is completely lost after WGIF-Canny processing. After improving the GIF-Canny processing, the interference noise is obviously reduced, and the contour of the defect is relatively completely preserved. Defect No. 4 is processed by all four algorithms, the edge contour is well displayed, and there is almost no interference noise. Therefore, all four algorithms effectively preserve the edge information of defect No 4.  
Figure 16: Canny bilateral threshold edge detection for input original image: (**a**) \(\sigma=1\); (**b**) \(\sigma=1.5\); (**c**) \(\sigma=3\).  
Figure 17: Comparison of defective edge extraction effects of [PERSON] algorithm: (**a**) GIF-Canny; (**b**) WGIF-Canny; (**c**) WAGIF-Canny; (**d**) improve the GIF-Canny.  
Figure 15: Canny edge detection of input original image at \(\sigma=1.5\): (**a**) low threshold processing; (**b**) bilateral threshold processing; (**c**) high threshold processing.  
At the same time, the algorithms such as Sobel, Prewitt, and Roberts are compared with [PERSON]'s algorithm [31; 32]. As shown in Figure 18, after improving the GIF-Sobel, improving the GIF-Prewitt processing, all the defect edge contours are lost and there is noise interference, and, improving the GIF-Roberts processing, all the defect edge contours are lost seriously. The improvement in the GIF-Canny algorithm has a good retention of effective defect contours on the basis of noise reduction so that the final extracted defect contours are clear and effective.  
In summary, the image processed by improving the GIF-Canny has a lower noise effect and retains effective defect edges, which can determine the contour of the defect and provide basic information for the next HDPE film defect remediation.