## 1 Introduction

During the transmission and communication of X-ray images, they are usually accompanied by random pulse interference and other noises, which degrades the quality of the images and is not conducive to early diagnosis. Therefore, in the image preprocessing stage, filtering the noise becomes especially important.

Based on the characteristics of the mixed noise accompanying the X-ray images in the process of transmission and communication, an image denoising method based on wavelet transform and median filtering was proposed. The experiment results make clear that the image denoising method devised in this article can denoise X-ray images and improve the accuracy of reading and diagnosis.

The second part of this article introduces the basic theory and application of median filtering. The third part discusses the selection of wavelet. The fourth part proposes an X-ray image denoising method based on wavelet transform and median filtering. Finally, the fifth part gives experimental results and discussion.

## 2 The basic theory of median filtering and its application

### 2.1 The essential theory of median filtering technology

Median filtering is a nonlinear signal processing technique that can effectively suppress noise based on the sequence statistics theory [1]. The advantages of this kind of filter are simple calculation, easy implementation, and fast speed. In some cases, it can exceed image detail blurring created by linear filters, for example, mean filtering, and it is the most efficient method for filtering out impulse interference and image scanning noise [2].

The basic principle of median filtering [3] is to substitute the value of a digital point or a point in a digital sequence with the median value of each point near the point.

The definition is as follows:

*x*

_{1},

*x*

_{2},

*x*

_{3},...,

*x*

_{n}, ordering the n numbers in the sequence as

*x*

_{i}

_{1}≦

*x*

_{i}

_{2}≦

*x*

_{i}

_{3}≦...≦

*x*

_{in}according to the order of the value, there are:

*y*was called the median of the sequences

*x*

_{1},

*x*

_{2},

*x*

_{3},...,

*x*

_{n}.

*x*

_{i},

*i*∈

*I*},

*I*is a natural number set or subset, the window length is n, and the filter output is:

*i*∈

*I*,

*u*= (

*n*- 1)/2.

### 2.2 The application of median filtering technology

Now change the added noise to Gaussian noise with a mean squared error of 0.02, use the median filtering with 3*3, 5*5 and 7*7 as the templates to denoise and compare the results. See the Figure 1 [4].

Figure 1(a) is the primitive image, Figure 1(b) is Gaussian noise with a mean square error of 0.02, Figure 1(c) is the median filtered image with a window of 3*3, Figure 1(d) is the median filtered image with a window of 5*5 and Figure 1(e) is the median filtered image with a window of 7*7. As can be seen from the Figure 1, the median filter is very efficient in filtering the salt and pepper noise of the image.

## 3 Image denoising wavelet selection

### 3.1 Wavelet threshold shrinkage method

At present, people have proposed a variety of threshold selection methods, such as VisuShrink, RiskShrink, SureShrink, and WaveJSShrink. The VisuShrink method uses a globally uniform threshold
*σ* is the normal deviation of the noise signal (the strength of the noise), and *N* measures the length of the signal.

### 3.2 Algorithm description of wavelet threshold shrinkage method

The wavelet threshold shrinkage method for denoising is composed of the following three steps:

- (1)Calculating the orthonormal wavelet transform of the noisy signal.
- (2)Non-linear thresholding of wavelet coefficients. To keep the overall shape of the signal unchanged, retain all low-frequency coefficients
*v*_{L,k},*k*= 1, . . . , 2^{L}. Take the threshold value , for each wavelet coefficient, use the soft threshold method or hard threshold method for processing:$\lambda =\sigma \sqrt{2logN}$ - Soft threshold:
${\tilde{w}}_{j,k}=\{\begin{array}{c}{w}_{j,k}-\lambda \hspace{0.17em}{w}_{j,k}\ge \lambda \\ 0\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\left|{w}_{j,k}\right|\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}<\lambda \\ {w}_{j,k}+\lambda \hspace{0.17em}\hspace{0.17em}\hspace{0.17em}{w}_{j,k}\le -\lambda \end{array}$ - Hard threshold:
${\tilde{w}}_{j,k}=\{\begin{array}{c}{w}_{j,k}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\left|{w}_{j,k}\right|\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\ge \lambda \\ 0\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\left|{w}_{j,k}\right|\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}<\lambda \end{array}$

