Next Article in Journal
Multidimensional Vibration Suppression Method with Piezoelectric Control for Wind Tunnel Models
Next Article in Special Issue
Ambulatory Assessment of the Dynamic Margin of Stability Using an Inertial Sensor Network
Previous Article in Journal
Review of Dissolved Oxygen Detection Technology: From Laboratory Analysis to Online Intelligent Detection
Previous Article in Special Issue
Enhanced Accuracy of Continuous Glucose Monitoring during Exercise through Physical Activity Tracking Integration
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Low Resource Complexity R-peak Detection Based on Triangle Template Matching and Moving Average Filter

1
Biomedical Engineering Division, University of Saskatchewan, Saskatoon, SK S7N 5A9, Canada
2
Department of Electrical and Computer Engineering, University of Saskatchewan, Saskatoon, SK S7N 5A9, Canada
*
Author to whom correspondence should be addressed.
Sensors 2019, 19(18), 3997; https://doi.org/10.3390/s19183997
Submission received: 10 August 2019 / Revised: 8 September 2019 / Accepted: 11 September 2019 / Published: 16 September 2019
(This article belongs to the Special Issue Wearable Sensors in Healthcare: Methods, Algorithms, Applications)

Abstract

:
A novel R-peak detection algorithm suitable for wearable electrocardiogram (ECG) devices is proposed with four objectives: robustness to noise, low latency processing, low resource complexity, and automatic tuning of parameters. The approach is a two-pronged algorithm comprising (1) triangle template matching to accentuate the slope information of the R-peaks and (2) a single moving average filter to define a dynamic threshold for peak detection. The proposed algorithm was validated on eight ECG public databases. The obtained results not only presented good accuracy, but also low resource complexity, all of which show great potential for detection R-peaks in ECG signals collected from wearable devices.

1. Introduction

Electrocardiogram (ECG) signal is commonly used to diagnose heart disease. There are various studies and applications in this field. For example, in the work by the authors of [1], a method based on polygonal approximation was proposed to detect fiducial point of ECG QRS complex. This method has higher accuracy than other signal compression techniques, but requires more energy consumption. In the work by the authors of [2], the authors developed a single chip based wearable wireless ECG monitoring system. However, they did not implement further post-signal processing analysis. The automatic detection of R-peaks is considered a classic ECG signal processing problem and has been extensively investigated. Recently, there were several notable studies [3,4,5,6,7,8,9,10]. In the work by the authors of [3], the combination of wavelet transform, derivatives, Hilbert transform, and adaptive thresholding was proposed. This method can provide a high detection accuracy. Although this algorithm does not need to learn from previously detected R-peaks, it is complex and only validated on the MIT-BIH arrhythmia database, QT database and noise stress database. Two R-peak detection algorithms were proposed based on envelopment and K-mean clustering technique in the work by the authors of [4]. The first algorithm exhibits high level detection accuracy and is free of parameters, but can only be used off-line. A domino error effect can occur if the training process is not sufficient. In addition, most of these algorithms are only suitable for normal heartbeats. In the work by the authors of [5], the second-order Volterra filter and averaging filter were used to estimate the ECG envelope. One single threshold was used to define the interested block containing R-peaks. Only the MIT-BIH arrhythmia database was tested in this study. In addition, the computational complexity of this algorithm is high.
Recently researchers focused on developing efficient detection algorithms suitable for wearable ECG devices. In the work by the authors of [6], one algorithm was proposed to detect R-peaks of real ECG signals measured by a proposed prototype, but only few public ECG signal databases were evaluated. In the work by the authors of [7], a simple real-time R-peak detector with low computational cost was proposed. Similar to many previous works, the authors of [7] customized input parameters of the algorithm for optimal performance on the MIT-BIH arrhythmia database [8], which may not be amenable to other databases. Moreover, it is not robust to noise.
According to the comprehensive review by the authors of [9], Elgendi’s algorithm [10] was recently evaluated as the best algorithm to detect R-peaks in portable devices due to robustness to noise, parameter choice, and numerical efficiency. The Elgendi’s algorithm is based on a Butterworth band-pass filter, squaring, and two moving average filters. The optimal frequency band of the band-pass filter is 8 Hz to 20 Hz. After filtering, the signal is squared point by point to enhance large values and boost high-frequency components. Next, two moving average filters are used to generate blocks of interest that potentially contain R-peaks. The blocks of interest are found by comparing the differences between the outputs of two moving average filters in which the longer window is used to create a threshold. To increase the detection accuracy in a low signal-to-noise ratio ECG signal, the statistical mean of the input signal is used to generate an offset in the threshold. Finally, the location of the maximum of absolute values within each block of interest is considered as the R-peak. Although Elgendi’s algorithm is computationally efficient, it needs a global ECG record to calculate the threshold. This results in a latency dependent on the input signal length.
One well-known real-time R-peak detection algorithm was proposed by Pan-Tompkins [11]. This classical algorithm can process and display the detection result for every sample after a learning period. However, the complexity of the Pan-Tompkins algorithm is high and the detection accuracy is moderate compared with Elgendi’s algorithm. For example, as described in the work by the authors of [10], the algorithm of the authors of [11] performed much worse than the algorithm of the authors of [10] on databases IAFDB and INCARTDB. In the work by the authors of [12,13], a triangle shape matching filter was developed using three samples of each side to distinguish R-peaks from T waves and P waves. The basis of this idea is the fact that the slope of R-peak is sharper than slopes of T wave and P wave. To detect R-peak, the vertex angle of the triangle shape is also used. Since the angles of the triangle are not uniform in polarity and magnitude, this method is also not robust to noise. Furthermore, in the works by the authors of [14,15], the triangle shape matching was applied to estimate the location of the QRS complex to design the low-pass filter for electromyogram (EMG) removal. In these studies, the triangle shape matching filter was not used directly for accurate R-peaks detection, but the template shows a great potential to estimate a block which contains QRS complex. In addition, the advantage of triangle shape matching is simple and can be processed sample-by-sample.
In our work, the proposed algorithm is developed by combining triangle template matching [12,13,14,15] and moving average filter [10,16] for R-peaks detection, in order to address some shortcomings as mentioned above. Although triangle template matching can provide the location of the windows containing the QRS complex on a sample-by-sample basis, the moving average filter gives information on the R amplitude, which can be used for defining the dynamic threshold to detect R-peaks with high robustness to noise. The proposed work was evaluated with four objectives: robustness to noise, low latency processing, low resource complexity, and automatic tuning of parameters on eight public databases. Compared to other R-peak detection algorithms, the obtained results demonstrate that the method herein proposed exhibits improved performances with respect to all four objectives.

