Page 1

computer methods and programs in biomedicine 9 1 ( 2 0 0 8 ) 245–254

journal homepage: www.intl.elsevierhealth.com/journals/cmpb

QRS complexes detection for ECG signal: The Difference

Operation Method?

Yun-Chi Yeha,c, Wen-June Wanga,b,∗

aDepartment of Electrical Engineering, National Central University, Jhongli 320, Taiwan, ROC

bDepartment of Electrical Engineering, National Taipei University of Technology, 106 Taipei, Taiwan, ROC

cDepartment of Electronic Engineering, Ching Yun University, Jhongli 320, Taiwan, ROC

a r t i c l ei n f o

Article history:

Received 5 March 2007

Received in revised form

5 August 2007

Accepted 17 April 2008

Keywords:

ECG signal

MIT-BIH arrhythmia database

Difference Operation Method (DOM)

QRS complex detection

a b s t r a c t

This paper proposes a simple and reliable method termed the Difference Operation Method

(DOM) to detect the QRS complex of an electrocardiogram (ECG) signal. The proposed DOM

includes two stages. The first stage is to find the point R by applying the difference equation

operation to an ECG signal. The second stage looks for the points Q and S based on the point

R to find the QRS complex. From the QRS complex, the T wave and P wave can be obtained

by the existing methods. Some records (QRS complex and T and P waves) of ECG signals in

MIT-BIH arrhythmia database is tested to show the DOM has a much more precise detection

rate and faster speed than other methods.

© 2008 Elsevier Ireland Ltd. All rights reserved.

1.Introduction

An electrocardiogram (ECG) signal is the expression of the

myocardium electrical activity on the body surface, which

appears as a nearly periodic signal. It is well known ECG con-

tains much information about heart disease. Traditionally, the

ECG cycle is labeled using the letters P, Q, R, S, and T for the

individual peaks of the whole cycle’s waveform. It is pointed

out the R peak is always positive (see Fig. 1). The diagnosis

is performed based on features extracted from the timing and

morphology of these fiducial points. Therefore, the ECG detec-

tion is very important for the doctors to make a correct clinical

diagnosis [1].

The QRS complex detection of ECG signal has been

researched for the past three decades. According to the medi-

cal definition [2,3], the most important information about ECG

?The work was supported by the National Science Council of Taiwan under Grant NSC 95-2221-E-008-069.

∗Corresponding author at: Department of Electrical Engineering, National Central University, Jhongli 320, Taiwan, ROC.

Tel.: +886 3 4227151x34562; fax: +886 3 4255830.

E-mail address: wjwang@ee.ncu.edu.tw (W.-J. Wang).

0169-2607/$ – see front matter © 2008 Elsevier Ireland Ltd. All rights reserved.

doi:10.1016/j.cmpb.2008.04.006

signal is almost concentrated on the P wave, QRS complex and

T wave. These data include the positions and/or magnitudes

of PR interval, QRS interval, QT interval, ST interval, PR seg-

ment,andSTsegment(seeFig.1).Infact,QRSdetectionisvery

difficultbecauseofsomeproblems,suchasanoisyECGsignal,

power-line interference, and T wave amplitude similar to QRS

complex. To get the correct information, the above problems

must be overcome.

There have been several investigations dealing with the

QRS complex detection for ECG signals. For instance, Pan and

Tompkins [4] proposed an algorithm (the so-called PT method)

to recognize QRS complex in which they analyzed the posi-

tionsandmagnitudesofsharpwavesandusedaspecialdigital

band pass filter (BPF) to reduce the false detection of ECG sig-

nals. The paper [5] proposed the Wavelet Transforms (WT)

method for detecting QRS complex. By the multiscale feature

Page 2

246

computer methods and programs in biomedicine 9 1 ( 2 0 0 8 ) 245–254

Fig. 1 – ECG waveform: (1) P wave; (2) QRS complex; (3) T wave; (4) PR interval; (5) QRS interval; (6) QT interval; (7) ST interval;

(8) PR segment; (9) ST segment; (10) R–R interval (or beat); (11) cardiac cycle (including P wave, QRS complex, and T wave).

of WT, the QRS complex can be distinguished from high P or

T waves, noise, and baseline drift. Moreover [6–11] used some

special digital filters to detect and classify ECG signal in time

or frequency domain, [12] proposed the “Geometrical Match-

ing Approach” algorithm to find the ECG beat. Based on the

