# Research on Image Denoising in Edge Detection Based on Wavelet Transform
## 3 Materials and Methods
### Data Processing
#### 3.2.2 Image Denoising  
For two-dimensional image information, wavelet decomposition can be performed in the horizontal and vertical directions to obtain the corresponding wavelet coefficients. The wavelet coefficients are the projection of the space of wavelet functions chosen to run the wavelet decomposition. The decomposed high-frequency coefficients are threshold quantized and filtered by selecting an appropriate threshold value and a suitable threshold function. Finally, the wavelet inversion is performed, and the wavelet reconstruction is carried out using the reconstruction algorithm to obtain the denoised signal based on the deepest low-frequency coefficients of the wavelet decomposition and the high-frequency coefficients (wavelet coefficients) of each level after the threshold quantization process. After the multi-resolution decomposition is achieved, the approximate coefficients, horizontal detail coefficients, vertical detail coefficients and diagonal detail coefficients of each level can be derived. The decomposition results are shown in Figures 3 and 4.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Wavelet Functions** & **PSNR (dB)** & **MSE** \\ \hline sym5 & 23.48 & 299.49 \\ db5 & 23.37 & 300.53 \\ coif5 & 23.22 & 309.89 \\ fk6 & 23.28 & 305.40 \\ \hline \hline \end{tabular}
\end{table}
Table 1: The \(PSNR\) and \(MSE\) of different images denoised by different wavelet functions.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Levels** & **PSNR (dB)** & **MSE** \\ \hline
2 levels & 17.14 & 1251.00 \\
3 levels & 23.48 & 299.49 \\
4 levels & 23.31 & 303.25 \\
5 levels & 22.72 & 347.75 \\ \hline \hline \end{tabular}
\end{table}
Table 2: The \(PSNR\) and \(MSE\) of different levels denoised.  
After the decomposition is completed, the effective part of the signal corresponds to a larger coefficient, and the noise corresponds to relatively small coefficient. Therefore, the coefficients in a certain interval can be filtered, and the noise will be suppressed simultaneously by setting a suitable threshold and threshold function. In general, the threshold function can be selected as either a hard or soft threshold function, both of which have advantages and disadvantages. Hard threshold functions are better than soft threshold functions in the sense of mean squared deviation, but they may produce jump points, while soft threshold functions have better continuity but produce biases that affect the reconstructed signal [5, 24, 25, 26]. The hard threshold function working process is shown in Figure 5.  
Figure 4: The second level of decomposition (**a**) noisy image; (**b**) approximation coefficient; (**c**) detail coefficient; (**d**) detail coefficient; (**e**) detail coefficient; (**f**) reconstruction result.  
Figure 3: The first level of decomposition: (**a**) noisy image; (**b**) approximation coefficient; (**c**) detail coefficient; (**d**) detail coefficient; (**e**) detail coefficient; (**f**) reconstruction result.  
In this paper, a hard threshold function is chosen to process the coefficients, and the wavelet reconstruction is followed. The wavelet function used in the reconstruction process is consistent with the decomposition process. After thresholding of the bridge image, which contains noise, the coefficients are reconstructed, as shown in Figure 6.