Denoising ECG Signals by using Wt – Sg Technique

DOI : 10.17577/IJERTCONV9IS05029

Download Full-Text PDF Cite this Publication

Text Only Version

Denoising ECG Signals by using Wt – Sg Technique

G. Ravikumara, Smt. A. Rajanib (A)M.Tech(C&Sp),(B)Assistant Professor

Department Of Ece

Jawaharlal Nehru Technological University Kakinada

Abstract. Electrocardiogram (ECG) is a technique of recording bioelectric currents generated by the heart which will help clinicians to evaluate the conditions of a patients heart. So it is very important to get the parameters of ECG signal clear without noise.beacuse of its nature ECG will corrupted with different noises. This noises removed by different digital signal processing techniques .There are different types of DSP techniques were already exist for noise elimination. Here we implementing both high frequency and low frequency noise elimination technique i.e. WT-SG technique.It is combination of the wavelet transform and smoothed FIR filter .This technique will give better RMS,MSE AND AMSE .

Index Terms: WT-SG(wavelet transform and savitzky golay, DSP

(Digital signal processing).


    Signals are carrying information from one place to another place .These are different dimension of signals in nature. Different types of signals are ecg, emg, audio, video etc.While recording this signals different noises corrupted the original signals .Because of these noises, original signals lost their information. These are achieved by digital signal processing technology. It is a best technology for processing real signals .Different techniques are widely used for processing different real signals .one of the real signal is ECG .It means electrocardiogram and it is widely used in medical for evaluate condition of a patient.ECG is combination P Q R S T wave . This are divided into 3 waves .i.e. P wave, QRS complex, T wave .It is shown in figure .1 .P wave is atrial depolarization .QRS complex represents ventricle depolarisation; S wave is the negative deflection following the R wave. And finally T wave represents ventrical repolarization.

    Fig.1 ECG wave

    There are different works already available in the literature for eliminating low and high frequency noises in ECG signals .For instance in [1] empirical mode decomposition (EMD) was present. While in[2],non local means denoising scheme was adopted, and gaussian dictionary were present in [3].In ECG signals QRS amplitude is very high compared to the P and T waves amplitude .Thats why noises present in QRS eliminated very easily compare to the noises in P and T wave .compressed sampling taylor fourier multifrequency is already present in [4].CSTFM algorithm is totally mathematical approach .For implementing CSTFM algorithm its need large amount of time and as well as its require large amount of space and processor for executing a programme . so these problems all are achieving through the new algorithm i.e WT-SG algorithm. This eliminate both low and high frequency noises very efficiently. Baseline wander contain low frequency and power line interference contain high frequency .WT-SG technique is well suited for eliminating these noises.

    This paper is organized as follows .In section 2 we detailed the proposed algorithm ,and then section 3 ,we characterize the algorithm by means of the optimization of the algorithm parameters .section 4 we report the results obtained in real test.


    ECG is superposition of different waves that is P wave QRS wave and T wave . P wave represents arterial depolarization QRS complex represent ventricle depolarization and T wave represents ventrical repolarization .Basically these signals are corrupted by baseline wander, power line interference. These are low and high frequency noises . In this approach consider both low and high frequency noises and eliminated through the WT-SG technique.

    Because of large amplitude of QRS wave .It is less effected by the noises,even though effected it will be remove easily but P and T waves a less amplitude .So these waves effected with noises strongly and elimination of these noises at P and T waves are very difficult.For this different algorithms are well suited for eliminating noises

    .so here we develop WT-SG technique for eliminating

    noises .Under this assumptions the proposed technique is divided into four main parts . The first allows to segment and isolate QRS complexs.Which do not require denoising, the second one is concern the actual denoising step of the remaining signal and third one is signal reconstruction and finally this processed signal pass through SAVITZKY GOLAY FIR smoothed filter.

    1. Detection of QRS segments

      The identification of QRS complex is done directly on the ECG signal. The complexes corresponding to the QR Complexes are identified by wavelet transform proposed in[5] and replaced in the acquired signal (t) by a sequence of zeros .

      As QRS complex spread across the mid and high frequency band, the frequencies associated with (t) are mainly concentrated in the range between 0 and 10 HZ to shown in figure 2 shown in the signal spectrum before (blue line) and after (black line) the removal of QRS complexes .The periodogram is computed over 500 samples providing a frequency resolution of 5.0 Hz . the spectral band width of (t) is significantly reduced from 0-50 Hz. This allows to consider only a few significant spectral lines as shown in figure 2.This justifies our choice of WT-SG algorithm to denoise the signal (t).here

      (t) signal is

      Considered as input signal x(t).

      () = (2() + ()) (1)

      the ECG signal acquisition hardware can remove the powerline interference. However the baseline wandering and other wideband noises which are usually complex stochastic process are not easily to be suppressed by hardware equipments. Instead the software scheme is more powerful than and feasible for offline ECG signal processing.In this paper we are using the wavelet transform and savitzky golay filter based methods used to denoise the ECG signal.

      Removing baseline wandering

      Baseline wandering usually comes from respiration at frequencies wandering between 0.15 and 0.3 Hz ,and we can suppress bit by a high pass digital filter .we also can use the wavelet transform to remove baseline wandering by eliminating trend of the ECG signal.

      Removing wideband noise

      After removing baseline wandering, the resulting ECG signal is more stationary and explicit than the original signal.However, some other types of noises might still effect feature extraction of the ECG signal. The noisy may be complex stochastic process within a wideband .so we cannot remove the wideband noises .so we use the wavelet and savitzky golay filter denoising techniques for removing wideband noises .

      Discrete wavelet transform

      The DWT of a signal x[n]is calculated by passing through a series of filters .first the samples are passed through a low pass filter with impulse response g(n) which gives the convolution of two signals as





      ()( )


      Fig 2. Comparision of the periodogram associated with ECG signal before(black) and (gray) the removal of the QRS complex

    2. Denoising









      SG FIL

      SG FIL


      Fig .3 DWT single stage decomposition

      The signal is also decomposed simultaneously using a high pass filter h(n) .the outputs of the high pass filters are detail coefficients and the outputs of the low pass filter are approximation coefficients .It is important that the two filters are related t each other and they are known as a quadrature mirror filter .since half the frequencies of the signal have now been removed ,half the samples can be discarded according to nyquistss rule. The filter outputs are then sub sampled by 2.

      Fig 3. WT-SG algorithm

      The block diagram of WT-SG technique is shown in below in figure .3

      [n]= ()(2 )





      [n]= ()(2 + 1 )



      Basic noises effect ecg signals are follows

      Power line interference:

      The power line interference is narrow band noise cantered at 60 Hz/ 50H z with a band width of less than 1Hz .usually

      The decomposition halved the time resolution since only one half of each filter output characterises the signal . however each output has half the frequency band of the input .so the frequency has been doubled .

      Cascading and filter banks

      The decomposition is repeated to further increase the frequency resolution and the approximation coefficients decomposed with high and low pass filters and then down sampled .This is represented as a binary tree

      with nodes representation a subspace with different time- frequency localisation .The tree is known as filter bank.

      Fig 4. Dwt multiple decomposition

      At each level in the above diagram the signal is decomposed into low and high frequencies .Due to the decomposition process the input signal must be a multiple of 2 where n is the number of levels .

      Advantages of DWT

      The ability to compact most of the signals energy into a few transformation coefficients ,the ability to capture and represent effectively low frequency components as well as high frequency transients and the variable resolution decomposition with almost uncorrelated coefficients .

      Undecimated wavlet transform

      In dwt the decimation step removes every other of the coefficients of the current level .Thus the computation of the wavlet transform is faster and more compact interms of storage space .more importantly ,the transformed signal can be perfectly reconstructed from the remaining coefficients

      .unfortunately, the decimation is causing shift variance of

      the wavlet transform .unlike the undecimated discrete wavlet transform .unlike the discrete wavlet transform (uwt) does not incorporate the down sampling operations.

      Thus the approximation coefficients and detail coefficients at each level are the same length as the original and high pass filters at each level. Thus up sampling operation uwt coefficients decreases with increasing levels of decomposition. By comparison the UWT with the DWT, the UWT has some unique features.

      • Translation property

      • Better denoising capability

      • Better peak detection capability

        Wavelet shrinkage

        It is assigned denoising technique based on the idea of thresholding the wavlet coefficients .wavlet coefficients having small absolute value are considered to encode mostly noise and very fine details of the signal. In contrast , the important information is encoded by the coefficients having large absolute value. Removing the small absolute value coefficients and then reconstructing the signal should produce signal with lesser amount of noise. The wavlet shrinkage approach can be summarized as follows.

        Consider the standard univariate non-parametric regression setting

        (t)=(t)+ (t) for i=1,2,3……m (5)

        Where (t) s are assumed to come from zero mean normal distribution , (t) are independent standard normal N(0,1) random variables and noise level sigma may be known or unknown .The goal is to recover the underlying functions from the noisy data. X without assuming any particular parametric structure for S.

        1. Calculate the wavelet coefficient matrix W by applying a wavelet transform W to the data.

          W=W(X) =W(S)+W( N) (6)

        2. Modify the detail coefficients of W to obtain the estimate w of the wavelet coefficients of S.



          calculated by n= .where k is the total number of data

          W (7)

        3. Inverse transforms the modified detail coefficients to obtain the denoised coefficients.

        S=1(W) (8)

        The first step in denoisng is selection of the forward and inverse transform W and 1 respectively. There are various types of wavelets that can be used which in their support, symmetry and number of vanishing moments.

        In this chapter we used the wavelets from the haar

        ,daubecechies, coeiflets ,symles, biorthogonal, reversebiorthogonal families and evaluate their suitability for ECG signal denoising interms of PSNR.Inaddition to a wavelet, we also need to select the number of multi resolution levels.The maximum number of levels can be

        points .

        The next step in wavelet based denoising is thresholding

        .Thresholding method can be grouped into two categories, global thresholding and level dependent thresholds. The former chooses a single value for threshold T to be applied globally to all empirical wavelet coefficients. while the later method uses different thresholds for different levels. which is a sample entropy measure totally depends on the size of the signal.

        T= (2 log()) ,where k is the size of the signal and T is the threshold value.

        These threshold require an estimate of the noise level .the usual standard deviation of the data values is clearly not a good estimator,unless the underlying functions is reasonably flat. Donohoand jhonstone considered estimating in the wavelet domain and suggested a robust estimate that is based only on the empirical coefficients the

        finest resolution level in [ 4,6 ].The reason for considering {();=1,2 }

        only first level is that the corresponding empirical wavelet coefficients tend to consist mostly of noise. Since there is some signal present even at this level ,donoho and





        jhonstone proposed a robust estimate of the noise level

        (based on the median absolute deviation [4,6] given by

        Here w0,w1,etc are detail coefficients at the finest level.

        Hard thresholding

        (W) =

        W, for all w >

        { 0, Otherwise

        Soft thresholding

        Or General

        (W)=SGN(W) max(0; W-T) (10)


        = 2

        Semi soft thresholding

        It is a family of non linearity that interpolated between soft and hard thresholding. It is used both main threshold T and a second threshold 1=Mu *T

        +1 +

        = 2

        +1 j




    1 (W)={sgn(w) 1()

    T <

    1 1

    W W > 1

    The tabulations mode vs PSNR for various families of

    wavelets and four shrinkage functions a s shown in tables . a.MSE (mean square error )

    When mu=1 then the semi soft threholdng performs a hard

    thresholding .where mu= . It performes soft thresholding .

    MSE =



    b.PSNR (peak to noise ratio)

    Stein thresholding

    PSNR=20 log

    2 1




    ) Where B bits per sample.

    Another way to achieve a trade off between hard and soft thresholding is used a soft squared thresholding non- linearirty ,also named as steins estimator



    After completing wavelet transform we have a narrow band noises are these are eliminating by FIR smoothed filter i.e. savitzky golay filter.It is a smoothing and differentiation of a data by simplified least square procedure polynomial filter are often considered as piece by piece fitting of a polynomial function to the signal.The fitting is completed by a method least square (LS) estimate between the X matrix and therefore the Y vector


    Where X is the designed matrix for poynomial approximation problem .the standard least square solution is given by

    a= ()1

    or A=Z.Y

    Where Z=()1

    Z is called the convolution coefficient .when we want to suit a polynomial function of order p ,we get a series of equations within the following form .

    parameters calculations

    Actual MSE


    SG MSE


    Actual RMSE




    Fig 3:QRS complex eliminated

    = . +

    . 1+

    . +……….+ . 1+ . 0 for






    Fig 1: ECG SIGNAL

    Fig 2: Noised ECG signal

    Fig 6:high frequency noise eliminated


Fig 4:Periodogram of ECG vs qrs eliminated signal

Fig 5:high frequency noise eliminated signal

The work extended in real applications , in which ECG signals are acquired by a low-cost wearable smartphone- based device during car and motorbikeraces.Because High levels of training or high-performance sports entail a high degree of stress for the human heart that could lead to abnormal behavior in some athletes. For these reasons, monitoring the heart prole during sports competitions or high-level physical activities might diagnose pathologies and prevent possible injuries.S:


  1. M. A. Kabir and C. Shahnaz, Denoising of ECG signals based on noise reduction algorithms in EMD and wavelet domains, Biomed. Signal Process. Control, vol. 7, no. 5, pp. 481489, Sep. 2012.

  2. B. H. Tracey and E. L. Miller, Nonlocal means denoising of ECG signals, IEEE Trans. Biomed. Eng., vol. 59, no. 9, pp. 23832386, Sep. 2012.

  3. G. Da Poian, R. Bernardini, and R. Rinaldo, Gaussian dictionary for compressive sensing of the ECG signal, in Proc. IEEE Biometric Meas. Syst. Secur. Med. Appl., Oct. 2014, pp. 8085.

  4. A. Galli, G. Frigo, and G. Giorgi, Robust ECG Denoising for eHealth applications, in Proc. IEEE Int. Symp. Med. Meas. Appl., Jun. 2018, pp. 16.

  5. J. P. Martínez et al., A wavelet-based ECG delineator: Evaluation on standard databases, IEEE Trans. Biomed. Eng., vol. 51, no. 4, pp. 570581, Apr. 2004.

  6. C. Crema, A. Depari, A. Flammini, and A. Vezzoli, Efcient R- peak detection algorithm for real-time analysis of ECG in portable devices, in Proc. IEEE Sensors Appl. Symp., Apr. 2016, pp.

  7. B. H. Tracey and E. L. Miller, Nonlocal means denoising of ECG signals, IEEE Trans. Biomed. Eng., vol. 59, no. 9, pp. 23832386, Sep. 2012.

Leave a Reply