- Soft threshold:
- 3)Performing inverse wavelet transform. Since the noise is mainly concentrated in the highest resolution level
*J*- 1, so we can use the wavelet coefficients {*w*_{J}_{−1,}_{k},*k*= 1, 2, . . . , 2^{J}^{−1}}to estimate the noise standard deviation, for example take .$\tilde{\sigma}=\underset{k=1,\dots ,{2}^{J-1}}{\text{median}}\left(\left|{w}_{J-1,k}\right|\right)/0.6745$

Denoising by the threshold method not only can completely suppress the noise but also can retain the characteristic peak points reflecting the original signal well, so it has a good denoising effect.

## 4 Image denoising combining median filtering and wavelet denoising

From the above analysis, we can know that the median filtering has a clear denoising effect on X-ray images containing impulse (salt and pepper) noise when the denoising effect on Gaussian noise-containing X-ray images is not very good, it is quite fuzzy, the contrast is poor, and some details are lost. The wavelet image denoising method has ideal denoising and plays a role in the X-ray images containing Gaussian noise, while its denoising plays a role in the X-ray images containing impulse (salt and pepper) noise and is far worse than that of the median filtering.

However, impulse (salt and pepper) noise, and then the Gaussian noise are the two most ordinary types of noise in an image. In real life, during the transmission and communication of X-ray images, they often coexist as a kind of mixed noise. The simple median filtering denoising method or wavelet image denoising method is also not ideal for denoising this kind of mixed noise.

For mixed noise in which the impulse (salt and pepper) noise and Gaussian noise coexisted at the same time, we need to combine different methods to denoise many a time. In recent years, people have proposed many new methods to remove the mixed noise, and regarding this, Zhang Xuming et al. proposed a mixed filtering method based on adaptive median filtering and adaptive weighted average filtering [5]. Wang Jianyong et al. who combined median and fuzzy filtering techniques, proposed a new image mixed noise filtering algorithm [6], while Ni Hongxia et al. proposed a denoising system for median filtering in wavelet domain [7]. These methods can simultaneously suppress Gaussian and impulse (salt and pepper) noise in the image. Overall, these methods can be summarised as two categories: the first is the combination of median filtering and mean filtering techniques, first classifying the noise by detection, perform median filtering on impulse (salt and pepper) noise, and perform mean filtering on Gaussian noise. The second category is the combination of median filtering and wavelet denoising, which makes full use of the advantages of median filtering to impulse (salt and pepper) noise and the advantages of wavelet denoising to take out Gaussian noise. The algorithm in this paper belongs to the latter category.

The median filtering can well denoise the mixed impulse (salt and pepper) noise in the X-ray images, while the wavelet denoising method can well denoise the mixed Gaussian noise in the X-ray images. If these two kinds of noises can be separated, or when denoising the first kind of noise, the effect of the second noise on the denoising effect of the first one can be minimised, and then perform denoising on the second kind of noise, then the two filtering methods can each exert their advantages in denoising the X-ray images.

Therefore, the most critical thing is to separate the two kinds of noises or to minimise the effect of one noise on the denoising effect of the other noise. We have found that the impulse (salt and pepper) noise changed the grayscale worth of the pixels in the X-ray images greatly, but the number of these pixels is not large; while the Gaussian noise changed the grayscale value of the pixels in the X-ray image a little, the number of these pixels becomes large, and the grayscale values of all pixels have changed.

Based on the above analysis, we can first perform median filtering on the noise image. In each window, we take the middle grayscale value so that we can restore the grayscale values of those pixels whose grayscale values change greatly. The visual sensation is to filter out those spots that are significantly whiter or blacker than their surroundings.

As for the standard median filtering method, its method is to employ a window to scan on the image and arrange the image pixels contained in the window in the ascending or descending order of the grayscale, take the pixel greyscale with the centred grayscale value as the grayscale of window centrr pixel, and then complete the median filtering [8].

Usually, the amount of pixels in the window is odd so that there is an intermediate pixel. If the amount of pixels in the window is an even in number, the median value is on the average of the grayscales of the two pixels in the middle.

About the soft threshold denoising method based on the Bior wavelet, it can be divided into the following two steps:

The first step is the decomposition and reconstruction of X-ray images. Choose the appropriate wavelet and then the appropriate decomposition level (marked as *N*) and perform an *N*-layer decomposition calculation on the 2D X-ray image signal to be analysed. A 3.3 biorthogonal wavelet was chosen and the number of decomposition layers N was chosen to be 3.

