Electrocardiogram Fiducial Point Detector Using a Bilateral Filter and Symmetrical Point-Filter Structure

The characteristics or aspects of important fiducial points (FPs) in the electrocardiogram (ECG) signal are complicated because of various factors, such as non-stationary effects and low signal-to-noise ratio. Due to the various noises caused by the ECG signal measurement environment and by typical ECG signal deformation due to heart diseases, detecting such FPs becomes a challenging task. In this study, we introduce a novel PQRST complex detector using a one-dimensional bilateral filter (1DBF) and the temporal characteristics of FPs. The 1DBF with noise suppression and edge preservation preserves the P- or T-wave whereas it suppresses the QRS-interval. The 1DBF acts as a background predictor for predicting the background corresponding to the P- and T-waves and the remaining flat interval excluding the QRS-interval. The R-peak and QRS-interval are founded by the difference of the original ECG signal and the predicted background signal. Then, the Q- and S-points and the FPs related to the P- and T-wave are sequentially detected using the determined searching range and detection order based on the detected R-peak. The detection performance of the proposed method is analyzed through the MIT-BIH database (MIT-DB) and the QT database (QT-DB).


Introduction
Arrhythmias occur when electrical signals to the heart that coordinate heartbeats disfunction, and most arrhythmias are harmless. However, in case they are particularly abnormal or caused by a harmed heart, they may cause serious and even potentially fatal symptoms [1]. Arrhythmia is also called cardiac dysrhythmia or irregular heartbeat. Most arrhythmias are not severe, but some may predispose the individual to stroke or cardiac arrest. Globally, cardiovascular diseases are the biggest death-related factor [2].
The electrocardiogram (ECG) has become a very important bio-signal for the prompt detection of cardiovascular disease including arrhythmia. In the ECG signal, QRS complex detection is a preceding and essential step for classifying successive heartbeat rhythm. However, the measured ECG waveforms are deformed because of baseline wander, electrode motion artifact, and muscle artifact, thus making accurately detecting the QRS-interval a challenging task [3,4].
Several PQRST complex detection methods have been proposed to date; however, they have not been extensively studied or compared to QRS detection techniques. The first reason is that P-or T-wave detection is not easy due to the characteristics of the P-or T-wave signal; the signals have a low slope, low magnitude, and various widths. This means that reliable P-or T-wave detection should be preceded by the detection of QRS or the R-point, which has a pronounced signal characteristic compared to the P-or T-wave. This means that a high-performance R-peak or QRS detection technique must be preceded for reliable P-or T-wave detection. Furthermore, abnormalities in the R-, P-, and T-waves make detection of relevant FPs difficult. The second reason is the lack of a universal definition of the FPs of each wave. Thus, a new definition of FPs for each algorithm is required for detecting ECG FPs. This also leads to a mapping problem of undetected points when no onset or offset point is detected in a particular wave of one ECG signal. Furthermore, this problem affects the heart rate variability (HRV), which is used to analyze the patient's condition using almost all FPs. Therefore, the detection definition for FPs is not simple. Nevertheless, many different PQRST complex detection approaches based on (1) filtering techniques, such as adaptive filtering [32], low-pass differentiation (LPD) [33], nested median filtering [34], extended Kalman filtering [35,36], and switching Kalman filter [37]; (2) transform coefficient techniques, such as discrete Fourier transform (DFT) [38], discrete cosine transform (DCT) [39], wavelet [40][41][42], and hybrid feature extraction algorithm (HFEA) [42]; and (3) inference model techniques, such as Bayesian [43][44][45], hidden Markov model [46,47], and partially collapsed Gibbs Sampler (PCGS) [44,45], can be found in the literature. These methods exhibit excellent performance in identifying ECG FPs. Recently, a 12 lead-based local distance transformation (TLBLDT) was proposed for ECG wave detection and delineation [48]. However, the studies did not perform HRV analysis based on the detected ECG FPs for some medical diagnosis or pathology analysis. In addition, most methods have a high computational complexity and do not describe real-time processing techniques for wireless mobile healthcare applications, which is a recent issue. In addition, the lack of abundant detection results for FPs on the databases used in each method impairs the understanding of the algorithm.
The propagation of an action potential through the heart creates an electric current, which can be sensed at the body surface. ECG records these changes and the PQRST complex to designate the waves in the ECG, which provides valuable information in cardiac disease diagnosis. In this study, we introduce a novel PQRST complex detector that detects all the FPs on the ECG signal by detecting the QRS complex using the characteristics of a one-dimensional bilateral filter (1DBF), reducing the noise and enhancing the sharpness, and then, recognizing the P-and T-wave based on the detected QRS. This method first detects the R-peak and QRS complex using the difference between original and filtered ECG by the 1DBF, and then, recognizes the onset and offset points of the remaining P-and T-waves according to a predetermined order while moving in the left-right direction based on the detected R-peak and QRS complex. The resulting location accuracy of the R-peaks detected by the proposed method are then analyzed and time-and frequency-domain analysis is performed. The remaining FPs are used to estimate trends in the ST-segment, PR-interval, and QT-interval to estimate cardiac status.