2. Materials and Methods

2.1. Training Data Set

The proposed R-peak detection algorithm was trained on the MIT-BIH arrhythmia database [8]. For each record of the database, independent cardiologists annotated all peaks. In this work, all non-beat annotations defined by Physionet are ignored. With this assumption, there are 109,494 annotated beats in this database. This number is consistent with the results of other studies [17,18,19,20,21,22,23,24,25]. To be consistent with other studies of R-peaks detection, quantitative comparisons in terms of sensitivity (S), positive predictivity (P), and detection error (DER), as defined in Equations (1)–(3), are studied.
S ( % ) = TP TP + FN
P ( % ) = TP TP + FP
DER ( % ) = FN + FP TP + FN
The true positive (TP) is defined as the number of QRS complexes detected as QRS complexes. False negative (FN) is the number of QRS complexes which have not been detected, and false positive (FP) is the number of non-QRS complexes detected as QRS complexes. The sensitivity represents the percentage of true beats that are correctly detected, whereas the percentage of detected true beats is presented by the positive predictivity. For the TP and FN calculations, the beat-by-beat comparison standard of the Association for the Advancement of Medical Instrumentation (AAMI) [26] is used.

2.2. Testing Data Set

Seven public databases were used for evaluating the proposed method: the Noise Stress Test database [27], the meta-data set QT Database [28], The Long-Term ST Database [29], the T-Wave Alternans Challenge Database [30], the MIT-BIH Supraventricular Arrhythmia Database [31], the MIT-BIH Normal Sinus Rhythm Database [32], and the MIT-BIH Atrial Fibrillation Database [33]. The sampling rate varied across the different databases; hence, a resampling procedure was applied with a common sampling rate of 360 Hz.

3. The Proposed R-Peak Detection Algorithm

The diagram of the proposed algorithm is shown in Figure 1. The method consists of six steps: high-pass filter, template matching, low-pass filter, threshold calculation, threshold comparison, and R-peak search. The high-pass filter can reduce the interference of baseline wander and T-wave. Template matching is achieved by the multiplication of the slopes of two adjacent segments of a sample. This step will enhance the R-peak height and also boost the amplitude of high frequency signals. As the template matching is a nonlinear operator that often generates high frequency noise, a low-pass filter is applied to remove such noise in the third step. In the next step, an averaging filter is designed to create a dynamic threshold. In the fifth step, candidate blocks of R-peak are established. Finally, the peak locations will be sought in candidate blocks.
Figure 2 shows the signals in time domain for each step in the proposed algorithm. Details of each module are described as follows.

3.1. High-Pass Filter

The purpose of the high-pass filter is to eliminate the baseline wander caused by respiration, muscle contraction, and electrode impedance changes related to perspiration or movement. In addition, it can also reduce the T-waves in ECG signals. The analysis in the work by the authors of [11] shows that the power of P and T waves and motion artifacts concentrates in frequencies lower than 5 Hz. Therefore, a cut-off frequency higher than 5 Hz is typically selected. In this work, a simple high-pass filter based on a moving average [10,16] is designed. The filter used has the following form.
y ^ ( i ) = x ( i ) 1 2 N + 1 j = N N x ( i + j )
where N defines the observation window length. The output of this filter can be written as
y ^ ( i + 1 ) = x ( i + 1 ) 1 2 N + 1 j = N N x ( i + j + 1 )
y ^ ( i + 1 ) = y ^ ( i ) + x ( i + 1 ) x ( i ) + 1 2 N + 1 ( x ( i N ) x ( i + N + 1 ) )
The transfer function of the high-pass filter is expressed as
H ( z ) = z 1 + 1 2 N + 1 ( z N z N + 1 ) z 1
In this filter, the cut-off frequency is specified by N. For a particular database or hardware device in which the sampling rate is known, the value of N can be determined by using the Algorithm 1 for window length selection. Since a low group delay is desirable, the first value of the window length (N) that satisfies the condition at line 10 in the Algorithm 1 is selected. For example, N = 25 is selected to meet a cut-off frequency of 5 Hz for a signal with a sampling rate of 360Hz.
To detect the negative QRS complex in ECG signal, the output of the filter y ( i ) is defined as
y ( i ) = y ^ ( i )
Algorithm 1: Pseudo Code for the Window Length Selection Algorithm
Sensors 19 03997 i001

3.2. Triangle Template Matching

The goal of the triangle template matching is to rectify the differentiated ECG signals to amplify QRS complexes regardless of their polarity in the original input. Similar QRS detection techniques based on matched filters were studied in [34,35,36,37,38,39,40,41,42]. A QRS complex is created when the ventricles depolarize prior to their contraction [3]. In addition, the QRS complex has the largest amplitude and a sharp upward slope of any ECG signal. To accentuate the QRS complex, triangle template matching is defined as
t ( i ) = y ( i ) y ( i s ) y ( i ) y ( i + s )
The output of Equation (9) determines the degree of matching between the triangular shapes of the ECG signal and the template. We assume that the shape of the QRS complex is nearly symmetric. To get a suitable R-peak enhancement for subsequent processing, the length of the window for the triangle template matching should be commensurate to the QRS complex width. Typically, the width of a QRS complex ranges from 80 ms to 120 ms. Accordingly, to achieve robustness, e.g., handling abnormal heart beats with large HRV, a 40 ms duration is chosen for the template window. With a particular sampling rate, the value of s in Equation (9) can be determined. For example, with a 360 Hz sampling rate, s = 7 is typically selected. We retain the positive values of t ( i ) in Equation (9). High frequency noise (such as EMG) does not have a similar template to the QRS complex, so its response to the proposed matched filters should be smaller than that for the QRS complex. In other words, template matching also functions as a form of selective filter.

