Academic Journal of Science and Technology ISSN: 2771-3032 | Vol. 6, No. 2, 2023 12 Wavelet Denoising Image Processing Based on MATLAB Xiangyu Feng, Geng Liang, Wei Pei+, Xuying Gao+ School of North China Electric Power University, Beijing, China +Are :the .third *authors Abstract: This article uses MATLAB to simulate the wavelet denoising algorithm. The threshold denoising was simulated using the function method, triple standard deviation method, fixed threshold algorithm, Haar, sym5, Coif3, and db3 wavelet bases. The simulation results show that using the fixed threshold method, the Haar wavelet has the best denoising effect. Keywords: Wavelet Denoising Algorithm, Threshold Denoising. 1. Introduction Wavelet transform is widely used in signal denoising, which not only preserves abrupt signals but also preserves signal spikes. Wavelet transform can be widely used to eliminate noise between transient signals and instantaneous state signals, as well as to suppress high-frequency noise, effectively distinguishing high-frequency information from low-frequency noise. The application and development prospects of wavelet denoising are promising. Nowadays, not only are there more and more applications using wavelet denoising, but also the application fields are constantly increasing, such as mathematics, computer science, seismic exploration data processing, signal analysis, and image processing. Studying the well-developed centralized wavelet denoising algorithms and some improved algorithms is beneficial for better application of wavelet algorithms for more development and utilization, and also contributes to the development of wavelet denoising methods. The concept of wavelet transform was first proposed by an engineer, J. Morlet, in 1974 and established an inversion formula. Perhaps due to the novelty of this concept at the time, it was not recognized by mathematicians at that time. Several years later, two other scholars were curious about this concept. One was the famous mathematician Y. Meyer, who accidentally constructed a real wavelet base in 1986, and cooperated with S. Mallat to establish the same method for constructing wavelet bases - multi scale analysis. After that, wavelet analysis began to spread widely and develop vigorously. In 1992, Donoho and Johnstone proposed the wavelet threshold shrinkage method, and also provided a threshold of𝛿 =𝜎 2logN , proving the advantages of the wavelet threshold shrinkage method; Krim et al. used Rissanen's MDL (MinimumDescriptionLength) criterion and obtained the same threshold formula as them. However, a threshold selection method proposed by Donoho and Johnstone, the universal threshold method, has been studied due to its serious tendency to "over kill" wavelet coefficients. Later, people also studied how to select threshold functions and proposed different threshold functions. However, when these methods are used in non Gaussian and colored noise situations, the results are not very ideal, This is mainly because these methods are based on the assumption of independent and identically distributed noise (i.i.d), and most of these methods are developed from the methods given by Donoho and Johnstone, so their final denoising performance also depends on the assumption that the noise obeys independent normal distribution when using WaveShrink to determine the threshold. In China, professors from Northwestern Polytechnical University have proposed a related filtering algorithm through research, and have made significant breakthroughs in wavelet threshold filtering algorithms. Professors from Beijing University of Technology have developed a battlefield ground target localization technology based on wavelet analysis. Among them, wavelet denoising has published the most articles on telecommunications technology in the past five years, with 884 articles available on Zhiwang, accounting for 21.91% of the published articles in the past five years. There are 732 articles on computer software and computer applications, accounting for 18.17%. There are 347 and 248 articles on automation technology and electrical industry, 8.60% and 6.15%, respectively. From these numbers, it can be found that the application of wavelet denoising is the most widely used in technical research. At the same time, the number of publications in these articles shows that the development of wavelet denoising is very promising. 2. Principle of Wavelet Denoising 2.1. Wavelet transform and discrete wavelet transform Wavelet transform, discrete wavelet transform, and inverse wavelet transform are the theoretical foundations of wavelet decomposition and wavelet reconstruction, so their definitions will be explained next. Let the Fourier transform of function πœ™ 𝑑 be πœ™ 𝑗𝛺 , if it satisfies CΟ† R βˆ— |Ο† jΞ© | 2 |Ξ©| dΞ© ∞ 1 In the formula, R* represents (-∞, 0) U (0,+∞), then it is said to be the basic wavelet function. Equation (1) is often called the admissibility condition of wavelet function. Equation (1) is equivalent to 𝑅 πœ™ 𝑑 𝑑𝑑 0 2 13 That is to say, the area enclosed by the function πœ™ 𝑑 and the horizontal axis is 0, which means that the graph of the function oscillates up and down on the horizontal axis, and its definition domain is not infinite. There is also information that can be clearly known, that is πœ‘ 𝑗𝛺 |𝛺 0 0. Introducing scale factor a and translation factor b,Let π‘ŽοΌŒπ‘ ∈ 𝑅 , π‘Ž 0 , πœ™ 𝑑 get continuous wavelet function under the action of a, b πœ™π‘Ž, 𝑏 𝑑 1 |π‘Ž| πœ™ 𝑑 𝑏 π‘Ž 3 In this way, the continuous wavelet transform (CWT) of the signal𝑓 𝑑 ∈ 𝐿 2 𝑅 can be transformed into π‘Šπœ™π‘“ π‘Ž, 𝑏 𝑓 𝑑 , πœ™π‘Ž, 𝑏 𝑑 𝑅 𝑓 𝑑 πœ™π‘Ž, 𝑏 𝑑 𝑑𝑑 1 |π‘Ž| ∞ ∞ 𝑓 𝑑 πœ™ 𝑑 𝑏 π‘Ž 𝑑𝑑 4 By using the Parseval identity of Fourier transform, it is easy to prove that the inverse transform (ICWT) of continuous wavelet transform is 𝑓 𝑑 ∬ π‘Šπœ™π‘“ π‘Ž, 𝑏 πœ™π‘Ž, 𝑏 𝑑 | | ∞ ∞ ∞ ∞ π‘Šπœ‘π‘“ π‘Ž, 𝑏 πœ™ 5 You can think of wavelet transform as a transformation that maps one-dimensional time signals to two-dimensional space, so there is a lot of redundant information. In this case, select some discrete points and use the results of wavelet transform to depict the signal. Usually, sampling is carried out based on the integer power of a certain constant a0, which is taken as a aj0 π‘Ž0>0οΌŒπ‘— ∈ 𝑍 . In order to arrange the frequency bands of wavelets of different scales adjacent to each other after sampling, covering the entire positive frequency axis, we take b kb0π‘Žj0 𝑏0 ∈ π‘…οΌŒπ‘— ∈ 𝑍 .Then the wavelet πœ™a,b 𝑑 becomes πœ™π‘Ž, 𝑏 𝑑 π‘Ž 1 2πœ™ 𝑑 𝑏 π‘Ž π‘Ž0 1 2πœ™ π‘Ž 𝑗 0 𝑑 π‘˜π‘0 6 Let π‘Ž0 2, this formula obtains the dyadic wavelet, and using this formula for transformation is the dyadic wavelet transform. If we let 𝑏0 1 , we can obtain a dyadic orthogonal wavelet using this formula. As shown in equations 7 πœ™π‘Ž, 𝑏 𝑑 2 𝑗 2πœ™ 2 𝑗 𝑑 π‘˜ 7 The dyadic orthogonal wavelet has been proven to be a set of standard orthogonal bases in the function space 𝐿 2 𝑅 , and the corresponding wavelet transform is called the dyadic orthogonal wavelet transform. Binary discrete wavelet transform (DWT) is shown inequations 8 π·πœ™π‘“ π‘Ž, 𝑏 𝑓 𝑑 , πœ™π‘Ž, 𝑏 𝑑 2 𝑗 2 ∞ ∞ 𝑓 𝑑 πœ™ 2 𝑗 𝑑 π‘˜ 𝑑𝑑 8 For digital signal processing, we are concerned with the time-domain discrete signal x(n). Define the discrete wavelet transform of sequence x (n) as π·πœ™π‘‹ 𝑗, π‘˜ π›₯ π·π‘Šπ‘‡πœ™π‘₯ 2 𝑗 , π‘˜2 𝑗 π‘₯ 𝑛 πœ™π‘—, π‘˜ 𝑛 2 π‘₯ 𝑛 πœ‘ 2 𝑛 π‘˜ 9 2.2. Wavelet basis function Different wavelet bases have different properties, and their denoising effects are inevitably different when performing denoising processing. Using different wavelet bases to obtain different denoised images will introduce the wavelet bases used later and some of their properties. 1) Haar wavelet Haar is an orthogonal wavelet basis with tight support, which is the most classic and simplest wavelet basis. Its function graph is a rectangular wave with a support domain of 𝑑 ∈ 0,1 . 2) Daubechies (dbN) wavelet Daubechies wavelet is written as dbN in daily use, with N being the order. The dbN wavelet basis has good regularity and is relatively smooth. Only when N=1, this wavelet basis has symmetry, while other dbN wavelet bases do not. The lack of symmetry can result in certain phase distortion when decomposing and reconstructing signals. The dbN wavelet basis only has a fixed formula when N=1, and when N=1, db1 is the Haar wavelet. 3) Symlet (symN) wavelet Symlet wavelet bases are written as symN in daily use, with N being the order, starting from 2 to 8. This type of wavelet is essentially derived from dbN. The symmetry of symN is very good, which can reduce some distortion problems during image decomposition and reconstruction. 4) Coiflet (coifN) wavelet Coiflet is generally abbreviated as CoifN, where N is the order, ranging from 1 to 5. The 2N order moment of Coiflet's wavelet functionπœ‘ 𝑑 is zero, and the 1-2N order moment of the scale function πœ™ 𝑑 is zero. The symmetry of the wavelet function and scale function of the dbN wavelet base is not as good as CoifN wavelet base, that is, the smoothness is not as 14 good as CoifN 3. Comparison of Simulation Results 3.1. Comparison of denoising effects using different threshold determination methods 1) Functional method The function method ddencmp is used to achieve automatic threshold acquisition, while wdncmp is used to achieve automatic noise reduction function, which can change parameters to achieve soft and hard threshold denoising. The function method mainly uses the two unique functions in MATLAB to achieve threshold acquisition and image soft and hard threshold denoising. Figure 1. Function method threshold denoising image Figure 2. Histogram before and after threshold denoising using the function method 2) Triple standard deviation method Step 1: Calculate the standard deviation of wavelet coefficients. Step 2: Set the wavelet threshold to three times the noise standard deviation. If the monitoring data obtained from a certain detection is X1, X2, X3... Xn, the average value is: π‘₯ π‘₯1 π‘₯2 π‘₯3 β‹― π‘₯𝑛 𝑛 βˆ‘ π‘₯𝑖 𝑛 10 The standard deviation is: 𝜎 π‘₯1 π‘₯ 2 π‘₯2 π‘₯ 2 β‹― π‘₯𝑛 π‘₯ 2 𝑛 βˆ‘ π‘₯𝑖 π‘₯ 2 𝑛 11 Value within x Β± 3 Οƒ The values within this range are normal values, while those outside this range are outliers. Figure 3. Thresholding denoising image using triple standard deviation method Figure 4. Histogram before and after threshold denoising using triple standard deviation method Fixed threshold estimation method Step 1: Calculate the variance of the noise. Step 2: Use the fixed threshold formula to calculate the wavelet threshold. πœ† πœŽπ‘’οΌŒπ‘—βˆš2lnN, Οƒ Represents the standard deviation of the noise calculated above, and N represents the size of the image. 15 Figure 5. Fixed threshold method threshold denoising image Figure Figure 6. Fixed threshold method threshold denoising before and after histogram The above introduces various threshold methods and obtains simulation images of each threshold method. From Figures 1, 3, and 5, it can be seen that regardless of which threshold method is used to obtain the threshold, the simulated hard threshold denoising image is brighter. However, the soft threshold denoising has fewer noise points, clearer details and edges, and is closer to the original image. From Figure 1, it is found that the denoising effect of using function method soft and hard threshold denoising on images is not significantly different, and both soft and hard threshold denoising effects are good. From Figure 5, it can be seen that the denoising effect using the fixed threshold estimation method is also better, and the soft threshold denoising is closer to the original image, while the hard threshold denoising is whiter than the original image, with unclear dark details and blurry edges. The triple threshold standard deviation rule shown in Figures 3 is the worst denoising method. Similarly, soft threshold denoising displays images that are relatively black, while hard threshold denoising displays images that are relatively white. However, their images contain more noise points and are blurry. Due to the black nature of soft threshold denoising, the lower edges are not visible and details are lost more. Compared to hard threshold denoising, they are brighter, So there is less loss of details and clearer edges. Comparing images 2, 4, and 6, it can be seen that the pixel distribution of the triple threshold method in images 4 differs significantly from the original image, resulting in too much image distortion. However, the function method and fixed threshold method in images 2 and 6 are similar, but the pixel distribution of the fixed threshold method is closer to the original image than the function method. 3.2. Comparison of denoising effects using different wavelet bases Figure 7. Haar wavelet based threshold denoising image Figure 8. Haar wavelet based threshold denoising before and after histogram Figure 9. Sym5 wavelet based threshold denoising image 16 Figure 10. Histogram of sym5 Wavelet Based Threshold before and after Denoising Figure 11. Coif3 wavelet based threshold denoising image Figure 12. Coif3 wavelet based threshold denoising before and after histogram Figure 13. Denoising image of db3 wavelet based threshold Figure 14. Histogram of db3 wavelet based threshold denoising before and after denoising Comparing images 7, 9, 11, 13, it can be seen that the Haar wavelet basis has the best denoising effect, with good soft and hard threshold denoising effects, clear edges, and slightly inferior details. The sym5 wavelet basis has a slightly worse denoising effect, with a slightly worse hard threshold denoising and more noise, while a better soft threshold denoising and better details. The denoising effect is further improved by using the db3 wavelet basis. The hard threshold denoising is more blurry, while the soft threshold denoising is slightly better, with clearer edges. The worst denoising effect is the Coif3 wavelet basis, which not only blurs the image but also loses a lot of details, resulting in a large difference in brightness and darkness. Comparing images 8, 10, 12, and 14, it can be seen that the overall trend of pixel distribution before and after denoising using Haar wavelet basis is more consistent in Figure 8, while the consistency of pixel distribution before and after denoising using sym5 wavelet basis is slightly poor in Figure 10. Figures 14 using db3 wavelet basis are worse than those using sym5, while the pixel distribution before and after denoising using coif3 wavelet basis is much different. 4. Conclusion With the rapid development of modern technology, image processing technology is becoming increasingly important. Denoising images is an important part of image processing. Images are always subject to interference from various signals 17 during transmission, and at this point, they become noisy images. Image denoising is a technique for removing the interference noise from noisy images. Compared with classical denoising algorithms, wavelet denoising algorithms can better preserve image information in the high-frequency field, and do not remove high-frequency noise and information together. This article introduces the wavelet threshold algorithm and uses MATLAB simulation to compare the denoising effects of the denoised images obtained by using fixed threshold method, function method, and triple standard deviation method to obtain the threshold, Haar, sym5, db3, and coif3 wavelet bases. The denoising effect of the function method and the fixed threshold method is not much different, and the denoising effect of the triple standard deviation method is the worst, and the image is also unclear. The denoising effect using Haar wavelet basis is better than using sym5, db3, and coif3 wavelet basis. Furthermore, it was concluded that using a fixed threshold method, the denoising effect of Haar wavelet basis is better. References [1] Gunawan D. Denoising images using wavelet transform [A]. In: Proceedings of the IEEE Pacific Rim Conference on Communications, Computers and Signal Processing[C]. Victoria BC, USA, 1999:83-85. [2] Ching P C, So H C, Wu S Q. On wavelet denoising and its applications to tim e delay estimation[J]. IEEE Trans. Signal Processing , 1999:2879-2882. [3] Jansen M, Bultheel A. Multiple wavelet thres hold estimation by generalized cross validation for images with correlated noise[J]. IEEE Trans. Image Processing, 1999, (8οΌ‰:947-953. [4] Krim H, Schick I C. Minimaxdes cription length for signal denoising and optimized represent ation[J]. IEEE Trans. Informati on Theory, 1999:898-908. [5] Xu Yansun, Weaver J B, Healy M J etal. Wavelet transform domain filters: A s patially selective noise filtration technique[J]. IEEE Trans. Image Processing, 1994:743-758.