Figure 1.
Challenges in detecting QRS in ECG signals.
(a) Mains electricity noise: the spectrum illustrates peaks at the fundamental frequency of 60 Hz as well as the second and third harmonics at 120 Hz and 180 Hz, caused by stray magnetic fields causing the enclosure and accessories to vibrate. (b) High frequency noise caused by coughing. (c) Large movement of the chest. (d) Isolated QRS-like artifacts. (e) Nodal (junctional) escape beats affected by baseline wandering. (f) Premature ventricular contractions. (g) Left bundle branch block. (h) Right bundle branch block. (i) Paced beat. (j) Fusion of paced and normal beat.
Figure 2.
Flowchart of the knowledge-based QRS detection algorithm.
The algorithm consists of three stages: pre-processing (bandpass filter and squaring), feature extraction (generating blocks of interest based on prior knowledge), and thresholding (based on prior knowledge).
Table 1.
ECG features and their normal values in sinus rhythm.
Figure 3.
Demonstrating the effectiveness of using two moving averages to detect the QRS complex.
(a) One beat ECG signal, (b) filtered one-beat ECG signal with Butterworth band-pass filter, (c) squaring the filtered signal, and (d) generating a block of interest after using two event-related moving averages: The dotted red line is the , and the solid green line is the
. The R peak within the block of interest is then detected after the event-related threshold is applied.
Figure 4.
Demonstrating the statistical threshold.
The squared one-beat ECG signal (), which is shown in Figure 3 (c), where the dashed line represents the offset caused by
.
Figure 5.
Pseudocode for the knowledge-based QRS detector function.
The function has five inputs: ,
,
,
, and
. The band-pass filter will be determined by the frequency band
–
Hz, while
and
are the window sizes of the two moving averages
and
, respectively. However,
is used to calculate the statistical threshold
.
Figure 6.
Pseudocode for the brute-force optimizer.
The optimizer is initialized with = 10 Hz,
= 25 Hz,
= 40 samples,
= 250 samples, and
= 0.1. Systematically, this exhaustive search enumerates all possible combinations for the solution and checks whether each combination provides an optimal detector based on SE and +P.
Table 2.
A rigorous optimization of all parameters of the algorithm: frequency band, W1, W2, and the offset fraction β.
Table 3.
QRS Detection performance comparison on 11 databases (Lead I).
Table 4.
Comparison between the proposed QRS detector and the Pan and Tompkins algorithm.
Figure 7.
Influence of frequency bands on the overall accuracy based on brute-force optimization.
(a) Frequency band starts at value within 1–10 Hz. (b) Frequency band stops at value within 11–25 Hz, where the circle is the statistical mean, and the bar is the standard deviation.
Figure 8.
Influence of window sizes and offset on the overall accuracy based on brute-force optimization.
(a) The window size of the varies from 20 to 40 samples, for SF = 360 Hz. (b) The window size of the
varies from 200 to 250 samples for SF = 360 Hz. (c) The offset fraction
varies from 0 to 10%, where the circle is the statistical mean, and the bar is the standard deviation.
Figure 9.
Noisy reversed-polarity QRS complexes in Record 108.
The dotted line is the first moving average , and the solid line is the second moving average
. The green arrows point to successful detection, while the pink arrows point to failures. Here, the black plus sign represents successful detection produced by the proposed algorithm, where the red circle represents FP.
Figure 10.
Ventricular flutters in Record 207-MITDB.
The dotted line is the first moving average , and the solid line is the second moving average
. The green arrows point to successful detection, while the pink arrows point to failures. Here, the black plus sign represents successful detection produced by the proposed algorithm, where the red circle represents FN.
Figure 11.
Noisy ECG signals in Record 53-INCARTDB.
The dotted line is the first moving average, , and the solid line is the second moving average
. The arrows point to FNs and FPs. Here, the black plus sign represents successful detection produced by the proposed algorithm, where the red circle represents FP, and the green star represents FN.
Figure 12.
Wide U waves in Record f1o09-FANTASIADB.
The dotted line is the first moving average , and the solid line is the second moving average
. The arrows point to FPs. Here, the black plus sign represents successful detection produced by the proposed algorithm, where the red circle represents FP.
Figure 13.
Isolated QRS-like artifacts in Record iaf7_afw-IAFDB.
The dotted line is the first moving average , and the solid line is the second moving average
. The arrows point to FNs. Here, the black plus sign represents successful detection produced by the proposed algorithm, where the green star represents FN.
Figure 14.
Low-amplitude QRS complexes lie between T wave alternans in Record twa89-TWADB.
The dotted line is the first moving average , and the solid line is the second moving average
. The arrows point to FNs and FP. Here, the black plus sign represents successful detection produced by the proposed algorithm, and the red circle represents FP, while the green star represents FN.
Figure 15.
Steeply upward-sloping T waves in Record sele0111-QTDB.
The dotted line is the first moving average , and the solid line is the second moving average
. The arrows point to FPs. Here, the black plus sign represents successful detection produced by the proposed algorithm, and the red circle represents FP.
Figure 16.
Processing time for ECG recordings.
The average speed of the Pan and Tompkins algorithm is represented with a solid black line, while the dotted blue line represents the average speed of the proposed detector. The proposed detector processes the one-minute ECG record in 8.9 milliseconds and the 130-minute recording in 2.2 seconds. This result shows the superiority of the proposed detector over the Pan and Tompkins algorithm in terms of processing time.