3.3. Low-Pass Filter

Ideally, the output of the triangle template matching should be locally maximized at R-peaks. Hence, the indices of the peaks of t ( i ) can be considered as potential R-peaks. However, t ( i ) also exhibits many noisy peaks. The reason is that the template matching is a nonlinear operator that may generate additional high frequency components. To reduce such noisy peaks, a subsequent low-pass filter is applied. In this work, a low-pass filter takes the form of
l ( i ) = 1 2 L + 1 j = L j = L t ( i + j )
The low-pass filter can also be written as
l ( i + 1 ) = l ( i ) + 1 2 L + 1 ( t ( i + L + 1 ) t ( i L ) )
So that the corresponding transfer function is expressed as
H l ( z ) = z L + 1 z L ( 2 L + 1 ) ( z 1 )
The purpose of this low-pass filter is to retain the authentic potential R-peaks in t ( i ) . In the work by the authors of [43], the authors observed that the band-pass filter with a center frequency of 17 Hz is optimal for detecting QRS complexes. Thus, we assumed the frequency of the possible R-peaks in t ( i ) is between 5 and 35 Hz. In our case, with a sampling rate of 360 Hz and a cut-off frequency of 35 Hz, L = 5 is typically selected.

3.4. Threshold Calculation

The idea of threshold calculation is inspired by the Elgendi’s algorithm [10]. In this work, the signal l ( i ) in Equation (10) plays a similar role to emphasize locations of QRS complexes. The candidate blocks containing R-peaks are generated by comparing the l ( i ) with a dynamic threshold t h ( i ) :
t h ( i ) = β M A ( i ) + θ
where β and θ are defined coefficients, M A ( i ) is an averaging filter constructed as
M A ( i ) = 1 2 M + 1 j = M j = M l ( i + j )
The t h ( i ) threshold in Equation (13) is similar to the first dynamic threshold value T H R 1 in Elgendi’s algorithm. It is used to find the QRS in one heartbeat. Therefore, the window length ( 2 M + 1 ) of the averaging filter in Equation (14) should approximate the duration of a heartbeat, which is of 360 samples (for a sampling frequency of 360 Hz). However, in practice, the heartbeat duration varies. The result of a brute force exhaustive optimizer to find the optimum, M, using the training data set is presented in Figure 3. It can be seen from Figure 3 that when M equals to 150, the lowest error rate was achieved.
To enable a rapid R-peak search in candidate blocks, the interested block width should be small. Therefore, the coefficient β is inserted into Equation (13). When β is small, the width of the interested block is big. However the scale of β does not have significant effects on the final performance. The experimental results show that its value can vary between 2 to 4 in many databases. In our work, we fix β = 2.5 . The coefficient θ is also added in Equation (13) to reduce the number of false positive detection.
There is a trade-off in the choice of θ in which larger values are more suitable for R-peak detection in noisy ECG signals. Meanwhile, a reasonable value must be maintained to detect a R-peak with small amplitude. Experiments show that θ could be one-fourth of the statistical mean of the output of the low-pass filter. The drawback of this calculation is that this method does not guarantee low latency. To address this issue, we proposed an iterative Equation (15) to get a dynamic threshold in low latency. In our work, the statistical mean of l ( i ) for the “training database” is used for parameters initialization. For this database, this value is ~824, thus θ = 206 . Finally, the threshold t h ( i ) is calculated as
t h ( i + 1 ) = t h ( i ) + 1 2 M + 1 ( l ( i + M + 1 ) l ( i M ) ) + 206

3.5. R-Peak Search

The actual R-peaks will be at the blocks of interest, where l ( i ) is higher than the threshold t h ( i ) . The index of the maximum point of the search window is considered as the index of an R-peak. The experiment shows that the possible maximum width of the search window is half of the normal QRS complex width. As the value of y ( i ) can also be large at Q or S peaks, there are multiple detected points within one QRS complex as illustrated in Figure 4. With the reasonable assumption that the maximum heart rate is ~206 bpm [44], the distance between two continuous R-peaks cannot be smaller than 272 ms, so an error correction step is applied whenever two detected R-peaks are too close to each other. The detected R-peak of larger amplitude is retained, while the other one is eliminated. The pseudocode of the proposed R-peak search method is shown in Algorithm 2.
Algorithm 2: Pseudo Code for the R-peak detection Function.
Sensors 19 03997 i002

3.6. Computational Cost

The proposed algorithm was implemented in a desktop. The processing time of the algorithm is small compared with the input length duration. The comparison details will be presented in the processing time section. For readers potentially seeking to implement the algorithm on hardware devices, such as with FPGA technology, the computational resource costs are shown in Table 1. For comparison, the estimated computational resource costs of Elgendi’s algorithm and a recent novel template matching technique [41] are presented in Table 2 and Table 3.
Generally, the proposed algorithm exhibits lower computational resource cost than the recent matching technique and moving averaging filtering methods when counting the number of registers, adders, multipliers, or comparators used. This is because the triangle template matching and proposed iterative dynamic thresholding methods are applied. The QRS complexes are well rectified after using the triangle template matching, and the iterative dynamic threshold calculation is independent of the the window length. In contrast, Elgendi’s algorithm implemented averaging filtering twice and the calculation cost depends on the window length. Normally, the more operations of averaging filtering are taken, the higher computation resource cost will be.

3.7. Latency Cost

