Table of Contents Author Guidelines Submit a Manuscript
Computational and Mathematical Methods in Medicine
Volume 2019, Article ID 7196156, 7 pages
Research Article

Electrocardiogram Baseline Wander Suppression Based on the Combination of Morphological and Wavelet Transformation Based Filtering

1Hubei Key Laboratory for High-efficiency Utilization of Solar Energy and Operation Control of Energy Storage System, Hubei University of Technology, Wuhan 430068, China
2Hubei Collaborative Innovation Center for High-efficiency Utilization of Solar Energy, Hubei University of Technology, Wuhan 430068, China
3Hubei Power Grid Intelligent Control and Equipment Engineering Technology Research Center, Wuhan 430068, China
4Faculty of Health, Engineering and Sciences, University of Southern Queensland, Toowoomba, QLD 4350, Australia

Correspondence should be addressed to Feng-cong Li; moc.qq@757301104

Received 13 August 2018; Revised 14 January 2019; Accepted 7 February 2019; Published 3 March 2019

Academic Editor: Maria E. Fantacci

Copyright © 2019 Xiang-kui Wan et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.


One of the major noise components in electrocardiogram (ECG) is the baseline wander (BW). Effective methods for suppressing BW include the wavelet-based (WT) and the mathematical morphological filtering-based (MMF) algorithms. However, the T waveform distortions introduced by the WT and the rectangular/trapezoidal distortions introduced by MMF degrade the quality of the output signal. Hence, in this study, we introduce a method by combining the MMF and WT to overcome the shortcomings of both existing methods. To demonstrate the effectiveness of the proposed method, artificial ECG signals containing a clinical BW are used for numerical simulation, and we also create a realistic model of baseline wander to compare the proposed method with other state-of-the-art methods commonly used in the literature. The results show that the BW suppression effect of the proposed method is better than that of the others. Also, the new method is capable of preserving the outline of the BW and avoiding waveform distortions caused by the morphology filter, thereby obtaining an enhanced quality of ECG.

1. Introduction

Electrocardiogram (ECG) is an important clinical tool for heart disease diagnosis; hence, precision of ECG is a matter of life and death. However, the quality of the ECG signal is degraded during acquisition due to the interferences including power line harmonics, motion artifact, and baseline wander (BW), which makes it difficult to identify the factors which reflect the characteristics of physiological activity. As a consequence, interference suppression should be applied before the analysis of ECG [1]. Notably, the most important step is BW suppression which produces a stable signal for subsequent processing and for reliable visual interpretation.

BW embedded in ECG is mainly caused by the movement and respiration of the patient; consequently, it appears as low-frequency artifacts [2]. Unfortunately, although the high-pass filter is capable of suppressing BW, the ECG waveform distortion is inevitable because of the frequency variations of the ECG signal. Hence, a number of advanced BW suppression algorithms including linear low-pass filters, nonlinear filters, polynomial interpolation, wavelet filters, and mathematical morphological filters (MMF) are proposed [39].

Linear filters can effectively filter the high-frequency signals but cannot remove the additive noise, which has a frequency band similar to that of ECG signals. Polynomial interpolation depends on the accurate determination of knots and may be unreliable during knot separation [10]. As a nonlinear filtering technique, MMF can obtain local shape features in signals by structuring the element sequences [11, 12]. However, its applications may result in “step-like” waveform distortions. Wavelet transform (WT) has also been used in BW removal. In [3], BW is estimated from the discrete WT coefficients at level j and is subtracted from the original ECG signals. WT method exhibits relatively good effects for BW suppression. However, this method causes T waveform distortions due to the frequency overlaps between the high-scale approximate coefficients and T wave. The ECG signal is reconstructed by an inverse WT, and the high-scale approximate coefficients are set to zero, thereby causing the T wave distortion [13].

This study introduces a combined algorithm (CA) of MMF- and WT-based filtering for BW suppression. The CA can effectively preserve the outline of the BW and avoid waveform distortions caused by morphology filters, thereby obtaining an enhanced ECG quality.

The study is organized as follows. Section 2 describes the combined filtering method, while the simulation results are provided and quantitatively analyzed in Section 3. Finally, summary and conclusions are drawn in Section 4.

2. The Combined Method