DBF and Its Application
The 1DBF proposed is a nonlinear filter that smooths noises mixed into a signal while preserving edge features of a signal [49,50]. The filtering operation of the 1DBF restores a degraded signal. The normalization factor of the 1DBF guarantees that the filter conserves the average of flat areas in a signal.
The 1DBF is composed of two low-pass Gaussian filters (LPGFs) for the domain and range space. The domain low-pass Gaussian filter (DLPGF) assigns more weight to signal values spatially closer to the centered value. The range low-pass Gaussian filter (RLPGF) provides more weight to signal values closer to the value of the centered value. The 1DBF at an edge region, such as QRS complex, becomes a lengthened Gaussian filter. This ensures that averaging is mostly operated along the edge and is significantly decreased in the direction of the gradient. Therefore, the 1DBF can smooth noises while conserving the edge region. To use 1DBF as an efficient ECG background predictor except the QRS complex, the standard deviations, σ d and σ r , of the domain and range Gaussian filters must be adaptively changed. Figure 1 shows the impact of standard deviations of two types of Gaussian filters using 215N(4) in MIT-DB. Here, 215N(4) represents that the fourth annotated heartbeat belongs to N (Normal) class for the Record 215. σ d controls the width of the domain filter. A smaller σ d leads to weak smoothing, and a smaller σ r works so that the range filter dominates in the two Gaussian filters in the 1DBF. Figure 1b shows that 1DBF with a little bigger σ d removes noises and preserves the edge structures for the degraded ECG signal shown in Figure 1a. In Figure 1c, where the domain Gaussian filter is dominantly applied with a bigger σ r , the QRS complex corresponding to the edges is significantly blurred. In Figure 1d, a bigger σ d makes the QRS complex more blurred under the same σ r . Based on this experiment, for 1DBF to act as a background predictor, which preserves the non-QRS-interval while suppressing the QRS-interval, bigger σ d and σ r should be applied for the QRS-interval, whereas bigger σ d and σ r should be applied for the non-QRS-interval.   Figure 2 shows the FPs and their detection order related to the PQRST complex in the study. A general ECG waveform is composed of a P-wave (0.08-0.10 s), QRS-wave (0.06-0.10 s), and T-wave (0.16 s). The QRS complex is narrower and taller compared to the P-and T-waves. The P-, Q-, R-, S-, and T-point are denoted by the red dotted circles, and the blue dotted circles represent the onset and offset points. The detection order of the FPs was decided to consider the signal characteristics of the points, i.e., ease of detection. The ST-segment, and PR-and QT-interval analyzed in this study are also shown in Figure 2.  Figure 3 shows a seamless connection structure of successive sliding windows (SWs) for real time. The first SW includes six beats, and the first and sixth beat of these are incomplete beats for which some FPs are retrieved, whereas the second through the fifth beat are perfect beats for which all PQRST points can be detected. The R-peak locations of the first and sixth beat in the first SW are set to the lower and upper bounds for the FP detection of the five perfect beats. In the second SW, the lower and upper bounds correspond to the fourth and ninth beat. Furthermore, the fifth to eighth beats are perfect beats. Therefore, the fifth ECG beat is the common ECG beat in the first and the second SW. That is, the detected PQRST points in the fifth beat are a reference connecting the points detected in the preceding and following SWs. The number of seam beats may be plural for a high heart rate (HR). In the proposed method, the SW length is 2000 samples based on MIT-DB (360 Hz), and the step size, the distance between windows, is 1600 samples.