estimation of the first-order derivative, [13] proposed the SVW

algorithm to find the QRS points. As we know, to achieve their

goals, all the above methods [3–13] require some complicated

mathematical calculation.

In this paper, a simple and fast algorithm, termed the

“Difference Operation Method (DOM)” for detecting the QRS

complex is proposed. The proposed DOM includes two stages.

The first stage is to find the point R by applying the difference

equation operation to the ECG signal. The second stage looks

for the points Q and S according to the point R to find the

QRS complex (see Fig. 1). Most P and T wave detection tech-

niques require the QRS as the reference points [4,14–17]. The

DOM method can detect the QRS complex easily without any

complex mathematical calculation, such as cross-correlation,

Fourier transformation, etc.

The rest of the paper is organized as follows. Section 2

describes the procedure of the Difference Operation Method.

TheMIT-BIHarrhythmiadatabase[18]isexperimentedtoeval-

uate the effectiveness of the proposed DOM in Section 3, and

the paper is concluded in Section 4.

2. Difference Operation Method (DOM)

This section proposes a scheme called the “Difference Oper-

ation Method (DOM)” to detect the QRS complex. Once QRS

complex is detected, the P and T waves can be detected by the

existing papers [4,14–17]. The DOM includes two processes,

one is the difference operation process (DOP) and the other is

the waves’ detection process.

2.1. Difference operation process

The difference operation process procedure is presented as

follows:

Step 1-1. Download the original ECG signal x.

Remark 1-1. The ECG signal may originate from

any source. Tape #103 in the MIT-BIH arrhythmia

database is an example, as shown in Fig. 2a.

Fig. 2 – (a) x, the ECG signal in the database MIT-BIH Tape #103; (b) xd, the ECG signal after applying the difference operation;

(c) xdf, the signal after applying a low-pass filter; (d) the setting of the threshold values; (e) ˆ xdf, the signal after going through

thresholds.

Page 3

computer methods and programs in biomedicine 9 1 ( 2 0 0 8 ) 245–254

247

Fig. 3 – Noise of ECG signal: (a) 60Hz power-line interference; (b) baseline drift; (c) EMG; (d) motion artifacts.

Step 1-2. UseadigitalfiltertocutoutnoisesfromECGsignals.

Remark 1-2.

different cases as follows: (i) 60Hz power-line inter-

ference. It comes from the power line of the

ECG signal measurement systems despite proper

grounding (see Fig. 3a). Its frequency content 60Hz

(fundamental) is with harmonics. The 60Hz notch

filter can be used for rejecting the power-line inter-

ference [19]. (ii) Baseline drift. It is mainly caused

by patient breathing, bad electrodes, or improper

electrode site, etc. (see Fig. 3b). Its frequency range

is usually below 0.5Hz. The high-pass filter with

cut-off frequency 0.5Hz can be used to remove the

interference by baseline drift [19]. (iii) Electromyo-

gram (EMG). It is produced by muscle electrical

Noises may have many types for

activity.IntheECGsignal,EMGinterferenceappears

as rapid fluctuations which vary faster than ECG

waves (see Fig. 3c). Its frequency content ranges

from dc to 10kHz [20]. The morphological filter for

a unit square-wave structuring (the best width is

0.07s)canbeusedtoremovetheinterferenceofEMG

[21]. (vi) Motion artifacts. It results from motion of

the electrode in relation to the patient’s skin. It can

produce larger amplitude signals in the ECG (see

Fig. 3d), and its duration time is about 100–500ms

[20]. The adaptive filter can be employed to remove

the interference of motion artifacts [22].

Step 1-3. Obtain the difference signal xdby (1):

xd(n) = x(n) − x(n − 1)(1)

Fig. 4 – (a)

extreme value points); (c) the selected correct extreme value points; (d) the pair of positive and negative extreme value

points in the original ECG signal; (e) the position of positive maximum value is the point R.

?x+

dfand

?x−