Considering that the main focus of this study is BW suppression, we model the contaminated ECG as the superposition of the real ECG and the BW and ignoring other types of interferences, as follows:where , , and are the contaminated ECG-, real ECG-, and BW-function with respect to time index , respectively. All of the time functions in this study are discrete because the implementation of filtering is focused on digital processing. The BW suppression is commonly implemented by cancellation, i.e.,where the hat symbol denotes the estimation of the underneath term. The output error of this cancellation procedure is given bywhich indicates that the performance of BW suppression is determined by the estimator of , i.e., . To refine the estimator , we provide a staged framework which combines different filtering technology. The expression of this framework is shown as follows:where is the filter and operator denotes function composition, defined as follows:

By choosing filters carefully, the framework is capable of combining advantages of different filter implementations, and in this study, we combine the MMF-based filter and WT-based filter.

2.1. The Morphological Filtering

The shortcomings of the linear BW suppression methods are caused by the nonlinear nature of the contaminated ECG. Hence, nonlinear processing methods are preferred, and the MMF belongs to this category, which is capable of maintaining the shape of the input signal. The objects of the morphological operations are sets and vectors; for the clarity of descriptions, hereafter vectors are denoted by lower case boldface letters, and denotes the real coordinate space of dimensions. The reflection of a set comprised of vectors is defined aswhile the translation is given byand hence the dilation and erosion can be expressed as follows:

The morphological filter is comprised of opening and closing operators, which can be expressed by dilation and erosion, as follows:

We can apply these morphological operators to a time function by treating the plane as a binary image, and the value of the pixels underneath the curve equals one. The geometric interpretation of opening in equation (9) and closing in equation (10) is sliding a given structuring element along with the signal from beneath and above, respectively. Specifically, the result of opening comprises the highest points reached by any part of the structuring element, while closing is comprised of the lowest ones. Consequently, the semantic meaning of opening/closing is peak-suppression/pit-filling. According to the model shown in equation (1), the spiky can be seen as the noise for estimation, and intuitively the combination of opening and closing is capable of smoothing the fluctuation introduced by the . The expression of the estimator has the following form:where is the structuring element. Let the output of the filter be the estimation of , i.e.,the estimation of can be obtained by cancellation:where denotes the identity operator, i.e.,

We test the estimator and the cancellation procedure using Massachusetts Institute of Technology-Boston’s Beth Israel Hospital (MIT-BIH) arrhythmia database [14] (record number 109). Shape and size of the chosen structuring element are very important. The shape of structuring element should be as similar as the filtered signal waveform needed. The ECG baseline wander is a low-frequency signal, and its shape is more approximate to the line segment. So the morphological filters are with line segments as structuring elements. And the height of linear structuring element has little effect on the results of mathematical morphological filtering. The size of structuring element directly determines whether the noise can be better removed and whether the required signal can be better retained. The width of structural element should be wider than the noise waveform removed and narrower than the signal waveform needed to be retained. If the width of the structural element is too small, the noise component cannot be eliminated well; if the width of the structural element is too large, some signals that need to be retained will be filtered. The time duration of characteristic waves of ECG is listed in Table 1.

Table 1: Time duration of characteristic waves of ECG signal.

For ECG signals with BW, the frequency range of BW noise is slightly smaller than that of T wave, that is, the time width of baseline drift noise waveform is larger than that of characteristic waveform of ECG signal. As mentioned above, the time width of T wave is 0.05–0.20 s; when the sampling rate is 360 Hz, the sampling points are . So, the width of structural elements selected by BW is 72 sampling points in this paper. The result is shown in Figure 1.

Figure 1: Example of removing BW using morphology filter. (a) The ECG contaminated by BW. (b) The filtered ECG signal by MMF. (c) The estimated BW.

Theoretically, if morphological filtering with a large width of the structuring element is used to process the signal directly, the BW is obtained. Despite the high amplitude of QRS wave, the peaks and pits of its adjacent regions are also removed during the simulation, resulting in the distortion of the QRS waves and P-R segments.

2.2. The Combination of WT-Based Filter

Although the MMF can track the slow drifting of the baseline wandering, step-like shape shown in Figure 1(c) demonstrates that the estimated BW is still noisy. Considering various degrees of distortions, we adopt WT-based filtering to smooth the estimated BW.

Smoothing BW signal can be regarded as the elimination of high-frequency components and retention of low-frequency ones, and WT-based filtering is suitable for this kind of task. The estimated BW can be decomposed into multiple scales in the context of WT: considering the BW frequency ranges from 0.05 Hz to 2 Hz, the components below 2 Hz are preserved; while the ones above 2 Hz are replaced with zero. Finally, the smoothened BW signal can be obtained by reconstruction using the inverse wavelet transform.