R-Peak Detection Using 1DBF
Original ECG signals suffer from noise and dc wandering. To detect R-peaks or QRS complexes while avoiding this problem, we use the difference of the original signal and filtered signal by 1DBF. FP detection of the proposed method is processed in units of SWs. First, the original ECG sequence S for the SW is normalized as follows: where I is the normalized signal for the original sequence and S min and S max are the min and max value in the original sequence, respectively. The length of I and S is equal to the SW. In the original ECG signal, the QRS complex is narrow and high, whereas the P-and T-wave except for the QRS complex and the baseline are relatively wide and gentle. A background ECG signal excluding the QRS complex is predicted by a 1DBF, and a QRS complex is detected using the difference between the original ECG signal (I) and the predicted background ECG signal (B) as the following: In this study, we employed a 1DBF to predict the background ECG signal (excluding the QRS signal) for the normalized original ECG signal. The background ECG signal B for the normalized original ECG signal I is given as follows: where Ω represents the size of the filter window based on the ECG sample-point coordinate x currently processed. The filter size is 1 × 15, which is set based on the average QRS complex time (0.06-0.10 s) and the sampling rate (360 Hz) of MIT-DB. The standard deviations, σ d.Ω and σ r.Ω , of DLPGF and RLPGF applied to the 1DBF using the variance σ 2 (Ω) of the sample points in the filter window are given as follows: where the maximum variance is σ 2 max = 0.1310 and was obtained experimentally for the MIT-DB. The maximum standard deviations of DLPGF and RLPGF are (σ d ) max = 10 and (σ r ) max = 1, respectively. Here, σ min = 10 −5 is the minimum standard deviation to prevent the two standard deviations from becoming zero when σ 2 (Ω) = 0. The above two equations for obtaining the background ECG signal for the original ECG signal mean the following: QRS regions with high variance are smoothed by bigger σ d and σ r , whereas non-QRS regions with low variance are conserved by smaller σ d and σ r .
The normalization factor is given by: Then, the residual (difference) signal D between the original and predicted background ECG signal is given by: The enhanced residual signal E, which improves the residual signal, is given by: Thereafter, the candidate-R interval C R (x), which has a value of 1 for the candidate-R interval and 0 for the remaining interval, is calculated as follows using the threshold: where the threshold for detecting the candidate-R interval is Th c = E max /2, and E max is the maximum value in the difference signal of the SW size. It is most probable that the R-peak is likely to be contained in rows of ones in C R as shown in Figure 4. If the number of consecutive 1s is more than 8 (L ≥ 8), it is assumed that an R-peak exists in it. Anx value with a max or min value in the original signal corresponding to the rows of ones in C R denotes the location of the R-peak as the following: where Max(I(i)) and Min(I(i)) are the max and min values, respectively, in the rows of ones, L ≥ 8. I mean is the mean of the original ECG signal for the currently processed SW. In Equation (10), the above conditional statement is used to detect a positive R-wave, which is a normal R-wave, and the following conditional statement is used to detect a negative R-wave, such as premature ventricular contraction (PVC). Furthermore, γ is an R-peak type factor representing a positive R-peak (γ = +1) or negative R-peak (γ = −1).  Figure 5 shows the R-peak detection procedure using the background signal estimation method described above. In Figure 5a, the blue and red lines represent the original and predicted background signal, respectively. In the predicted background signal, the QRSinterval regarded as noise is suppressed; however, the remaining signal is restored close to the original signal. Figure 5b shows the residual (difference) signal between the original and predicted background signal, and Figure 5c shows the enhanced residual signal. The candidate-R interval is detected using the threshold for the enhanced residual signal, and the maximum value in the original signal corresponding to the candidate-R interval corresponds to the R-peak, as shown in Figure 5d. If there are multiple equal maxima in the QRS-interval (i.e., when the R-peak is flat, not a point), the position of the R-peak is set to their average position.

Detection of an Abnormal R-Peak
The shapes of the R-peak considered in this study are shown in Figure 6. The normal R-peak shown in Figure 6a is very easy to process using the algorithm because there is only one maximum value corresponding to an R-peak in the candidate-R interval. However, in addition to the normal R shape, various R-waves may exist depending on the cardiac state of the patient. In the flat R-wave shown in Figure 6b, the average position of the maximum values in the candidate-R interval is assigned to the R-peak location. Figure 6c through 6f show various notch (fragmented) R-waves. The presence of a fragmented R-wave is very important because it is related to an increase in adverse cardiac events. R-peak detection in the fragmented R-wave, such as fR-L, fR-R, fR-L2, and fR-R2, involves detection of the simple maximum value (red circles in Figure 6) in the candidate-R interval; however, the determination of the fragmented R-wave and additional R-peaks (blue circles in the figure) require further processing in the Q-or S-wave detections. The detection of additional R-peaks is important not only to determine the fragmented R-wave but also to detect accurate Q-and S-wave FPs. Referring to the shapes of the fragmented R-peaks in Figure 6, additional R-peaks are detected for the left and right specific intervals based on the detected R-peak. First, an additional R-peak R R on the right side of the detected R-peak is detected by the following slope change and threshold condition for the 22-point section from the adjacent right location R + 1 of the detected R-peak: is the SR of the additional R-peak. QRS(= 0.12 sec) is the typical QRS time and F s (= 360 Hz) is the sampling rate. Because the difference between the sampling points is large around the fragmented R-wave, if the sum of the differences between the 10 points to the right of the current point is more than or equal to the threshold (Th f = 0.1), that point is considered an additional R-peak. The threshold is applied for normalized signals. By recursively searching for additional R-peaks that satisfy the above conditions within the SR, abnormal R-waves with multiple additional R-peaks can be identified, as shown in Figure 6e,f.
Similar to the additional R-peak on the right, an additional R-peak R L on the left side can be detected by the following slope change and the threshold condition for the 22-point section from the adjacent left location R − 1 of the detected R-point: The MIT-DB includes 48 half-hour recordings with 360 Hz, and the heartbeat is classified and labeled into 15 types. The types of heartbeats belong to five classes as shown in Table 1 [50,51]. The abbreviated representation of the ECG signal interval is used for the experiment. 111L(320) denotes that the 320-th annotated beat of the Record 111 corresponds to L (Left Bundle Branch Block, LBBB) among class N mentioned in Table 1. Table 1. Five kinds of heartbeat annotated in MIT-DB.

N (Non-Ectopic) S (Supraventricular Ectopic) V (Ventricular Ectopic) F (Fusion) Q (Unknown)
- Fragmented R-waves can have one or more additional R-peak, depending on the patient's condition. The additional R-point is detected as the point farthest from the detected R-peak, which satisfies the condition of Equation (9) or Equation (10) for SR. Figure 7 shows the detection results of R-peaks and additional R-peaks in the MIT-DB, as mentioned in Figure 6. In Figure 7, fR-L and fR_R denote the fragmented R-peak to the left and right of the detected R-peak, respectively.