To initialize the proposed algorithm, input data is first buffered with 0.833 s (300 samples) to calculate the threshold in Equation (13). Then, the processed data is calculated sample-by-sample. In addition, the complexity of the algorithm is very small. Therefore, the total latency cost of the proposed method can be estimated as 0.833 s.

4. Results and Discussion

4.1. Selected Algorithms for Evaluating the Proposed Work

In this work, the performance of the proposed algorithm on many published databases is evaluated and compared against other two state-of-art methods: the Pan-Tompkins [11] and the Elgendi’s algorithm [10]. The Pan-Tompkins method represents the most well-known classical real-time R-peak detector, whereas the second algorithm was recently evaluated as the best algorithm to detect R-peaks in portable devices.
It is noted that not all authors of previous studies presented complete details on how comparisons of annotated beats with their detected beats were performed. In this work, the standard of AAMI [26] is applied. The use of this standard is consistent with the work by the authors of [25].

4.2. Evaluating on the MIT-BIH Arrhythmia Database

Table 4 presents the performance of the proposed algorithm with its default parameters against all records. The average DER value is 0.49%. The proposed algorithm performs well on most records and their maximum DER is below 1.6%, except on three records, 207, 203, and 210. The error of the record 207 occurs due to the significant false positive errors during the flutter episodes. Physionet has considered record 207 as an extremely difficult record. According to the latest version of the annotations published in June 2010 by Physionet, there are 1860 beat annotations. In our work, only five beats were not detected. There are 472 ventricular flutter peaks in this record and the ventricular flutter peaks are considered as non-beat annotations. The proposed algorithm detects a number of ventricular flutter peaks in this record. That is why there are significant false positive errors. However, some previous works, such as the work by the authors of [10], excluded episodes of ventricular flutter beats in their ground truth.
In record 210, the average heartbeat is about 240 samples. The corresponding optimal value of parameter M in Equation (14) should be 120. Since the default M value of 150 was used, the obtained performance was suboptimal. In record 203, sudden amplitude changes of some beat pulses led to misdetection in our work.

4.3. Evaluating with Other Public Data

For further evaluation, performance comparisons between the proposed method and the other two selected well-known methods for different databases were evaluated on seven public databases. The results are shown in Table 5. It can be seen from Table 5 that the proposed algorithm performs better in terms of DER. This indicates that the proposed algorithm also can work well with different typical clinical ECG signals.

4.4. Evaluating the Robustness to Noise of R-peak Detection Algorithms

In the MIT-BIH arrhythmia database, there are many records, such as 121, 202, 200, 217, 105, and 108, that are strongly affected by noise including baseline wander and muscle noise. These records were used to evaluate the robustness to noise in some previous works [5,25]. Table 6 shows comparisons of the DER values of the proposed method with the other nine studies. The biggest DER value in each column is in bold. It can be seen from Table 6 that the DER value of the proposed algorithm is comparable with previous works in the same records, which are contaminated heavily by noise.

4.5. Comparing Performance Between the Proposed and Elgendi’s Algorithms in Some Specific Signals

4.5.1. Record 109 of the MIT-BIH Arrhythmia Database

Elgendi’s algorithm took a band-pass filter to concentrate QRS complexes with the cut-off band of 8–20 Hz. With this filter, the baseline wander and high frequencies are almost removed. However, previous studies showed that the power of QRS complex is concentrated in the band of 5 Hz–35 Hz. Thus, a small cut-off band can lead to the distortion of the sharpness of the R-peak. Consequently, some locations of R-peaks detected by Elgendi’s algorithm are not correct. It should be noted that this type of error is not reflected directly in those quantitative metrics due to the false detection is very close to the ground truth. Figure 5a shows the detected R-peaks of the proposed work and Elgendi’s algorithm for the signal of record 109 from sample number 200 to 2000.

4.5.2. Record 113 of the MIT-BIH Arrhythmia Database

Record 113 does not have much noise, but P-peaks in this record have high amplitudes. These P-peaks result in outputs of the first moving average filter in Elgendi’s algorithm that may be bigger than the first threshold. Moreover, widths of these P-peaks are also larger, which means the second threshold of Elgendi’s algorithm does not help eliminate the false “block of interest”. The error rate of Elgendi’s method on record 113 is 5.52%, and most peaks are false positive detected. As the slope of the P-peaks is always smaller than the slope of the R-peak, the triangle template matching of our proposed method can amplify the difference between R-peak and P-peak. In addition, the “error correction” step also provides an advantage in canceling “wrong detected R-peaks”. Figure 5b shows the detected R-peaks by the two methods for the samples 2000 to 4000 from record 113.

4.6. Processing Time

In Table 2, the total computational resource cost of the proposed algorithm was presented. In this section, we compared the processing time of each method. The chosen methods were implemented in MATLAB version 2015b on a desktop of Intel T M i 5 - 4570 CPU 3.2 GHz, 8 GB RAM. Table 7 shows the comparison results on average computational time over 10 trials in processing the MIT-BIH arrhythmia database.
As data shown in Table 7, the proposed method runs faster than the two state-of-art algorithms even with a better accuracy for a huge potential in real-time applications.

4.7. Parameters Setting

There are only six parameters in our work and their value can be tweaked according to different databases. The window size of the high-pass filter, parameter ( N ) in Equation (4); triangle template matching, parameter s in Equation (9); and low-pass filter parameter ( L ) in Equation (10) can be determined automatically when a sampling rate is known. The size of the moving average filter parameter ( M ) in Equation (15) used to define the threshold depends on the heart rate, and it is hard to be predicted. Our approach is to estimate it by using a normal heart rate. The coefficient β in Equation (13) is fixed to 2.5. In fact, the value of this parameter does not strongly affect final performance. The coefficient θ in Equation (13) depends on the amplitude of the R-peak, and it is also difficult to predict its value in an efficient way. The proposed method takes one-fourth of the statistic mean of the outputs from low-pass filter. In addition, we took the default value trained from the MIT-BIH database and tested on other seven databases, results showed that the default value is applicable for many databases with good performance.