Here we choose coif3 as the wavelet function because its regularity and symmetry properties are better compared with other wavelets. Also, the coif3 is the most widely used wavelet function for ECG process. For the ECG signal of which the sampling frequency is 360 Hz, the BW signal is decomposed by the WT into seven scales. After decomposition, the approximate frequency range for each scale is shown in Table 2, where D represents the detailed components (high-frequency components) of the signal at the scale after wavelet decomposition and A represents the approximate components (low-frequency components) at the scale. The seventh approximate component is reserved.

Table 2: Frequency ranges of the estimated BW signal decomposition with seven scales.

We denote the WT-based filter as and combine it with according to the framework shown in equation (4); hence, the expression of the combined filter (or BW estimator) can be written as follows:and the estimated ECG is given by the following cancellation:

The entire block diagram of the combined algorithm of the MMF and WT is shown in Figure 2.

Figure 2: Block diagram of the CA.

3. Numerical Simulation

In real ECG recordings, the exact ECG value and BW noise are unknown which prevents one from analyzing algorithm performance with precision. Hence, a simulated ECG signal plus BW noise is used to evaluate the effectiveness of the CA proposed in this study [15].

The generation of the simulated contaminated ECG is based on equation (1), while used here is collected clinically, and the simulated is constructed bywhere is the waveform of a single heartbeat of which the duration is and is the periodic repetition of the heartbeat waveform representing a simulated clean ECG signal where .

The specific process of obtaining the artificial ECG (i.e., S) is described as follows:(1)One heartbeat of an ECG recording, which is from the recording of number 119 in MIT-BIT arrhythmia database sampled at 360 Hz in resting conditions, is selected. The clean ECG is formed by periodic repetitions of a single beat at 1000 times. The clean ECG segment used in the experiment is subsequently obtained. An example is shown in Figure 3.(2)The second channel of the BW data from the MIT-BIH noise stress test database is selected as the BW [16]. Figure 4 shows the chosen BW signal.

Figure 3: Artificial ECG signal.
Figure 4: The chosen BW.

The performance of the proposed method was evaluated by the mean square error (MSE) and the signal-to-noise ratio (SNR), which are defined as formulas (18) and (19), respectively.where is the variance of the ECG, defined aswhere is the mean of the ECG. The calculated values of the MSE and SNR for the artificial contaminated ECG signal filtered by the algorithms are listed in Table 3.

Table 3: Values of the MSE and SNR.

The MSE value is small, indicating a smaller error between the filtered ECG and the clean ECG. The distortion produced by the filter is also small. Meanwhile, the SNR value of the filtered ECG is high, indicating that the algorithm works for the BW interference suppression.

As can be seen from Table 2, the effect of MMF is significantly better than that of WT in the BW suppression. The reason is that the frequency range of the T wave in ECG signal is partially overlapped with the frequency range of BW noise. When the high-scale approximate components of wavelet decomposition are set to zero, wavelet reconstruction could cause T wave distortion. The CA gets the smallest MSE and highest SNR, which demonstrates that the performance of BW suppression is better.

4. Statistical Analysis

To further perform evaluation of CA, a statistical analysis scheme is considered [17]. Other two baseline removal algorithms used regularly in literatures, which are Butterworth high-pass filter [18] and wavelet-based high-pass filtering [19], are introduced and compared.

The original artificial ECG signals for this experiment are generated using the ECGSYM software [20] which allows configuring ECG parameters (such as heart rate, sampling frequency, the morphology of the ECG waves, amplitude and duration parameters, etc). For the experiment, four segments of artificial ECG signals with different heart rates, which are 40 beats per minute (bpm) (bradycardia), 70 bpm (normal), 90 bpm (tachycardia), and 120 bpm (exercise), are generated, respectively, and the sampling frequency is set to 360 Hz and duration of the signal to 5 min. Afterwards, the real baseline drifts from the MIT-BIH Noise Stress Test Database [21] are added to the artificial ECG.

Three performance indexes are chosen to evaluate the algorithms besides above MSE, which are described below.

4.1. Correlation Coefficient (CC)

It is used to quantify impairment in the morphology of the filtered signals. It is independent from scaling or offsetting the signals and focuses on the matching form of original and filtered waveforms [17]. Mathematically, the correlation coefficient between the original signal and the filtered one is given bywhere denotes the expected value operator, is the expected value of , and is its standard deviation.

4.2. L_Operator (LO)

It is a measurement of similarity that is based on the Euclidian distance between the two signals [21]. Mathematically, it is given by

In contrast to the correlation coefficient, the LO is sensitive to offsetting and scaling of any of the two signals [17].