SR of FPs Related to P-and T-Waves
The reliable detection SR of FPs included in the P-and T-wave is introduced in Figure 8. In the SR of all FPs of one ECG beat including the currently detected R-peaks, the lower and upper limit are the locations of previous T-offset and the next R-peak. The SR for P-point detection corresponds to the previous T-offset through the current Q-onset. Likewise, the SR for T-point detection corresponds to the current S-offset through the next R-peak position. The proposed method considers the mapping problem of the undetected points when not even some or all FPs of the P-or T-wave are discovered. In case the P-point (T-point) is not discovered as a prerequisite, neither P-onset (T-onset) nor P-offset (T-offset) can be assigned. In this case, all FPs concerning the P-wave (T-wave) are mapped to a point Qonset (S-offset). In case only P-point (T-point) is detected, non-detected P-onset (T-onset) is mapped to the P-point (S-offset). Likewise, in case P-offset (T-offset) is not discovered under the detected P-point (T-point), the non-detected P-offset (T-offset) can be mapped to Q-onset (T-point). This point-mapping method reduces the large error caused by undetected FPs at the calculation of the PR-interval or PR-segment concerning the P-wave and ST-segment and QT-interval related to T-wave. Additionally, if the peak areas of the P-and T-waves are deformed and the information is known, the starting point for finding the onset and offset of the P-and T-wave can be changed, as shown in the figure. v P and v T represent the deformation widths of the P-and T-wave and are introduced again in the detection part of the P-and T-point in the next section.

FP Detection of the Q-and S-Wave
The detected R-peak R becomes an important clue to detect the PQ-ST FPs. The Q-point, Q α.L , is searched using the following condition while shifting from the location of R(or R L ) − 1 to the left (minus direction): where α Q (= F s × QRS/2 + α QM ) is the SR for detecting the Q-point starting from R(or R L ) − 1 to the left and α QM (= 8) is the addition margin of the SR for Q-point detection. The subscript γ defines the shape of the Q-point according to the type of R-peak described in Equation (8).
The Q-onset, Q γ.L , is searched using the following condition while shifting from the Q γ − 1 location to the left (minus direction): where α QL (= F s × QRS) represents the SR for detecting the Q-onset starting from Q γ − 1 to the left.
The S-point S γ is detected by the following condition while shifting from the R(or R R ) + 1 location to the right (plus direction): where α S (= α Q ) is the SR for detecting the Q-point starting from R(or R R ) + 1 to the right. The S-offset S γ.R is detected by the following condition while shifting from the S γ + 1 position to the right (plus direction): where α SR (= α QL ) is the SR for detecting the S-offset starting from S γ + 1 to the right.