dfare separated from the difference signal ˆ xdf; (b) pick up the extreme value points (where “?” represent

Page 4

248

computer methods and programs in biomedicine 9 1 ( 2 0 0 8 ) 245–254

Fig. 5 – R–R interval with duration about 0.864s (311 sampling points) in the MIT-BIH Tape #103, where duration

time=(R2−R1)×(1/sampling frequency)=(577−266)×(1/360Hz).

where x(n) is the input signal at time n, and xd(n) is

the difference output signal at time n [1,13].

Remark 1-3. The difference signal may contain the

small amplitude but high frequency variation (see

Fig. 2b).

Step 1-4. Applyinganylow-passfilterwithacut-offfrequency

of about 100Hz to xdto eliminate the small ampli-

tude but high frequency variation waveform (see

Fig. 2c). The filtered signal is denoted by xdf.

Remark 1-4.

components of an ECG signal range are about

0.05–100Hz [2].

It is known the typical frequency

Step 1-5. Let the filtered signal xdffrom Steps 1–4 go through

formula (2) with the thresholds T1and T2to get the

final signal ˆ xdf(see Fig. 2e):

ˆ xdf=

?0 if 0 < xdf< T1,or T2< xdf< 0

if xdf≥ T1,or xdf≤ T2

xdf

(2)

where T1=2MVp and T2=2MVn (see Fig. 2d). MVp

and MVn denote the mean values of all positive

and negative waveform amplitudes in each MIT-BIH

arrhythmia database record, respectively.

Remark 1-5. According to the medical definition

[2], the duration of each R–R interval (that is, each

beat) is about 0.4–1.2s (144–432 sampling points at a

sampling frequency of 360Hz) (see Fig. 1). For exam-

ple, the duration of each R–R interval of Tape #103

in the MIT-BIH arrhythmia database (see Fig. 5) is

about 0.864s (311 sampling points). Then, the total

number of sampling points is 2084×311 for 30min

long record (about 2084 beats, see Table 3). In this

case, the mean values MVpand MVnare about 0.48

and −0.47mV, respectively. The determination of

the threshold values T1 and T2is based on many

experiments. The objective of setting threshold val-

ues, T1 and T2, is to find the correct positive and

negativeextremevaluepoints.However,ifthesetwo

values are set too small, it will have more nonzero

points in the R–R interval in an ECG signal so the

positive and negative extreme value points are not

easily found. On the other hand, if these two val-

ues are set too large, it is possible to remove many R

peak in an ECG signal, so the accurate positive and

negative extreme value points cannot be found. Our

proposed algorithm depends on ECG electrode posi-

tion. For instance, it is assumed that the R peak is

always positive, Q and S peaks are always negative

(according to the medical definition [2], see Fig. 5). If

electrode position is not same as that in Fig. 5, the

way to solve is to replace T1and T2with new values

(see Fig. 2d).

Fig. 6 – Select the correct extreme value points (where point A is extreme value in the interval i−1, point B is extreme value

in the interval i, and the distance from point B to point C is called R–R interval.).

Page 5

computer methods and programs in biomedicine 9 1 ( 2 0 0 8 ) 245–254

249

Fig. 7 – Definition of the search interval-1 and search interval-2.

2.2.Waves’ detection

After we obtain the signal ˆ xdf, the detection of QRS complex

is the next task. For an original ECG signal x, if the points R, Q

and S are found, respectively, QRS complex is obtained.

2.2.1. The procedure to find the point R

Step 2-1. Let the difference signal ˆ xdfbe separated into two

kinds of signals

?x+

dfand

?x−

df, where

?x+

dfand

?x−

dfare the

positive and the negative parts of ˆ xdf, respectively

(see Fig. 4a).

Step 2-2. Find the extreme value points for each interval.

Scan

interval, where each interval contains 50 sampling

points with sampling frequency 360Hz. Therefore,

the duration of each interval is about 0.14s. If there

is one nonzero extreme value (absolute value) in an

interval of

respectively, in

?x+

dfand

?x−

dffrom left to right interval by

?x+

dfand

?x+

?x−

df, pick up and record them,

dfand

?x−

df(see Fig. 4b, two points

Fig. 8 – The example of finding the position of points Q and S. (a) MVqq(0.22mV)>Vq1(−0.1mV)+Tv(0.18mV). So, the

position of Q2is the position of Q. The positions of S1and S2are the same. So, their position is the position of point S. (b)

MVqq(−0.18mV)≤Vq1(−0.24mV)+Tv(0.18mV) and Vq2(−0.22mV)>Vq1(−0.225mV). So, the position of Q1is the position

of Q. Vs2(−0.7mV)≤Vs1(−0.58mV). So, the position of point S locates on the position of point S2. Note: (1) Vq1; (2) Vq1+Tv;

(3) MVqq; (4) Vq2; (5) Vs1; (6) Vs2.