4.3. Absolute Maximum Distance (AMD)

It is one of the most commonly similarity metrics used to determine the quality of ECG signals after performing a filtering process and can be defined by the following expression [22]:where is the number of the current sample of the signals and is the maximum number of samples of the and signals.

It allows to measure the accumulated error and gives differences in all their extension.

The average results of the comparison study are presented in Table 4.

Table 4: The average results.

The results demonstrated that even though there are small differences among the methods, they were all good performers in terms of CC, LO, AMD, and MSE. However, we see that the method that best maintained the original ECG morphology is CA (highest CC and LO and lowest AMD and MSE). The reason for this is probably due to the combination of MMF and WT whose features match precisely the time and frequency domain properties of the artifact.

The second best performance, according to the indexes, is yielded by the WT method. It is probably due to the properties of the chosen suited wavelet and the relatively high decomposition level. Although wavelet-based high-pass filtering method is very similar to the wavelet-based method, a high-pass filtering (an infinite impulse response filter of order one and a cutoff frequency of 0.5 Hz) is used on the approximation coefficients instead of setting them to zero. This is somewhat comparable to a soft threshold on the approximation coefficients. And the Vaidyanathan-Hoang wavelet, not coif3 used in WT, is used [17, 19].

According to the indexes, Butterworth (lowest CC and highest MSE) and MMF (lowest LO and highest AMD) show a similar worst performance. Even so, computationally Butterworth can be approximated as a finite impulse response filter, and MMF significantly reduces the amount of computation by opening and closing operators. They both have speedy computation and especially suit for medical applications that require fast but still accurate signal processing algorithms.

5. Conclusion

In presence of baseline wanders, there is a need to use a promising technique for baseline drifts suppression. In this paper, we have presented and validated a combined algorithm of mathematical morphology filter and wavelet transform for baseline wandered ECG signals. Compared with the current state-of-the-art methods, the filtering effect of the presented algorithm is better, and it can effectively filter out the BW in the ECG signal meanwhile keeping the distortion of the ECG signal minimized (the smallest MSE and highest SNR). This gives the opportunity to study very low amplitude complexes, and therefore, it is suited for the data preprocessing for precise ECG characteristic extraction.

Data Availability