FP Detection of P-and T-Waves
The FPs concerning P-and T-waves are detected on a noise-suppressed predicted background signal to improve the detection accuracy. Based on the heart disease, there is a convex, normal case and a concave, inverted case, and the P-and T-wave-related FPs are composed of the two types, respectively. Based on the SR in Figure 8, the P-and T-points are searched within a given search interval, moving from Q γ.L − 1 to the left (minus direction) and from S γ.R + 1 to the right (plus direction), respectively. First, the symmetric condition for searching for the P-point is as follows: . . , 5, and ρ P = 0.9 (17) where N[·] denotes the number of points that satisfy the sign condition in square brackets. ω is the sign converter for detecting normal (ω = +1) or inverted (ω = −1) P-(or T-) points. v P (v T for T-point) defines the number of points adjacent to the point position currently being processed but not used in the above conditional expression for the detection of the P-point (or T-point). v P (v T for T-point) is applied recursively, starting at 0 and until a P-point that satisfies the above condition is detected. It was designed to detect P-waves with a deformed peak. Figure 9 shows the example of the point filter shape for P-and T-point detection at v P = 0 or 2, v T = 0 or 2, and ω = ±1. l P and r P (l T and r T for T-point) denote the left and right surrounding point intervals used directly in the above conditional expression, around the point currently processed for P-wave (T-wave) detection. The left and right wing points used for P-point detection are set as l P = r P = 10 − v p . As illustrated in Figure 8, the lower bound of SR of the P-point is the former T-offset; however, the lower bound value α P was reset to reduce the search range. α P (= F s × PR) is the SR for detecting the P-point starting from The symmetric condition for searching for the T-point is very similar to the P-point detection procedure of Equation (17) as follows: where, ω = 1 or − 1, v T = 0, . . . , 10, and ρ T = 0.95 (18) where l T = r T = 20 − v T . Furthermore, the upper bound of the SR for the T-point detection is next to the R-peak in Figure 8; however, the upper bound value α T was reset to reduce the search range. α T (= F s × (QT − QRS)) is the SR for detecting the T-point starting from S γ.R + 1 to the right, and QT(= 0.44 sec) is the typical QT-interval: . . , l PL for P L (l = 1, . . . , l TL for T L ), ω × sign(B (R + n + (r − 1))) ≥ 0, r = 1, . . . , r PL for P L (r = 1, . . . , r TL for T L )] . . , l PR for P R ( l = 1, . . . , l TR for T R ), ω × sign(B (R + n + (r − 1))) ≥ 0, r = 1, . . . , r PR for P R , (r = 1, . . . , r TR for T R )] Figure 10 shows the FP detection result of the fragmented P-wave of 118R(200) and 233N(186), the invisible or weak P-wave of 210N(307), 214L(1200), and 220N(303), and the inverted P-wave of 228N(1201). It can be seen that FPs of various abnormally shaped P-waves are detected normally.
As shown in Figure 11, two types of the onset and offset points of the P-and T-waves should also be considered-normal and inverted-depending on ω. The onset and offset point are inflection points at which the slope changes regardless of ω, and the left point section l and the right point section r used for detecting the onset and offset are shown in the figure. The subscripts, PL, PL, TL, and TR, denote the P-onset, P-offset, T-onset, and T-offset searches. The asymmetric condition for detecting the P-and T-onset is defined in Equations (17) and (18). The lower bound of the SR of the P-onset is the preceding T-offset in Figure 8; however, the lower bound value α PL = (Q γ.L − 1) − P ω was reset to reduce the search range based on the morphological symmetry between the P-offset and P-point. v P and v T are true values obtained by applying v P and v T recursively during the P-and T-point search and are used as the starting points for detecting the P-and T-onset as well as the P-and T-offset. The upper bound of the SR for the T-offset detection is the subsequent R-peak in Figure 8; however, the upper bound value α TR = (T ω − 1) − S γ.R was reset to reduce the SR based on the morphological symmetry between the T-onset and T-point.  In general, the detected P-wave (or T-wave) has a general convex shape, composed of P 1 (or T 1 ), P 1.L (or T 1.L ), and P 1.R (or T 1.R ) as follows: and ∆ −1,P (or ∆ −1,T ) > ∆ 1.P (or ∆ 1.T ) P (or T) = P 1 (or T 1 ), P L (or T L ) = P 1,L (or T 1,L ), P R (or T R ) = P 1,R (or T 1,R ), otherwise (21) when the certain condition in Equation (21) is satisfied, the P-wave (or T-wave) is assigned to an inverted concave shape and is composed of P −1 (or T −1 ), P −1.L (or T −1.L ), and P −1.R (or T −1.R ), as in Equation (21). ∆ −1,P and ∆ 1,P (or ∆ −1,T and ∆ 1,T ) denote each area estimated by the FPs of the inverted P-wave (or T-wave) and the normal P-wave (or T-wave). The inverted P-wave (or T-wave) corresponds to an inverted triangle while the normal P-wave (or T-wave) is equivalent to a normal triangle. Figure 12 shows

PQRST FP Detection Results Using MIT-DB
The effectiveness of the proposed method is analyzed using ECG records with abnormal R-, P-, and T-waves in MIT-DB. Figure 13

Performance Evaluation of R-Peak Detection
To assess the R-peak detection efficiency of the proposed method, several performance indexes are used. TP represents the total number of accurately detected QRS [52]. The annotated R-point location in each ECG data was used for beat-by-beat comparison with the detected R-peak location based on the WFDB library [53]. If the difference between the annotated position and the detected R-point position is less than 50 ms, the proposed method is considered to have correctly detected the point [54]. Table 2 shows the R-peak detection results by the proposed method for the MIT-DB. The proposed method accomplished Se = 99.83%, +P = 99.82%, and DER = 0.34% for the database. The proposed R peak detection performance for noises is evaluated in Table 3. Tape 102 is a relatively clean signal with no noise, while date 105 contains large induced noises. For evaluation, the MATLAB function 'awgn', which adds white Gaussian noise to the signal, was used for a signal-to-noise ratio (SNR) of 0.5 to 80. The proposed method for noisy signals of 5 dB SNR or higher showed relatively good sensitivity and positive prediction performance, but the performance deteriorated rapidly for noise signals of 1 dB SNR or less.  Table 4 compares the R-peak performance as well as supplemental function for several methods. The proposed method could obtain superior results similar to the existing methods, indicating a sensitivity of 99.83% on 109,510 annotated beats. As shown in Table 4, while all six methods ( [5,7,17,19,30], and proposed) indicate the QRS detection technique, only two methods ( [11] and proposed) described the QRS-onset and -offset detection technique. Table 4 shows that [11,19,25] accomplished outstanding FP and FN as well as the best DER; thus, they represent fascinating techniques. However, they are not attractive for the detection of the QRS-onset, -offset, and fR-peak. In addition, only the proposed method could detect the fR-peak, which is important for detecting adverse cardiac events. Among the stated methods, only the proposed method can recognize the QRS-onset and -offset as well as the fR-peak. The comparison indicates that the proposed method has relatively high sensitivity, positive prediction as well as low DER by comparison with the previous methods. This demonstrates that the proposed method features superior trade-off between the QRS detection and identification of the fR-peak, QRS-onset, and -offset.