_{LL}

_{3}is the low-frequency part of the image and focused on its main part of the energy. W

_{HLK}(k=1,2,3) is the horizontal element, W

_{LHK}(

*k*=1,2,3) is the vertical element, W

_{HHK}(

*k*=1,2,3) is the diagonal element, and these three elements are the details of the image [9]. For every layer of decomposition, select an appropriate threshold, and threshold the high-frequency coefficients of this layer. According to the Donoho threshold, the threshold value

*λ*

_{k}of the wavelet coefficient for each layer is calculated by the formula (1), where

*σ*

_{k}is the noise standard deviation, N is the number of original image pixels [10]. The calculation method of

*λ*

_{k}is as follows:

Then, following the *N*-th layer approximation (low-frequency coefficients) after wavelet decomposition and the details of the layers after the threshold quantization (high-frequency coefficients), calculate the wavelet reconstruction of the two-dimensional signal [11,12,13,14,15].

## 5 Experimental results and analysis

In the simulation experiment, a 256*256 X-ray image FEI was used as an experimental object, and the mixed noise of Gaussian noise and impulse (salt and pepper) noise were added. By changing the variance of the Gaussian noise and the noise density of the impulse (salt and pepper) noise, several sets of experimental results were obtained for comparison. For the denoising method used in the comparison of the experiment, we choose to use the simple median filtering, wavelet image denoising, and the proposed algorithm of this paper for denoising and then make comparisons.

Compare the filtering effect after adding the mixed noise in which the mean value of the Gaussian noise is 0, the variance is 0.01, and the impulse (salt and pepper) noise density is 0.1.

As shown in the Figure 3, Figure 3(a) is the noise-added image, Figure 3(b) shows the image after median filtering, Figure 3(c) shows the image after VisuShrink soft threshold denoising and Figure 3(d) is the algorithm proposed by this article. By comparison, it is found that the denoising effects on the proposed algorithm is much better than the simple median filtering and the VisuShrink soft threshold wavelet denoising method. The denoising have more obvious effect than it, and the details of the image and edge information remain intact. The mixed noise of impulse (salt and pepper) is also filtered out thoroughly.

By changing the density and intensity of the mixed noise, we get a set of information, which is precisely described by Peak Signal to Noise Ratio (PSNR) and Mean Square Error (MSE).

*M*×

*N*. The expression of Peak Signal to Noise Ratio (PSNR) is:

*Q*represents the quantitative level, and here

*Q*takes 255. As a measure of the filter performance, the larger the PSNR, the better the effect of filtering out the noise.

From Table 1, it is known that the method used in this article has the best effect on mixed noise denoising, the mean square error after denoising is the smallest, and the peak signal-to-noise ratio is the largest. The algorithm of this article is quite good for processing images with mixed noise, and its advantages are quite obvious compared to other methods; therefore, for the processing of images with mixed noise, the method chosen in this paper is better.

Experimental results of the denoising of the FEI image with mixed noise by different algorithms (MSE/PSNR).

Impulse (salt and pepper) noise | 0.05 | 0.1 | 0.2 | 0.05 | 0.1 | 0.2 |

Gaussian white noise | 0.01 | 0.01 | 0.01 | 0.02 | 0.02 | 0.02 |

Noise image | 1562.134/16.0052 | 2442.991/14.0761 | 4312.669/11.6569 | 2142.309/14.6674 | 3026.395/13.2002 | 4744.419/11.2596 |

Median filtering algorithm | 557.8286/20.4483 | 580.9237/20.2745 | 597.7874/20.1184 | 1031.996/17.8028 | 1061.468/17.6601 | 1061.973/17.6579 |

VisuShrink soft threshold method | 265.7028/23.6036 | 356.5844/22.3437 | 575.4486/20.6593 | 283.8094/23.3212 | 369.1374/22.1506 | 515.6530/20.7221 |

Algorithm of this paper | 144.3706/26.2155 | 145.5194/26.1817 | 160.3172/25.7669 | 212.1041/24.5683 | 215.3995/24.5023 | 227.1514/24.2748 |