5. Conclusions

The proposed method is based on a triangle template matching and moving average filter and aimed to tackle common challenges in the detection of R-peaks in ECG signals. The results show that the proposed algorithm performs better compared to previous works in trading off four objectives: robustness to noise, low latency processing, low resource complexity, and automatic tuning of parameters.
The previously published algorithms are mostly computationally complicated and require impractical assumptions, e.g., they typically need global statistical knowledge of the entire input signal. In contrast, the proposed algorithm not only exhibits low complexity, but also, even with default parameters, it is already highly competitive against the classical Pan-Tompkins’ and the well-praised Elgendi’s algorithm for many publicly available ECG databases. In addition, for additional performance gains, including optimization in a new or customized application scenario, the parameter tuning process is also straightforward, at the expense of a modest increase in latency complexity. Altogether, these desirable characteristics reinforce the practical feasibility of the proposed method for wearable mobile applications.
One disadvantage of the proposed work is that the value of M in Equation (15) is fixed. This value should be updated with the real heart rate to have the best performance. One possible alternative solution is to have a learning phase to estimate the real heart rate. However, noisy ECG signals often result in a poor estimation of the real heart rate during the learning phase. Given this challenge, the learning phase should be long enough to overcome it, but at the expense of an increase in latency.

Author Contributions

T.N. designed the whole algorithm, implemented it on MATLAB, and also wrote the initial manuscript; X.Q. debugged the implementation, analyzed the outcome, and revised the manuscript; A.D. presented the initial idea and corrected the paper; F.B. supervised this project and has his role as the corresponding author.

Funding

This research was funded by Grand Challenges Canada—Stars in Global Health, grant number [0496-01] and Natural Sciences and Engineering Research Council of Canada, grant number [RGPIN 418666].

Acknowledgments