The ECG data used to support the findings of this study have been deposited in the MIT-BIH arrhythmia database (

Conflicts of Interest

The authors declare that they have no conflicts of interest.

Authors’ Contributions

Xiang-kui Wan and Fei Qiao contributed to the conception of the study; Fei Qiao, Feng-cong Li, and Haibo Wu contributed significantly to analysis and manuscript preparation; Xiang-kui Wan, Feng-cong Li, and Fei Qiao performed the data analyses and wrote the manuscript; and Yan Li, Yue-wen Yan, and Jia-xin Wei helped perform the analysis with constructive discussions.


This work was supported by the National Nature Science Foundation of China (no. 61571182) and the Research Foundation for Talented Scholars of Hubei University of Technology (no. BSQD14033).


  1. J. Q. Li, G. Q. Deng, W. Wei et al., “Design of a real-time ECG filter for portable mobile medical systems,” IEEE Access, vol. 5, pp. 696–704, 1998. View at Google Scholar
  2. T. Y. Ji, Z. Lu, Q. H. Wu, and Z. Ji, “Baseline normalisation of ECG signals using empirical mode decomposition and mathematical morphology,” Electronics Letters, vol. 44, no. 2, pp. 82-83, 2008. View at Publisher · View at Google Scholar · View at Scopus
  3. R. F. von Borries, J. H. Pierluissi, and H. Nazeran, “Wavelet transform-based ECG baseline drift removal for body surface potential mapping,” in Proceedings of 27th Annual International Conference of the Engineering in Medicine and Biology Society, pp. 3891–3894, Shanghai, China, September 2005.
  4. Y. J. Li, H. Yan, and Z. L. Wang, “A comparative study on the methods of ECG baseline drifts removal,” Space Medicine & Medical Engineering, vol. 5, pp. 381–386, 2009. View at Google Scholar
  5. H. Ji, J. X. Sun, and L. Mao, “An adaptive filtering algorithm based on wavelet transform and morphological operation for ECG signals,” Signal Processing, vol. 22, no. 3, pp. 333–337, 2006. View at Google Scholar
  6. S. A. Taouli and F. Bereksi-Reguig, “Noise and baseline wandering suppression of ECG signals by morphological filter,” Journal of Medical Engineering & Technology, vol. 34, no. 2, pp. 87–96, 2009. View at Publisher · View at Google Scholar · View at Scopus
  7. Q. Zhao, J. Zhao, and L. Wei, “ECG signal denoising algorithm based on wavelet transform,” Progress in Modern Biomedicine, vol. 10, pp. 1566–1568, 2007. View at Google Scholar
  8. S. Omid and B. M. Shamsollahi, “Multiadaptive bionic wavelet transform: application to ECG denoising and baseline wandering reduction,” EURASIP Journal on Advances in Signal Processing, vol. 2007, pp. 1–11, 2007. View at Publisher · View at Google Scholar · View at Scopus
  9. J. Z. Song, H. L. Yan, L. Yan, and K. Y. Mu, “Research on electrocardiogram baseline wandering correction based on wavelet transform, QRS barycenter fitting, and regional method,” Australasian Physical & Engineering Sciences in Medicine, vol. 33, no. 3, pp. 279–283, 2010. View at Publisher · View at Google Scholar · View at Scopus
  10. L. .F. Brown and S. P. Arunachalam, “Real-time T-p knot algorithm for baseline wander noise removal from the electrocardiogram,” Biomedical Sciences Instrumentation, vol. 45, pp. 65–75, 2009. View at Google Scholar
  11. Y. Sun, K. L. Chan, and S. M. Krishnan, “ECG signal conditioning by morphological filtering,” Computers in Biology and Medicine, vol. 32, no. 6, pp. 465–479, 2002. View at Publisher · View at Google Scholar · View at Scopus
  12. Y. Pang, L. Deng, and J. Z. Lin, “ECG signal removal based on morphological filtering for baseline drift,” Acta Physica Sinica, vol. 9, pp. 428–433, 2014. View at Google Scholar
  13. G. Chen, M. H. Tang, and H. Chen, “ECG signal denoising algorithm based on morphology and wavelet transform,” Computer Technology and Development, vol. 2, pp. 100–102, 2012. View at Google Scholar
  14. G. B. Moody and R. G. Mark, “The MIT-BIH arrhythmia database on CD-ROM and software for use with it,” Computers in Cardiology, vol. 17, pp. 185–188, 1990. View at Google Scholar
  15. X. Wan, Y. Li, C. Xia, M. Wu, J. Liang, and N. Wang, “A T-wave alternans assessment method based on least squares curve fitting technique,” Measurement, vol. 86, pp. 93–100, 2016. View at Publisher · View at Google Scholar · View at Scopus
  16. G. B. Moody, W. Muldrow, and R. G. Mark, “A noise stress test for arrhythmia detectors,” Computers in Cardiology, vol. 11, pp. 381–384, 1984. View at Google Scholar
  17. G. Lenis, N. Pilia, A. Loewe, W. H. W. Schulze, and O. Dössel, “Comparison of baseline wander removal techniques considering the preservation of ST changes in the ischemic ECG: a simulation study,” Computational and Mathematical Methods in Medicine, vol. 2017, Article ID 9295029, 13 pages, 2017. View at Publisher · View at Google Scholar · View at Scopus
  18. M. S. Chavan, R. A. Agarwala, and M. D. Uplane, “Suppression of baseline wander and power line interference in ECG using digital IIR filter,” International Journal of Circuits, Systems And Signal Processing, vol. 2, no. 2, pp. 356–365, 2008. View at Google Scholar
  19. K. L. Park, K. J. Lee, and H. R. Yoon, “Application of a wavelet adaptive filter to minimise distortion of the ST-segment,” Medical and Biological Engineering and Computing, vol. 36, no. 5, pp. 581–586, 1998. View at Publisher · View at Google Scholar · View at Scopus
  20. A. L. Goldberger, L. Amaral, L. Glass, J. M. Hausdorff et al., “PhysioBank, PhysioToolkit, and PhysioNet: components of a new Research resource for complex physiologic signals,” Circulation, vol. 101, no. 23, pp. 215–220, 2000. View at Publisher · View at Google Scholar
  21. G. Lenis, Y. Lutz, G. Seeman et al., “Post extrasystolic T wave change in subjects with structural healthy ventricles-measurement and simulation,” in Proceedings of 41st Computing in Cardiology Conference, pp. 1069–1072, IEEE, Cambridge, Mass, USA, September 2014.
  22. R. Nygaard, G. Melnikov, and A. K. Katsaggelos, “A rate distortion optimal ECG coding algorithm,” IEEE Transactions on Biomedical Engineering, vol. 48, no. 1, pp. 28–40, 2001. View at Publisher · View at Google Scholar · View at Scopus