## 4 Experiments
### Edge Detection Experiment  
Edge contour detection of the fastener image was performed using both the traditional Canny algorithm and the improved Canny algorithm proposed in this paper, with some detection results shown in Figure 10.  
As can be seen in Figure 10, the traditional Canny algorithm encounters edge loss to varying degrees when dealing with samples that have blurred surface features such as rust, water stains, and oil stains. In comparison, the improved Canny algorithm can obtain more complete edges of the spikes under different interferences. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Filtering Algorithm**Sample Category & Normal & Water Stain & Rust & Oil Stain \\  & Category & Category & Category & Category \\ \hline Gaussian filtering & 20.035 & 19.238 & 18.305 & 18.096 \\ Median filtering & 18.969 & 18.079 & 17.438 & 17.335 \\ Mean filtering & 19.211 & 18.492 & 17.830 & 17.586 \\ Bilateral filtering & 21.401 & 20.581 & 19.245 & 19.246 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: PSNR evaluation results. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Filtering Algorithm**Sample Category & Normal & Water Stain & Rust & Oil Stain \\  & Category & Category & Category & Category \\ \hline Gaussian filtering & 15.368 & 13.946 & 12.792 & 12.258 \\ Median filtering & 14.300 & 12.787 & 11.925 & 11.498 \\ Mean filtering & 14.543 & 13.201 & 12.316 & 11.749 \\ Bilateral filtering & 16.733 & 15.289 & 13.731 & 13.408 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: SNR evaluation results. To further demonstrate the effectiveness of the improved Canny algorithm, the gradient Hough transform is used to perform circle detection on the edge images obtained from both algorithms mentioned above. As shown in Figure 11, detecting a spike is defined as a successful detection, and the absence of detection is considered a failure. The red circles in the figure represent the visualization results of the circular fitting. By comparing the accuracy of circle detection between the two, we can quantitatively illustrate the impact of the improved Canny algorithm on the subsequent spike circle fitting accuracy. The gradient Hough correlation parameters remain unchanged, and the image circle detection results are shown in Table 5.  
Figure 11: Circle detection results: (**a**) spike detection successful; (**b**) spike detection failed. Figure 10: Comparison of fastener edge inspection results: (**a**) normal surface; (**b**) surface with water stains; (**c**) rusty surface; (**d**) surface with oil stains; (**a1**) traditional Canny result for normal surface; (**b1**) traditional Canny result for surface with water stains; (**c1**) traditional Canny result for rusty surface; (**d1**) traditional Canny result for surface with oil stains; (**a2**) improved Canny result for normal surface; (**b2**) improved Canny result for surface with water stains; (**c2**) improved Canny result for rusty surface; (**d2**) improved Canny result for surface with oil stains. The traditional Canny algorithm contains less gradient information and weak edge detection capabilities. When there are rust and water stain interferences, the detection accuracy is significantly lower than that of the improved Canny algorithm. Especially when dealing with oil stains on road spikes where edges are the most blurred and there are many noise points, many edges are lost, resulting in a circle detection accuracy of only 80%. The improved Canny algorithm, after the optimization of filtering and enhancement of gradients, can better extract the edges of road spikes, and the detection accuracy is improved by 9%, 7%, and 18%, respectively, in the presence of water stains, rust, and oil interference. At the same time, the sample also includes environmental interference, such as lighting changes. The traditional Canny algorithm does not have adaptive thresholding, making it difficult to achieve the best edge detection results and affecting the final circle detection accuracy.