Detection Performance of PQRST Complex Using QT-DB
The QT-DB is used to assess the PQRST detection performance of the proposed method. It includes 105 recordings of 15 min length with 250 Hz, and each recording has a peak and onset and offset annotation information. The annotation for each record was manually performed by two cardiologists and its number reaches 3622 [55,56]. In case the detected S-offset and T-onset are very close (less than about 0.05 s, 13 sample), the detected T-offset was excluded in the evaluation. Figure 14 shows the PQRST complex detection results of Record Sel41N(5), Sel231N(5), Sel233N(5), Sel301N(5), and Sel808N(5) by the proposed method for QT-DB. The vertical green solid lines show the originally annotated positions in the QT-DB. Figure 14a shows the locations of FPs detected by the proposed method for Sel41N (5), which has an inverted (negative) R-wave, bigger P-and T-waves, and is related to a sudden death. In this connection, the P-peak may be higher than the T-peak, and the interval between the current P-wave and the previous T-wave may be very close. We can see that the proposed method precisely detects the annotated locations. Figure 14b shows the detection result for Sel231N(5), including hyperacute T-waves in a normal sinus rhythm. In the hyperacute T-wave, it is not easy to discriminate between the S-offset and T-onset, so the T-onset has no annotations. Nevertheless, the proposed method detects the T-onset used in HRV. Figure 14c shows the detection result for Sel233N (5), which corresponds to an arrhythmia rhythm and has inverted T-waves, deep S-waves, and a hyperacute T-wave. Because the inverted T-wave appears immediately after the S-wave similar to Sel231N(5), the boundary between the S-offset and T-onset is unclear and the T-onset has no annotation. However, the proposed method estimates the T-onset used on HRV. As a result, we can see that the proposed method detects the peak and offset positions of the inverted T-waves. In addition, the beats with deep S-waves and hyperacute T-waves were not included in the original annotations. Therefore, these beats were excluded from the performance experiment. Figure 14d shows the detection result of Sel301N (5), which corresponds to an ST change rhythm and has a biphasic T-wave. The positive peak was considered as the peak annotated by the cardiologist. The proposed method detects the peak and offset location of T-waves precisely. Figure 14e shows the detection result for Sel808N (5), which is equivalent to a supraventricular rhythm, including inverted T-waves. As in the description of Sel233N(5), since the T-onset is indistinguishable from the S-offset in the inverted T-wave, it was ruled out from the annotations. We can see that the proposed method accurately estimates the original annotation locations for the normal P-wave as well as the inverted T-wave.   Table 5 shows the PQRST complex detection result of the proposed method and existing methods (LPD [33], WT [41], PCGS [44], HFEA [42], MHMM [47]) on 27 Records (19 Records except for MHMM from the original paper) from the QT-DB. However, the result of TLBLDT was obtained by the LU database [48]. Two-standard-deviation tolerances have been included in the last row [57]. The mean (m) and standard deviation (s) between the detected positions by respective methods and the originally annotated positions are also listed. The root mean square error (RMSE = (m 2 + s 2 )) is used for quantitative evaluation of the respective methods [47]. The blue and green numbers in the table represent the smallest and the second smallest RMSE of the location difference of the FPs. The proposed method has the smallest RMSE value in the P-onset, P-offset, and Twave, and the second lowest RMSE value in the P-peak, R-peak, and QRS-onset among all methods. The standard deviation of the proposed method is lower than the CSE tolerance in the P-offset, QRS-offset, and T-offset, and is close to the CSE tolerance in the P-onset and QRS-onset. Additionally, the proposed method also satisfies the criteria limit of the CSE tolerance for the P-offset with LPD and MHMM. Unfortunately, no method yet satisfies the severe criteria of the QRS-onset. The mean and standard deviation of all FPs are evaluated for LPD, WT, PCGS, HFEA, MHMM, TLBLDT, and the proposed method as 2.9 ± 13.5, 1.6 ± 12.7, 2.9 ± 15.1, −29 ± 17.4, −1.0 ± 8.5, 0.4 ± 7.4, and 0.4 ± 7.4 ms, respectively. The RMSE values across all FPs for the above-mentioned methods are evaluated to be 15.3, 13.1, 15.7, 19.8, 8.9, 9.5, and 8.3, respectively.  WT [41] 2.0 ± 14.8 (14.9) 3.6 ± 13.2 (13.7) 1.9 ± 12.8 4.6 ± 7.7 −7.2 ± 10.2 (12.5) Tolerances (2s CSE ) [57] 10.2 -12.7 6.5 -11.6 --30.6