The authors thank Grand Challenges Canada/Grands Défis Canada (Stars in Global Health) and the Natural Sciences and Engineering Research Council of Canada (NSERC) in supporting this research.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Lee, S.; Jeong, Y.; Park, D.; Yun, B.-J.; Park, K.H. Efficient Fiducial Point Detection of ECG QRS Complex Based on Polygonal Approximation. Sensors 2018, 18, 4502. [Google Scholar] [CrossRef] [PubMed]
  2. Sodhro, A.H.; Sangaiah, A.K.; Sodhro, G.H.; Lohano, S.; Pirbhulal, S. An Energy-Efficient Algorithm for Wearable Electrocardiogram Signal Processing in Ubiquitous Healthcare Applications. Sensors 2018, 18, 923. [Google Scholar] [CrossRef] [PubMed]
  3. Sabherwal, P.; Agrawal, M.; Singh, L. Automatic Detection of the R Peaks in Single-Lead ECG Signal. Circuits Syst. Signal Process. 2017, 36, 4637–4652. [Google Scholar] [CrossRef]
  4. Merino, M.; Gómez, I.M.; Molina, A.J. Envelopment filter and K-means for the detection of QRS wave forms in electrocardiogram. Med. Eng. Phys. 2015, 37, 605–609. [Google Scholar] [CrossRef]
  5. Phukpattaranont, P. QRS detection algorithm based on the quadratic filter. Expert Syst. Appl. 2015, 42, 4867–4877. [Google Scholar] [CrossRef]
  6. Lee, W.K.; Yoon, H.; Park, K.S. Smart ECG Monitoring Patch with Built-in R-Peak Detection for Long-Term HRV Analysis. Ann. Biomed. Eng. 2016, 44, 2292–2301. [Google Scholar] [CrossRef]
  7. Castells-Rufas, D.; Carrabina, J. Simple real-time QRS detector with the MaMeMi filter. Biomed. Signal Process. Control 2015, 21, 137–145. [Google Scholar] [CrossRef] [Green Version]
  8. Moody, G.; Mark, R. The impact of the MIT-BIH Arrhythmia Database. IEEE Eng. Med. Biol. Mag. 2001, 20, 45–50. [Google Scholar] [CrossRef]
  9. Elgendi, M.; Eskofier, B.; Dokos, S.; Abbott, D. Revisiting QRS Detection Methodologies for Portable, Wearable, Battery-Operated, and Wireless ECG Systems. PLoS ONE 2014, 9, e84018. [Google Scholar] [CrossRef]
  10. Elgendi, M. Fast QRS detection with an optimized knowledge-based method: Evaluation on 11 standard ECG databases. PLoS ONE 2013, 8, e73557. [Google Scholar] [CrossRef]
  11. Pan, J.; Tompkins, W. A real-time QRS detection algorithm. IEEE Trans. Biomed. Eng. 1985, BME-32, 230–236. [Google Scholar] [CrossRef]
  12. Hu, X.; Wang, J.Q.; Zhang, N. Detecting onset and offset of QRS complex based on measurement of a triangle. J. Appl. Sci. 2011, 29, 289–293. [Google Scholar]
  13. Hu, X.; Liu, J.; Wang, J.; Xiao, Z. Detection of onset and offset of QRS complex based a modified triangle morphology. Lect. Notes Electr. Eng. 2013, 269, 2893–2901. [Google Scholar]
  14. Bortolan, G.; Christov, I.; Simova, I.; Dotsinsky, I. Noise processing in exercise ECG stress test for the analysis and the clinical characterization of QRS and T wave alternans. Biomed. Signal Process. Control 2015, 18, 378–385. [Google Scholar] [CrossRef]
  15. Christov, I.I.; Daskalov, I.K. Filtering of electromyogram artifacts from the electrocardiogram. J. Med. Eng. Phys. 1999, 21, 731–736. [Google Scholar] [CrossRef]
  16. Hu, X.; Xiao, Z.; Zhang, N. Removal of baseline wander from ECG signal based on a statistical weighted moving average filter. J. Zhejiang Univ. Sci. C 2011, 12, 397–403. [Google Scholar] [CrossRef]
  17. Jun, T.J.; Park, H.J.; Yoo, H.; Kim, Y.H.; Kim, D. GPU based cloud system for high-performance arrhythmia detection with parallel k-NN algorithm. In Proceedings of the 2016 38th Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC), Orlando, FL, USA, 16–20 August 2016; pp. 5327–5330. [Google Scholar]
  18. Smital, L.; Haider, C.; Leinveber, P.; Jurak, P.; Gilbert, B.; Holmes, D. Towards real-time QRS feature extraction for wearable monitors. In Proceedings of the 2016 38th Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC), Orlando, FL, USA, 16–20 August 2016; pp. 3519–3522. [Google Scholar]
  19. Sadhukhan, D.; Pal, S.; Mitra, M. ECG delineation using multiresolution DWT and relative magnitude and slope comparison. In Proceedings of the 2016 2nd International Conference on Control, Instrumentation, Energy & Communication (CIEC), Kolkata, India, 28–30 January 2016; pp. 173–177. [Google Scholar]
  20. Sharma, T.; Sharma, K.K. QRS Complex Detection in ECG Signals Using the Synchrosqueezed Wavelet Transform. IETE J. Res. 2016, 62, 885–892. [Google Scholar] [CrossRef]
  21. Yochum, M.; Renaud, C.; Jacquir, S. Automatic detection of P, QRS and T patterns in 12 leads ECG signal based on CWT. Biomed. Signal Process. Control 2016, 25, 46–52. [Google Scholar] [CrossRef]
  22. Ho, T.W.; Huang, C.W.; Lin, C.M.; Lai, F.; Ding, J.J.; Ho, Y.L.; Hung, C.S. A Telesurveillance System with Automatic Electrocardiogram Interpretation Based on Support Vector Machine and Rule-Based Processing. JMIR Med. Inf. 2015, 3, 1–16. [Google Scholar] [CrossRef]
  23. Yazdani, S.; Vesin, J.M. Adaptive Mathematical Morphology for QRS fiducial points detection in the ECG. In Proceedings of the Computing in Cardiology, Cambridge, MA, USA, 7–10 September 2014; pp. 725–728. [Google Scholar]
  24. Zidelmal, Z.; Amirou, A.; Adnane, M.; Belouchrani, A. QRS detection based on wavelet coefficients. Comput. Meth. Program. Biomed. 2012, 107, 490–496. [Google Scholar] [CrossRef]
  25. Bouaziz, F.; Boutana, D.; Benidir, M. Multiresolution wavelet-based QRS complex detection algorithm suited to several abnormal morphologies. IET Signal Process. 2014, 8, 774–782. [Google Scholar] [CrossRef]
  26. Testing and Reporting Performance Results of Cardiac Rhythm and ST Segment Measurement Algorithms. ANSI/AAMI/ISO EC57:1998/(R). 2008. Available online: https://my.aami.org/aamiresources/previewfiles/EC57_1212_preview.pdf (accessed on 18 December 2012).
  27. Moody, G.B.; Muldrow, W.; Mark, R. A noise stress test for arrhythmia detectors. Proc. IEEE Comput. Cardiol. 1984, 11, 381–384. [Google Scholar]
  28. Laguna, P.; Mark, R.G.; Goldberger, A.L.; Moody, G.B. A Database for Evaluation of Algorithms for Measurement of QT and Other Waveform Intervals in the ECG. Comput. Cardiol. 1997, 24, 673. [Google Scholar]
  29. Jager, F.; Taddei, A.; Moody, G.B.; Emdin, M.; Antolič, G.; Dorn, R.; Smrdel, A.; Marchesi, C.; Mark, R.G. Long-term ST database: A reference for the development and evaluation of automated ischaemia detectors and for the study of the dynamics of myocardial ischaemia. Med. Biol. Eng. Comput. 2003, 41, 172–183. [Google Scholar] [CrossRef]
  30. Moody, G.B. The PhysioNet/Computers in Cardiology Challenge 2008: T-Wave Alternans. Comput. Cardiol. 2008, 35, 505–508. [Google Scholar]
  31. Greenwald, S.D. Improved Detection and Classification of Arrhythmias in Noise-Corrupted Electrocardiograms Using Contextual Information. Ph.D. Thesis, Harvard-MIT Division of Health Sciences and Technology, Chicago, IL, USA, 1990. [Google Scholar]
  32. Goldberger, A.L.; Amaral, L.A.; Glass, L.; Hausdorff, J.M.; Ivanov, P.C.; Mark, R.G.; Mietus, J.E.; Moody, G.B.; Peng, C.-K.; Stanley, H.E. PhysioBank, PhysioToolkit, and PhysioNet: Components of a New Research Resource for Complex Physiologic Signals. Circulation 2000, 101, E215–E220. [Google Scholar] [CrossRef]
  33. Moody, G.B.; Mark, R.G. A new method for detecting atrial fibrillation using R-R intervals. Comput. Cardiol. 1983, 10, 227–230. [Google Scholar]
  34. Dobbs, S.E.; Schmitt, N.M.; Ozemek, H.S. QRS detection by template matching using real-time correlation on a microcomputer. J. Clin. Eng. 1974, 9, 197–212. [Google Scholar] [CrossRef]
  35. Kaplan, D. Simultaneous QRS detection and feature extraction using simple matched filter basis functions. In Proceeding of the IEEE Computers in Cardiology, Chicago, IL, USA, 23–26 September 1990; pp. 503–506. [Google Scholar]
  36. Hamilton, P.S.; Tompkins, W.J. Adaptive matched filtering for QRS detection. In Proceeding of the Annual International Conference IEEE Engineering in Medicine and Biology Society, New Orleans, LA, USA, 4–7 November 1988; pp. 14–18. [Google Scholar]
  37. Ruha, A.; Sallinen, S.; Nissila, S. A real-time microprocessor QRS detector system with a 1-ms timing accuracy for the measurement of ambulatory HRV. IEEE Trans. Biomed. Eng. 1997, 44, 159–167. [Google Scholar] [CrossRef]
  38. Eskofier, B.; Kornhuber, J.; Hornegger, J. Embedded QRS detection for noisy ECG sensor data using a matched filter and directed graph search. In Proceeding of the 4th Russian-Bavarian Conference on Biomedical Engineering, Zelenograd, Moscow, Russia, 8–9 July 2008; pp. 48–52. [Google Scholar]
  39. Arbateni, K.; Bennia, A. Sigmoidal radial basis function ANN for QRS complex detection. Neurocomputing 2014, 145, 438–450. [Google Scholar] [CrossRef]
  40. Karimipour, A.; Homaeinezhad, M.R. Real-time electrocardiogram P-QRST detection-delineation algorithm based on quality-supported analysis of characteristic templates. Comput. Biol. Med. 2014, 52, 153–165. [Google Scholar] [CrossRef]
  41. Hu, X.; Liu, J.; Wang, J.; Xiao, Z.; Yao, J. Automatic detection of onset and offset of QRS complexes independent of isoelectric segments. Measurement 2014, 51, 53–62. [Google Scholar] [CrossRef]
  42. Śmigiel, S.; Marciniak, T. Detection of QRS Complex with the Use of Matched Filtering. Innov. Biomed. Eng. 2017, 526, 310–322. [Google Scholar]
  43. Thakor, N.V.; Webster, J.G.; Tompkins, W.J. Estimation of QRS complex power spectra for design of a QRS filter. IEEE Trans. Biomed. Eng. 1984, BME-31, 702–706. [Google Scholar] [CrossRef]
  44. Robergs, R.; Landwehr, R. The Surprising History of the “HRmax=220-age” Equation. J. Exercise Physiol. 2002, 5, 1–10. [Google Scholar]
  45. Zhu, H.; Dong, J. An R-peak detection method based on peaks of Shannon energy envelope. Biomed. Signal Process. Control 2013, 8, 466–474. [Google Scholar] [CrossRef]
  46. Choi, S.; Adnane, M.; Lee, G.J.; Jang, H.; Jiang, Z.; Park, H.K. Development of ECG beat segmentation method by combining lowpass filter and irregular RR interval checkup strategy. Expert Syst. Appl. 2010, 37, 5208–5218. [Google Scholar] [CrossRef]
  47. Zhang, F.; Lian, Y. QRS detection based on multi-scale mathematical morphology for wearable ECG device in body area networks. IEEE Trans. Biomed. Circuits Syst. 2009, 3, 220–228. [Google Scholar] [CrossRef]
  48. Yazdani, S.; Vesin, J.M. Extraction of QRS fiducial points from the ECG using adaptive mathematical morphology. Digital Signal Proc. 2016, 56, 100–109. [Google Scholar] [CrossRef] [Green Version]
  49. Chen, C.-L.; Chuang, C.-T. A QRS Detection and R Point Recognition Method for Wearable Single-Lead ECG Devices. Sensors 2017, 17, 1969. [Google Scholar] [CrossRef]
