# SNR Analysis for Quantitative Comparison of Line Detection Methods
## 4 Method--SNR of SGAD for Line Detection
### Derivation of SNRs  
To effectively compare the performance of SGAD-based line detection with that of the SD-based line detection, a line with width \(w\) and aligned along the direction of row was used. Then, the line was assumed to have the following gradient values at pixels \(i\) and \(j\), which were located one pixel to the left and right, respectively, of the center of the line and can be expressed as follows:  
\[g_{c_{i}}=g,g_{r_{i}}=0,g_{c_{j}}=-g,\text{ and }g_{r_{j}}=0, \tag{58}\]  
where  
\[g=\mathbf{F}_{\mathbf{b}\ast\mathbf{s}}^{\prime}|_{x=L-1}.\]  
Then, at the center of the line, the standard deviation of the gradient angle difference in the column direction, \(\sigma_{\theta_{4}\text{-}\theta_{5}}\), was derived from Equations (56) and (58) as follows:  
\[\sigma_{\theta_{4}\text{-}\theta_{5}}=\frac{\sigma_{n}\sqrt{P_{1}+P_{3}}}{8 \sqrt{2\pi}\sigma_{s}g}. \tag{59}\]  
Moreover, at the center of the line, the standard deviation of the gradient angle difference in the lower-right diagonal direction, \(\sigma_{\theta_{1}\text{-}\theta_{8}}\), was derived from Equations (57) and (58) as follows:  
\[\sigma_{\theta_{1}\text{-}\theta_{8}}=\frac{\sigma_{n}\sqrt{Q_{1}+Q_{2}}}{8 \sqrt{2\pi}\sigma_{s}g}. \tag{60}\]  
For the line model assumed in the first paragraph of this section, the strength of the line signal based on the angle difference was \(\pi\). Thus, the SNR of the angle difference in the column direction can be derived as follows:  
\[\text{SNR}_{\theta_{4}\text{-}\theta_{5}}=\frac{\pi}{\sigma_{\theta_{4}\text{ -}\theta_{5}}}=\frac{8\pi\sqrt{2\pi}\sigma_{s}}{\sigma_{n}\sqrt{P_{1}+P_{3}}}g. \tag{61}\]  
Moreover, the SNR of the angle difference in the lower-right diagonal direction can be derived as follows:  
\[\text{SNR}_{\theta_{1}\text{-}\theta_{8}}=\frac{\pi}{\sigma_{\theta_{1}\text{ -}\theta_{8}}}=\frac{8\pi\sqrt{2\pi}\sigma_{s}}{\sigma_{n}\sqrt{Q_{1}+Q_{2}}}g \tag{62}\]  
For the SGAD-based line detection, the performance was measured by combining both the gradient angle difference and SNR of the first derivative. Thus, the SNR combined for the line detection using the gradients at the fourth and fifth pixels in Figure 6 can be modeled as follows:  
\[\text{SNR}_{\text{C}}\big{(}\text{line}_{\theta_{4}\text{-}\theta_{5}}\big{)} =\sqrt{\text{SNR}(\text{line}_{\mathbf{p}_{\mathbf{\xi}}})\cdot\text{SNR}_{ \theta_{4}\text{-}\theta_{5}}}. \tag{63}\]  
Moreover, the SNR combined for the line detection using the gradients at the first and eighth pixels in Figure 6 can be modeled as follows:  
\[\text{SNR}_{\text{C}}\big{(}\text{line}_{\theta_{1}\text{-}\theta_{8}}\big{)} =\sqrt{\text{SNR}(\text{line}_{\mathbf{p}_{\mathbf{\xi}}})\cdot\text{SNR}_{ \theta_{1}\text{-}\theta_{8}}}. \tag{64}\]Considering the penalty for blurring, smoothing, and line width in Equation (41), the \(\text{SNR}_{\text{C}}(\text{line}_{\theta_{4}-\theta_{5}})\) in Equation (63) can be derived into \(\text{SNR}_{\text{PS}}(\text{line}_{\theta_{4}-\theta_{5}})\) as follows:  
\[\text{SNR}_{\text{PS}}(\text{line}_{\theta_{4}-\theta_{5}})=p(\sigma_{b}, \sigma_{s},w)\cdot\text{SNR}_{\text{C}}(\text{line}_{\theta_{4}-\theta_{5}}). \tag{65}\]  
Similarly, the \(\text{SNR}_{\text{C}}(\text{line}_{\theta_{1}-\theta_{5}})\) in Equation (64) can be derived into \(\text{SNR}_{\text{PS}}(\text{line}_{\theta_{1}-\theta_{5}})\) as follows:  
\[\text{SNR}_{\text{PS}}(\text{line}_{\theta_{1}-\theta_{5}})=p(\sigma_{b}, \sigma_{s},w)\cdot\text{SNR}_{\text{C}}(\text{line}_{\theta_{1}-\theta_{5}}). \tag{66}\]  
Then, the \(\text{SNR}_{\text{PS}}\) of the sum of the gradient angle differences for all of the four pairs in Figure 6 can be modeled as follows:  
\[ \begin{split}\text{SNR}_{\text{PS}}(\text{line}_{\text{SGAD}}) =\text{SNR}_{\text{PS}}(\text{line}_{\theta_{1}-\theta_{5}})+\text{SNR}_{ \text{PS}}(\text{line}_{\theta_{2}-\theta_{7}})\\ +\text{SNR}_{\text{PS}}(\text{line}_{\theta_{3}-\theta_{6}})+ \text{SNR}_{\text{PS}}(\text{line}_{\theta_{4}-\theta_{5}}).\end{split}