# SNR Analysis for Quantitative Comparison of Line Detection Methods
## 3 Method--SNR of ED and SD for Line Detection
### Line Model and Derivation of Its Derivatives  
In camera-captured images, there is always a certain amount of blur and noise. An image \(\mathbf{I}\) can be modeled by signals \(\mathbf{F}\) convoluted with a certain amount of blur \(\mathbf{b}\) and noise \(\mathbf{n}\), which is described in various approaches [30; 31; 32; 33; 34; 35; 36; 37; 38] as follows:  
\[\mathbf{I}=\mathbf{F}*\mathbf{b}+\mathbf{n}, \tag{1}\]  
where \(*\) indicates the convolution operator. Variations of blurring patterns around edges because of varying contrast have been analyzed by modeling edge profiles with two blur parameters in [39]. For simplicity, however, the imaging model with one blur parameter in Equation (1) is used in the following derivation. In this study, the line profile has been modeled by two factors, namely, width, \(w\), and contrast, \(k\), as shown in Figure 1. Then, according to Figure 1, the 1D line signal can be mathematically modeled as follows:  
\[\mathbf{F}(x)= \begin{cases}h+k,&\text{if }|x-L|<\frac{w}{2};\\ h,&\text{otherwise}\end{cases}  \tag{2}\]  
where \(h\), \(L\), and \(x\) are the background intensity, coordinate of the center of the line, and coordinate of an arbitrary location, respectively. \(L\) and \(x\) are the coordinates with reference to the line normal direction. Figure 1: Line profile model used in this study. To consider the blurring effect in the image formation process, a 1D Gaussian blur function is introduced as follows:  
\[\mathbf{b}(t)=\frac{1}{\sqrt{2\pi\sigma_{b}}}e^{-\frac{t^{2}}{2\sigma_{b}^{2}}} \tag{3}\]  
where \(\sigma_{b}\) and \(t\) are the blurring factor and distance from the center of the Gaussian function, respectively. The dashed line in Figure 2 shows a scaled version of the blur function, \(k\cdot\exp(-\frac{(L-x)^{2}}{2\sigma_{b}^{2}})\) with variation of the location, \(x\). Thus, from Figure 2, the intensity value at \(x\) captured by a camera can be derived as follows:  
\[\mathbf{F_{b}}(x)=(\mathbf{F*b})(x)=\int_{x-\frac{\pi}{2}-L}^{x+\frac{\pi}{2 }-L}\frac{k}{\sigma_{b}\sqrt{2\pi}}e^{-\frac{t^{2}}{2\sigma_{b}^{2}}}dt. \tag{4}\]  
For noise removal, image smoothing is usually applied by convoluting an image with a 2D Gaussian function, which can be described as follows:  
\[\mathbf{s}(u,v)=\frac{1}{2\pi\sigma_{s}^{2}}e^{-\frac{t^{2}+2\sigma^{2}}{2 \sigma_{s}^{2}}}, \tag{5}\]  
where \(\sigma_{s}\) is the smoothing factor, and \(u\) and \(v\) are the distances from the center of the Gaussian function in the column and row directions, respectively. Accordingly, its 1D function can be written as follows:  
\[\mathbf{s}(x)=\frac{1}{\sqrt{2\pi\sigma_{s}}}e^{-\frac{x^{2}}{2\sigma_{s}^{2}}} \tag{6}\]  
Then, the application of the smoothing function \(\mathbf{s}\) generates the image \(\mathbf{I_{s}}\), which can be written as follows:  
\[\mathbf{I_{s}}=\mathbf{I*s}=(\mathbf{F*b+n})*\mathbf{s}=\mathbf{F*b*s+n*s}. \tag{7}\]  
Thus, after blurring and smoothing, the line signal in Equation (2) is reformed as per [40] as follows:  
\[\mathbf{F_{b*s}}(x)=(\mathbf{F*b*s})(x)=(\mathbf{F_{b}*s})(x)=\int_{x-\frac{ \pi}{2}-L}^{x+\frac{\pi}{2}-L}\frac{k}{\sqrt{2\pi(\sigma_{b}^{2}+\sigma_{s}^{ 2})}}e^{-\frac{t^{2}}{2(\sigma_{b}^{2}+\sigma_{s}^{2})}}dt. \tag{8}\]  
Thus, the first derivative of the cross section profile of the smoothed line with respect to \(x\) is derived from Equation (8) as follows:  
\[\mathbf{F_{b*s}^{\prime}}(x)=\frac{d\mathbf{F_{b*s}}}{dx}=\frac{k}{\sqrt{2\pi (\sigma_{b}^{2}+\sigma_{s}^{2})}}[e^{-\frac{(x+\frac{\pi}{2}-L)^{2}}{2(\sigma _{b}^{2}+\sigma_{s}^{2})}}-e^{-\frac{(x-\frac{\pi}{2}-L)^{2}}{2(\sigma_{b}^{ 2}+\sigma_{s}^{2})}}]. \tag{9}\]  
Figure 2: Gaussian blur for a line model. Additionally, the second derivative of the cross section profile of the smoothed line with respect to \(x\) is derived from Equation (9) as follows:  
\[