HRV Analysis for MIT-DB
The heart is continually regulated by the autonomic nervous system [58]. HRV denotes the time variation between successive heartbeats [58,59]. HRV can estimate the sympathovagal balance through time-and frequency-domain methods [58]. In the time domain, HRV is assessed by the variability of heartbeats observed in the range of 5 min to 24 h [60]. These methods are calculated based on the beat-to-beat (or NN) intervals. The statistical time-domain measures (or metrics) include the mean HR, HR standard deviation (std.), RR-mean, NN50, pNN50, RMSSD, HRV triangular index (HTI), and TINN, which are listed in Table 6 [59,[61][62][63]. For the HR, variation in certain frequency bands is a very useful method to assess the sympathetic-parasympathetic balance of the cardiovascular system. Additionally, the high frequency band (HF) is also denoted as respiratory arrhythmia because it is associated with HRV associated with the breathing cycle and is controlled by the activity of the parasympathetic nervous system (PNS). The low frequency band (LF) is regulated by both the sympathetic nervous system (SNS) and PNS. The very low frequency band (VLF) is a variable dependent on the Lenin-Angiotensin system and is also affected in both SNS and PNS. A reduction in the ultra-low-frequency and VLF in 24-h ECG is the strongest predictor of acute heart attack and death from arrhythmia. Spectrum analysis is a useful method for evaluating the effects of the SNS and PNS at the same time. However, because individual deviations vary, it is difficult to obtain a normal number that can be used as a test tool. Therefore, it should always be investigated to see if it has decreased or increased statistically compared with the control group. The reduction in HRV mentioned above is a very powerful prognostic factor in all diseases with cardiovascular abnormalities. Figure 15 shows  The ST-segment progresses from the S-offset to the T-onset of the following T-wave. This is the sluggish depolarization term of the ventricles after the contractions of the two ventricles [64]. The baseline of the ST-segment typically is near the isoelectric line (IL) by height. The IL corresponds to the baseline of the whole ECG wave, typically located at 0 mV. Abnormal cardiac activities make the baseline of the ST-segment usually rise or fall from the IL. Elevation of the ST-segment represents myocardial infraction. On the other hand, depression of the ST-segment is typically relevant to hypokalemia [65].
The typical term of the ST-segment corresponds to 0.005 to 0.15 s. It can be seen that all test signals have a normal range of ST-segments. Furthermore, 106V(497) (female, age 24) shows a relatively constant ST-segment of about 0.1 s or less. Moreover, 108N(6) has a somewhat irregular ST-segment, which is close to zero up to 100 s due to the effects of asymmetrically peaked (or hyperacute) T-waves. However, after 100 s, the normal T-waves are observed, but an unstable ST-segment distribution is observed due to the delay of the T-wave (ST-segment above 0.15 s) and noise (ST-segment close to zero). Additionally, 118R(159) has RBBB's inverse T-waves but shows a very constant ST-segment distribution near zero and 201x(608) (male, age 68) shows a slightly higher ST-segment of 0.2 s due to the slowly rising T-waves up to 510 s and shows an ST-segment close to 0 s because of the deformation of the T-waves by the annotation "x" (Non-conducted P-wave, blocked APB) and the annotation "a" (Aberrared atrial premature) [66]. However, from 510 s, it frequently shows ST-segments close to zero due to the frequent appearance of the annotation "V" (PVC). 202a(1415) (male, age 68) basically exhibits a relatively normal range of ST-segments but shows an unstable ST-segment distribution due to the gentle T-waves or T-wave delay and biphasic T-waves. 217f(99) shows an ST-segment distribution close to zero due to asymmetrically peaked (or hyperacute) T-waves. We know that the ST-segment is not easy to distinguish whether the detected T-wave is normal, an hyperacute T-wave, or a biphasic T-wave with a large falling curve.
The PR-interval represents the term from the P-onset to the Q-onset. It indicates the conduction by means of the AV node. In case the PR-interval is longer than 0.2 s, it can be considered that a first-degree heart block exists [67]. The prolonged PR-interval arouses delayed conduction by the AV node. Furthermore, in case the PR-interval is less than 0.12 s, it is considered to manifest a pre-excitation or AV nodal rhythm.
The typical term of the PR-interval corresponds to the range of 0.12 to 0.2 s. 106V(497), 108N(6), 201x(608), and 217f(99) show a normal distribution, whereas 118R(159) and 202a(1415) show a somewhat unstable distribution. 106V(497) (female, age 24) has normal PR-intervals overall due to very clean P-waves. 108N(6) (female, age 87) also has a normal PR-interval and has a PR-interval of about 0.3 s because of the P-waves, which gradually increases in height. 118R(159) (male, age 69) has a notch (left atrial enlargement symptom) at the P-peaks, which is due to longer atrial depolarization times than normal. Therefore, the signal has a rather long PR-interval (about 0.37 secs). At 201 × 608 (male, age 68), the onset of AF with aberrated beats occurred at approximately 472 s. The ventricular fibrillation (AFIB) is the most severe from 480 to 520 s, and during this time, the P-waves are so weak that they cannot be detected; thus, the signal shows very low PR-intervals. After 550, 650, and 700 s, the annotation "V" (PVC) occurs frequently with little visible P-waves ("x" (paced) is very rarely present), resulting in very low PR-intervals. At 202a (1415) (male, age 68), AF with aberrated beats occurred at 1333 s, and then, atrial flutter with 2: 1 conduction occurred at 1558 s. This caused a momentary PR-interval drop near 1550 s. For the entire signal, the P-wave was very weak and accompanied by noise, which shows that the PR-interval is unstable. 217f (99) (male, age 65) shows relatively constant PR-intervals between 0.2 and 0.3 s, although the P-waves are very weak due to "/" (paced). However, because of the intermittent "f" (Fusion of paced and normal) or "V" (PVC), there are some intervals without P-waves; thus, the PR-interval with zero is partially visible.
The QT-interval represents the Q-onset to the T-offset. Specifically, it indicates the time from ventricle depolarization to ventricle repolarization. The unusually shortened or prolonged interval increases the danger of revelation of ventricular arrhythmia [68]. In special cases, a prolonged QT-interval can cause a life-threatening ventricular tachycardia.
The typical term of the QT-interval corresponds to the range of 0.32 to 0.44 s. 106V(497) has a very constant QT-interval of 0.4 s, except for the long QT-interval (>0.6 s), due to the very high and wide T-waves of "V" (PVC) that appear around 450 s and after 710 s. At 108N(6), QT-intervals (more than 0.6 secs) beyond the normal range are observed because of the low but slowly increasing and then decreasing T-waves in the interval of less than 100 s and more than 160 s. In addition, the QT-interval was miscalculated because of severe noise near 150 and 250 s. 118R(159) has somewhat constant QT-intervals of 0.4 s because of clean inverse T-waves with a very constant ST-segment of 0.1 to 0.2 s. In the case of 201x(608), AFIB occurred at approximately 500 s due to the onset of AF with aberrated beats, which occurred at 472 s. Therefore, P-and T-waves were hardly seen and were not detected. Furthermore, the QT-interval near 500 s was momentarily reduced to 0.2 s. 202a(1415) has a QT-interval in the normal range of 0.4 s overall but exhibits a somewhat variable QT-interval distribution due to the gentle T-wave, T-wave delay, and biphasic T-wave as mentioned in the ST-segment experiments above. 217f(99) has a rather high QT-interval of approximately 0.6 s. 217f(99) has intermittently increasing QT-intervals due to a very tall asymmetrically peaked (or hyperacute) T-waves. Table 7 shows the HRV analysis result of the test signals in MIT-DB. Bradycardia represents the HR of 45 beats/min or less while tachycardia denotes the HR of 100 beats/min or more at rest [69]. All the test signals corresponded to a regular HR. 201x(608) with high RR std. and HR std. exhibited irregular RRI and HR, whereas 202a(1415) with a high HR std. has an irregular HR but showed a regular RRI. In fact, the high RR std. and HR of 201x(608) are due to fast and irregular "N" beats, "V", "A", and "x" (actually AFIB), and the irregular HR of 202a(1415) is due to irregular "N" beats per minute (actually AFIB). NN50, pNN50, and RMSSD indicate short-term cardiac variability and are associated with parasympathetic nerve activity. Additionally, those variables are deeply related to AF and sudden death [70]. 201x(608) shows the highest RMSSD, NN50, and pNN50 among the tested signals and was actually annotated with AFIB at about 8:00. The patient was prescribed hypertension medication [71]. 202a (1415) had a relatively high RMSNN but relatively high NN50 and pNN50 values, and was diagnosed with AFIB annotated at about 26:20; this patient was also prescribed medication for hypertension [72]. In a previous study, when HTI > 20.42, the pattern was considered arrhythmic [73]. As a criterion, 202a(1415) (HTI = 18.9) close to the threshold is classified as arrhythmia. On the other hand, since the remaining test signals show an HTI of 20 or less, those signals can be regarded as normal. However, specifically, 201x(608) had a very low HTI (2.693) but had AFIB. It can be seen that it is difficult to determine whether a signal is normal or not by means of only HTI. 201x(608) with TINN <15 can be estimated to have severely decreased HRV [74]. HRV variables with a lower value indicate greater cardiac risk. VLF power is more deeply related to all-cause mortality compared to LF and HF power [73]. Low VLF power has been researched to be related to arrhythmic death and is also associated with high inflammation [73,74]. The VLF rhythm appears to be influenced by the intrinsic nervous system of the heart, and the SNS affects the amplitude and frequency of its variations.
The power of most test signals is converged in DC to constant RRIs. Because the power spectral density only deals with the frequency of the RRIs, it is not directly related to BPM. In other words, in case the BPM is constant regardless of whether it is bradycardia (or tachycardia), it may show a high VLF value. It can be seen that the 108N(6) has a lower than average BPM than other test signals but have as much power as other signals in the VLF band. 201x(608) has more HF power compared to other test signals, which indicates that the RRI is unstable. In addition, in fact, 201x(608) contains numerous "V" and some "a" and "j" annotation beats with AFIB. 202a(1415) also contains AFIB and atrial flutter (AFL); however, no difference was observed in the HF power. As explained above, while LF works through sympathetic nerves, HF is affected by parasympathetic nerves [73]. A low LF/HF, such as those for 106V(497), and 118R(159), denotes when to conserve energy, whereas a high LF/HF, such as those 108N (6), 202a(1415), and 217f(99), exhibits fight-or-flight behavior.

Conclusions
This study presents a novel PQRST complex detector using edge preservation and noise suppression characteristics of 1DBF and the temporal characteristics of FPs. All FPs are detected by a predefined detection order and mapping method of absent FPs. The evaluation of the proposed method was proved using HRV analysis using the detected FPs as well as the detection comparison of the FPs. The detection of PQRST FPs is also very important for the classification of various arrhythmias. The current medical and healthcare devices are evolving beyond binary classification of normal and abnormal to ECG signals to predict specific heart disease. The current HRV is analyzed by the length of time between each FP; however, the amplitude of each FP must also be reflected in the HRV for detailed classification of arrhythmia and pathological prediction of the heart. In the future, more accurate PQRST complex detectors and amplitude reflecting novel HRVs must be developed.