# SNR Analysis for Quantitative Comparison of Line Detection Methods
## 5 Experimental Results and Discussion
To find the incorrectly detected line pixels within a specified distance from the reference pixels, the reference line pixel image was dilated with a certain radius \(r\) as  
\[\mathbf{R_{d}}=\mathbf{R}\oplus\mathbf{S_{r}}, \tag{78}\]  
where \(\oplus\) denotes the dilation operator and \(\mathbf{S_{r}}\) the structural element with radius \(r\). In this study, \(r\) was set to 3 pixels because it equals \(3\sigma_{s}\) when \(\sigma_{s}=1.0\). Then, the image containing incorrectly detected pixels \(\mathbf{Q}\) was generated as  
\[\mathbf{Q}=\mathbf{R_{d}}\wedge(\mathbf{T}\wedge\
eg\mathbf{C}), \tag{79}\]  
where \(\
eg\) denotes the logical \(NOT\) operator. Next, the number of incorrectly detected pixels were counted at each ground truth line pixel within a certain distance \(d_{t}\) in its line normal and opposite to the directions using the images \(\mathbf{R}\) and \(\mathbf{Q}\) and recorded into an image \(\mathbf{V}\). In this study, \(d_{t}\) was set to 3 pixels, which is the same as the value of \(r\) used for dilation of a reference image. Subsequently, the SNRs at ground truth line pixels were summarized into a histogram with a certain bin size. The bin size was determined by dividing the maximum of SNRs in each SNR image by a specified number \(n\). In this study, the number \(n\) was set to 100. Then, new bins were generated in a descending order so that each new bin has about a certain percentage \(p_{b}\) of the total ground truth line pixels. The value of \(p_{b}\) was set to 10 percent in this study. Figure 11 shows the results for the SNRs of the ridge pixels in the SD-based line detection, when \(\sigma_{n}=8.0\). Next, pixels having SNRs within the boundaries of each SNR bin were selected and the mean of their SNRs was recorded. Moreover, among the selected pixels, the total number of correctly detected pixels \(N_{c}\) was counted using the image \(\mathbf{C}\) derived from Equation (77). Then, the completeness corresponding to the mean SNR was measured by dividing the number of correctly detected line pixels by the total number of the ground truth line pixels \(N_{gt}\) as shown here:  
\[\text{Completeness}=\frac{N_{c}}{N_{gt}}\times 100. \tag{80}\]  
Additionally, among the selected pixels, the total number of incorrectly detected pixels \(N_{ic}\) was counted using the image \(\mathbf{Q}\) derived from Equation (79). Then, the correctness corresponding to the mean SNR was measured as  
\[\text{Correctness}=\frac{N_{c}}{N_{gt}+N_{ic}}\times 100. \tag{81}\]  
Figure 9:0 Example of binning results. The blue line shows the histogram under a given bin size and the red lines the boundaries of the new bins. Figure 12 shows the observed relationships of SNRs with completeness and correctness for the Lena image under varying noise strengths. As shown in the figure, the trend of their relationships is manifest under varying noise strengths. More so, the SGAD-based line detection showed higher SNRs than the SD-based line detection and higher completeness and correctness under all the tested noise strengths. Figure 13 shows all the plots together which are shown in Figure 9:1 As shown in Figure 13, the validity of the SNRs derived for the SD-based and the SGAD-based line detections was proven by the overall strong and consistent relationships of SNRs with completeness and correctness under varying noise strength. The experiments were also applied to other eight natural images as shown in Figure 9:2 Before implementation of line detections, the natural images were converted into grayscale images using the MATLAB's _rgb2 gray_ function. As shown in Figure 15, experiments with the images show that there exist distinct and strong relationships of SNRs with completeness and correctness. The pattern of variations of completeness against SNR was observed similar to that of the correctness. Although the content differs depending on the test images, it was found that the line detection completeness and correctness against SNRs showed similar patterns throughout the test images.