Figure 1. The proposed algorithm structure, consisting of six steps.
Figure 1. The proposed algorithm structure, consisting of six steps.
Sensors 19 03997 g001
Figure 2. Signals at different steps in the algorithm.
Figure 2. Signals at different steps in the algorithm.
Sensors 19 03997 g002
Figure 3. Influence of window length of the dynamic threshold on the overall error rate based on brute force optimization with fixed β = 2.5 and θ = 206 .
Figure 3. Influence of window length of the dynamic threshold on the overall error rate based on brute force optimization with fixed β = 2.5 and θ = 206 .
Sensors 19 03997 g003
Figure 4. Multiple detected points in one QRS complex.
Figure 4. Multiple detected points in one QRS complex.
Sensors 19 03997 g004
Figure 5. Results of the proposed algorithm and Elgendi’s algorithm on record 109 and 113.
Figure 5. Results of the proposed algorithm and Elgendi’s algorithm on record 109 and 113.
Sensors 19 03997 g005
Table 1. Computational resource cost of each step in the proposed algorithm.
Table 1. Computational resource cost of each step in the proposed algorithm.
StepEq.No.RegisterAdderMultiplierComparator
High pass filter6141
Triangle Match Filter9121
Low pass filter11121
Threshold Calculation13131
Threshold Cmp, R-peak search 1
Total 41141
Table 2. Computational resource cost of each step in Elgendi’s algorithm.
Table 2. Computational resource cost of each step in Elgendi’s algorithm.
StepEq.No.RegisterAdderMultiplierComparator
Band pass filter 178
Squaring1 1
Averaging filter2&3262
Interested block4 2 1
Threshold 3 2
R-peak detection 1
Total 615114
Table 3. Computational resource cost of each step in Hu’s algorithm [41].
Table 3. Computational resource cost of each step in Hu’s algorithm [41].
StepEq.No.RegisterAdderMultiplierComparator
Local normalization11 12
Straight line fitting2 6232
Angle calculation423
R-peak detection 12 2
Total 467334
Table 4. Performance Evaluation of the proposed algorithm for the MIT-BIH Arrhythmia Database.
Table 4. Performance Evaluation of the proposed algorithm for the MIT-BIH Arrhythmia Database.
RecordTotalTPFNFPS(%)P(%)DER(%)
1002273227300100.00100.000.00
101186518641499.9599.790.27
102218721861099.95100.000.05
1032084208400100.00100.000.00
1042229222721399.9199.420.67
1052572256392299.6599.151.21
1062027202703100.0099.850.15
107213721361099.95100.000.05
10817631750131499.2699.211.53
109253225302199.9299.960.12
111212421231199.9599.950.09
1122539253901100.0099.960.04
1131795179500100.00100.000.00
114187918754599.7999.730.48
1151953195300100.00100.000.00
1162412239616299.3499.920.75
1171535153500100.00100.000.00
1182278227801100.0099.730.48
1191987198701100.0099.950.05
121186318612199.8999.950.16
122247624751199.9699.960.08
1231518151800100.00100.000.00
1241619161902100.0099.980.12
200260126001699.9699.770.27
201196319549099.54100.000.46
202213621342099.91100.000.09
20329802924562898.1298.122.82
205265626506099.77100.000.23
20718621857517299.7391.519.52
2082955294411299.6399.630.44
2093005300500100.00100.000.00
2102651258170197.3699.962.68
2122748274800100.00100.000.00
2133251325100100.00100.000.00
214226322612199.9199.960.13
215336533632099.94100.000.06
2172208220800100.00100.000.00
2192158215401100.0099.950.05
2202048204800100.00100.000.00
2212427242701100.0099.960.04
222248324803299.8899.920.20
2232605260501100.0099.960.04
2282056205421999.9099.081.02
2302256225600100.00100.000.00
2311571157100100.0098.991.02
2321780178005100.0099.720.28
2333079307900100.00100.000.00
2342753275300100.00100.000.00
Total10949410927022431499.8099.710.49
Table 5. Performance comparison between the proposed method and other state-of-art methods.(*) The results from our implementation and beat-by-beat comparison using AAMI standard [26].
Table 5. Performance comparison between the proposed method and other state-of-art methods.(*) The results from our implementation and beat-by-beat comparison using AAMI standard [26].
DatabaseMethodYearTotal BeatsS(%)P(%)DER(%)
MITDBThis work 10949499.8099.710.49
Elgendi’s algorithm (*)201310949499.8999.480.63
Elgendi’s algorithm [10] 10998599.7899.87N/A
Pan-Tompkins’s algorithm [11]198610949499.2099.081.72
NSTDB [27]This work 2559097.1295.037.95
Elgendi’s algorithm (*)20132559098.8089.5412.73
Elgendi’s algorithm [10] 2637095.3990.25N/A
Pan-Tompkins’s algorithm [11]19862559099.0687.9514.51
QTDB [28]This work 8535399.9499.780.29
Elgendi’s algorithm (*)20138535399.7699.420.82
Elgendi’s algorithm [10] 11120199.9999.67N/A
Pan-Tompkins’s algorithm [11]19868535399.6098.352.07
LSTDB [29]This work 7618199.9299.700.98
Elgendi’s algorithm (*)20137618199.4299.701.27
Pan-Tompkins’s algorithm [11]19867618191.7898.953.3
TWADB [30]This work 1900399.0199.141.10
Xiao Hu’s algorithm [41]2014796811001000
Elgendi’s algorithm (*)20131900397.2199.541.31
Elgendi’s algorithm [10] 1900398.8899.12N/A
Pan-Tompkins’s algorithm [11]19861900388.3294.0418.23
SVDB [31]This work 18249999.9099.80.6
Elgendi’s algorithm (*)201318249999.8599.700.8
Elgendi’s algorithm [10] 18474499.9699.80N/A
Pan-Tompkins’s algorithm [11]198618249999.8699.560.57
NSRDB [32]This work 183092100.0099.960.5
Elgendi’s algorithm (*)201318309299.8299.600.7
Elgendi’s algorithm [10] 18309299.9999.96N/A
Pan-Tompkins’s algorithm [11]198618309299.9199.970.60
LAFDB [33]This work 670599.5996.118.5
Elgendi’s algorithm (*)2013670599.4993.119.6
Elgendi’s algorithm [10] 761899.5994.11N/A
Pan-Tompkins’s algorithm [11]1986670564.2199.0114.56
Table 6. Comparisons of the DER from the proposed method with other studies for ECG records 121, 200, 202, 217, 105, and 108.
Table 6. Comparisons of the DER from the proposed method with other studies for ECG records 121, 200, 202, 217, 105, and 108.
MethodsYearRecord
121202200217105108
This work 0.160.090.350.091.211.53
Quadratic filtering [5]20150.000.000.190.271.594.08
Wavelet transform [25]20140.100.090.300.230.818.4
Elgendi’s algorithm [10]20130.110.190.230.181.871.59
Linear filtering [45]20130.110.090.150.091.250.57
S-transform [46]20100.160.090.230.231.242.44
Artificial neural network [39]20140.160.330.310.640.230.51
Mathematical morphology [47]20090.700.370.500.231.010.68
Adaptive Mathematical morphology [48]20160.110.090.190.451.441.13
Four QRS waveform templates [49]20170.110.190.730.141.612.4
Table 7. Comparison of processing time for NSRDB of Elgendi’s Algorithm and the proposed work running on MATLAB.
Table 7. Comparison of processing time for NSRDB of Elgendi’s Algorithm and the proposed work running on MATLAB.
MethodsError Rate (%)Processing Time(Second)
Pan-Tompkin’s algorithm1.72101.54
Elgendi’s algorithm0.6940.99
Proposed algorithm0.497.62

Share and Cite

MDPI and ACS Style

Nguyen, T.; Qin, X.; Dinh, A.; Bui, F. Low Resource Complexity R-peak Detection Based on Triangle Template Matching and Moving Average Filter. Sensors 2019, 19, 3997. https://doi.org/10.3390/s19183997

AMA Style

Nguyen T, Qin X, Dinh A, Bui F. Low Resource Complexity R-peak Detection Based on Triangle Template Matching and Moving Average Filter. Sensors. 2019; 19(18):3997. https://doi.org/10.3390/s19183997

Chicago/Turabian Style

Nguyen, Tam, Xiaoli Qin, Anh Dinh, and Francis Bui. 2019. "Low Resource Complexity R-peak Detection Based on Triangle Template Matching and Moving Average Filter" Sensors 19, no. 18: 3997. https://doi.org/10.3390/s19183997

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop