The goal of automatic ECG analysis is to assess the clinical status of the heart system as accurately as possible, and the identification of P and T waves plays a significant role in this matter. This works presents an original algorithm for the detection of P and T waves peaks. Pre-processing comprises a notch filtering stage to remove power-line interference if detected, baseline wandering removal by subtraction of a line connecting successive QRS onsets and a lowpass filtering stage implemented through a cascade of moving averages to cut off movement artifacts and residual noise. The filtered signal is then upsampled to 1 KHz. Since the ability to detect P and T waves critically depends on the correct positioning of R peaks, our algorithm was developed considering annotated R peaks. P-wave search algorithm was based on the search of the maximum area between the signal and a line, hinged to the signal in two points 0.080 s apart, running backwards from the point Q_on until the other end reaches an estimated position of the T wave in the previous complex. T-wave peaks are identified considering the sequence of the changes of the slope and the signal’s local extreme in an interval ranging from the S-wave offset to the time identified by Bazett’s formula.
To test and compare the algorithm’s performance, we considered the QTDB and MIT-BIH Arrhythmia annotated databases. On the QTDB database our algorithm obtained considerably higher performance than those presented in the literature (Friganovic et al., 2018) for both P and T wave (P: 94.83% vs 89.05%; T: 89.05% vs 87.49% for channel1), while on the MIT-BITH database the results were almost comparable to those reported in the literature. These findings suggest the high potential of the proposed simple algorithm for P and T wave detection in ECG.