The experimental results make clear that the denoising effect of the proposed system is far superior to the traditional mean filtering method and the single wavelet soft thresholding method. The traditional mean filtering method loses more effective detail elements and makes the image blur and unclear, while the single wavelet soft threshold method is not ideal for the effect of denoising of impulse (salt and pepper) noise, and it often leads to blurring of the edges. This system not only reduces the noise of the image but also preserves the details of the image as much as possible. Through the denoising method proposed in this paper, the denoising of X-ray images can be achieved, which not only reduces the noise of X-ray images but also attributes to modify the accuracy of diagnosis and reduce the reading differences.

This article is supported by the Science and Technology Research Fund (Grant: 192102210249) of Henan Science and Technology Department. It is also supported by the Foundation of Henan Educational Committee under Contract No. 19A120009 and No. 19B510007.

## References

- [1]↑
B.C. Li, T.Q. Peng, Z. Peng, Intelligent image processing technology, Beijing: Electronic industry press, 2014.

- [3]↑
Y.L. You, D. Kaveh, Fourth-order partial differential equations for noise removal, IEEE Trans. Image Processing 9 (2016) 1723–1730.

- [4]↑
J.Z. Wang, Image-Denoising Method Based on Daubechies Wavelet Transform and Median Filter, Journal of Wuhan Univertisy of Technology 23 (2015) 19–25.

- [5]↑
J.S. Walker, Y.J. Chen, Image denoising using tree-based wavelet subband correlation and shrinkage, Optical Engineering 39 (2016) 715–836.

- [6]↑
Z.L. Zhang, C.H. Zhao, X.D. Mei, The modern image processing technology and MATLAB, Beijing: People's posts and telecommunications publishing house 171 (2014).

- [7]↑
B.A. Thomas, J.J. Rodriguez, Wavelet-based color image denoising, IEEE International Conference on Image Processing Proceedings 2 (2017) 804–807.

- [8]↑
H.L. Eng, K.K. Ma, Noise Adaptive Soft-Switching Median Filter, IEEE Trans. Image Processing 10 (2015), 242–251.

- [9]↑
L.Z. Xia, J.X. Li, Digital image processing, Nanjing: Southeast university press (2018) 157–159.

- [10]↑
H.L. Li, Z.M. Zhang, Z.Q. Yi, The application of median filtering on image processing, Information Technology 28 (2015) 26–52.

- [12]↑
A. Jalobeanu, L. Blanc-Feraud, J. Zerubia, Satellite image deconvolution using complex wavelet packets, IEEE International Conference on Image Processing Proceedings 3 (2017) 809–812.

- [13]↑
Z.Z. Zhen, P. Shen, X.H. Yang, Y.L. Wan, Wavelet transform and its application in the MATLAB tools, Beijing: Seismological Press, 2017.

- [14]↑
J.Y. Wang, X.G. Zhou, Q.Z. Liao, A Mixed Noise Filter Based on Median-Fuzzy Technology, Journal of Electronics & Information Technology 27 (2018) 901–904.

- [15]↑
H.X. Ni, Q.D. Hu, A Method of Image De-Noising Based on Wavelet Domain Median Filter, Journal of Dalian Railway Institute 27 (2016) 35–38.

- [16]
Patidar S, Pachori R B, Garg N. Automatic diagnosis of septal defects based on tunable- Q, wavelet transform of cardiac sound signals [J]. Expert Systems with Applications, 2015, 42(7):3315–3326.

- [17]
Cao J, Zhang J, Wen Z, et al. Fabric defect inspection using prior knowledge guided least squares regression [J]. Multimedia Tools & Applications, 2017, 76(3):4141–4157.

- [18]
Ayad M, Chikouche D, Boukazzoula N, et al. Search of a robust defect signature in gear systems across adaptive Morlet wavelet of vibration signals [J]. Signal Processing Iet, 2014, 8(9):918–926.

- [19]
Hu G H, Zhang G H, Wang Q H. Unsupervised defect detection in textiles based on Fourier analysis and wavelet shrinkage [J]. Applied Optics, 2015, 54(10):2963–80.

- [20]
Havale V, Narayanan S. Diagnosis of manufacturing defects in a gear pair using wavelet analysis of vibration and acoustic signals and an ANN-based inference technique [J]. Insight - Non-Destructive Testing and Condition Monitoring, 2014, 56(8):426–433(8).