# Line-Detection Based on the Sum of Gradient Angle Differences
## 4 Line-Detection Experiments with Simulated Images
### General Simulation Tests  
Tests were performed on simulated line images generated with \(w=1,2,\cdots,8\) and \(\sigma_{n}=0,5,\cdots,60/255\), with \(\theta=0,1,\cdots,90^{\circ}\) for each case. Line detection was performed using the SD-, EC-, and SGAD-based methods, and RMSE was then calculated for each case. Finally, mean RMSE  
Figure 6: Root mean square errors (RMSEs) of simulation image line detection against line normal angle (\(\theta\)) for various noise strengths (\(\sigma_{n}\)) and line widths (\(w\)) with constant smoothing factor, \(\sigma_{s}=1.0\), and line width (**a–c**) \(w=2\); (**d–f**), \(w=4\); (**g–i**) \(w=6\); and (**j–l**) \(w=8\) pixels. Noise strength (**a,d,g.j**) \(\sigma_{n}=10/255\); (**b,e,h,k**) \(\sigma_{n}=30/255\); and (**c,f,i,l**) \(\sigma_{n}=60/255\).  
was calculated for each combination of \(w\) and \(\sigma_{n}\). In addition, the effect of smoothing on localization was investigated by setting \(\sigma_{s}=0.5,0.75,\cdots,1.25\); values of \(\sigma_{s}>1.25\) were not considered because larger \(\sigma_{s}\) values tend to cause signal mixing within a neighborhood in real images and are therefore inappropriate for extracting fine features from images.  
Figure 7 shows the outcomes of the experiments conducted on the simulated images with various values of \(w\), \(\sigma_{n}\), \(\theta\), and \(\sigma_{s}\). Overall, SGAD produces more accurate line-detection results than the SD- and the SGAD-based methods under varying \(w\) and \(\sigma_{n}\). The three methods suffer from large line-detection errors when \(w\) is relatively large. However, as shown in columns 4 and 5 of Figure 7, the SGAD-based method produces more accurate line-detection results than the SD- and the EC-based methods when the line width is greater than 3 pixels. Line-detection RMSEs of the three methods increase monotonically with increasing \(\sigma_{n}\), but the increase is significantly less for the SGAD-based method compared to those for the SD- and the EC-based methods. Thus, in terms of line-detection performance, the SGAD-based method is more accurate and less sensitive to noise and signal strength than the SD- and the EC-based methods.  
Table 1 summarizes the processing times of the SD-, EC-, and SGAD-based line-detection methods for the simulated images. The three methods were implemented in the MATLAB software environment on a 64-bit PC equipped with an Intel Core I7 Dual CPU and 16 GB RAM. As summarized in Table 1, the SGAD-based method is faster than the SD-based method by more than 30 %. Although the EC-based method was shown to be the fastest among the three methods, the quality of its line-detection results was inferior to that of the SGAD-based method, as will be shown in Section 5. The procedure of the proposed method is composed of two phases. The first phase comprises of smoothing convolution with a Gaussian filter and calculation of the gradients at all pixels in an image. The second phase  
Figure 7: RMSE distribution effects for simulated line detection under varying line width (\(w\)), noise strength (\(\sigma_{n}\)), and smoothing factor (\(\sigma_{s}\)). (column 1) SD, (column 2) EC, and (column 3) SGAD-based line-detection methods; (column 4) difference between SD- and SGAD-based methods; and (column 5) difference between EC- and SGAD-based methods. (**a–e**) \(\sigma_{s}=0.5\), (**f–j**) \(\sigma_{s}=0.75\), (**k–o**) \(\sigma_{s}=1.0\), and (**p–t**) \(\sigma_{s}=1.25\).  
comprises of calculation of the second derivatives, the SGAD, and the maximum curvature direction, classification of pixels into ridge and valley, and non-maxima suppression at all candidate line pixels. Thus, the computational complexity of the first and second phases of the proposed method are linearly proportional to the number of image pixels and candidate line pixels, respectively.