1 Introduction

According to World Health Organization (WHO) reports, cardiac abnormalities are prime cause leading to casualties in the world (Kublanov and Dolganov 2019). In 2008, around 17.3 million people, constituting 30% of the total casualties worldwide, succumbed to cardiac abnormalities (Alwan 2011). For instance, myocardial infarction (MI) has been found to be one of the most frequently occurring cardiac abnormality that is responsible for most of the casualties due to irreversible damage to heart muscles (Vimala and Kalaivani 2014; Aqil et al. 2016). Hence, fast and accurate diagnosis is the need of the hour that is very important to avoid such casualties (Baloglu et al. 2019).

The electrocardiogram (ECG) is an important and primitive diagnostic tool in clinical routine for detecting cardiac abnormalities (Luz et al. 2016; Sharma and Sharma 2016; Sharma and Sunkaria 2016; Sahoo et al. 2017). ECG signal comprises of different waves viz. P, QRS and T waves, which represents electrical potential variations derived from the polarization and depolarization activity of the heart (Manikandan and Soman 2012; Arbateni and Bennia 2014; Liu et al. 2014; Kim et al. 2009; Chen et al. 2006). Unfortunately, the acquisition of ECG data records entails the involvement of various types of noises (Padmavathi and Ramakrishna 2015a, 2016, 2015b; Rakshit and Das 2017; Nallathambi and Principe 2014; Pandit et al. 2017; Choi et al. 2010; Mehta et al. 2010; Rekik and Ellouze 2017). But it is an indispensable component of effective computational medicine for detecting heart diseases (Padmavathi and Ramakrishna 2015b; Yakut and Bolat 2018; Yazdani and Vesin 2016).

Traditional techniques of ECG signal analysis are confined mainly to time domain using filtering techniques, morphological techniques, etc. But these are not sufficient to analyze all of its attributes. Additional information about frequency components of an ECG signal is also required for more accurate analysis. In Kaur et al. (2018), self-convolution window (SCW) was used for denoising the ECG signals. They used Hamming window with discontinuous response at the edges. In Leong et al. (2012), quadratic spline wavelet transform was used for developing QRS detection processor. But there, proper identification of singular points was very difficult. In Yochum et al. (2016), automatic detection was performed of all three waves comprising an ECG signal viz. P, QRS, and T using 12 leads acquired ECG signal by using continuous wavelet transform (CWT). But it missed out on necessary phase information.

In Li et al. (2014), two operations were performed on an ECG signal viz. denoising and R-peak detection using empirical mode decomposition (EMD). Unfortunately, EMD operation is not capable of interpreting the hypothesis-driven analyses. In Acharya et al. (2008), modelling technique was used for automatic identification of cardiac health. But that process heavily relied on the chosen model order and corresponding coefficients. In Bahoura et al. (1997), digital signal processing (DSP) implementation was done based on wavelet transform (WT) for analysing real time ECG waveforms. That implementation relied on its multiply–accumulate performance i.e. filtering and frequency response.

In Nygaards and Sornmo (1983), envelope of an ECG signal was used for delineating the QRS complexes. But it needed additional effort in visually inspecting the QRS complexes and corresponding algorithm. In Trahanias (1993), mathematical morphology was used for detecting QRS complex in an ECG signal. But that process entailed higher computational costs. In Plesnik et al. (2012), fiducial points were detected present in an ECG signal using the euclidean distance measure. But sometimes that measure failed being not yielding fruitful results e.g. when the variations in the distance of overall system were not considered. In next research work, Ning and Selesnick (2013) utilized sparse derivatives for ECG enhancement as well as QRS detection. But that required computation of Jacobians and Hessians involving huge mathematical operations alongwith expansion of detection errors due to presence of high-frequency noises. In Verma et al. (2018), Alexander fractional differential window (AFDW) filter was developed based on both forward and backward coefficients for ECG denoising. Unfortunately, AFDW polynomial fails to link all existing pairs of component in some cases. In Das and Ari (2013), an ECG signal was denoised using stockwell transform (S-transform). But there redundancy in S-transform increases for multidimensional ECG signals. In Meireles (2011), adaptive signal processing (ASP) approach was used for ECG signal denoising. But it depended on the selection of reference signal. In Mehta and Lingayat (2008), QRS complexes were recognized using support vector machine (SVM) technique. But performance of SVM is adversely affected due to large amount of noises/distortions. In Altan et al. (2019), Second Order Difference Plots (SODP) technique was used to extract heart rate variability (HRV) features of an ECG for diagnosing different cardiac disorders. But there the performance was also adversely affected due to noisy datasets. In Zhang et al. (2010), Hilbert-Huang transform (HHT) was used for ECG signal denoising. But there blending of empirical modes occurred resulting in mode mixing. In Bouaziz et al. (2014), an improved QRS complex detection algorithm was presented based on wavelet transform (WT). WT (Leong et al. 2012; Yochum et al. 2016) and fractional Fourier transform (FrFT) (Mendlovic and Ozaktas 1993) are two important time–frequency analysis tools that have been frequently used for signal analysis. Performance and effectiveness of WT relies on the choice of two important parameters (Dinh et al. 2002; Chen et al. 2006); (i) mother wavelet; (ii) decomposition level. WT provides information from both frequency and time domains (Dokur and Olmez 2001). Discrete wavelet transform (DWT) is a well-known technique for ECG signal classification due to its easier implementation. Continuous wavelet transform (CWT) has also been used to extract features from the ECG signals (Alyasseri et al. 2018) as it overcomes drawbacks of DWT like coarseness of the representation and instability. However, it has its own limitations such as presence of redundancies, lack of providing phase information needed for reconstructing the original signal, need of correct discretization and high computational cost. Also, WT based techniques suffer due to fringing effects and phase shift problems (Sunkaria et al. 2010).

It has been observed from the above literature survey that until now a huge portion of the biomedical research spectrum has been devoted for exploring ECG signal processing techniques to facilitate early and timely diagnosis. Correct detection of R-peaks (QRS complexes) can effectively lead to an accurate diagnosis of the cardiac abnormalities. But their detection by manual inspection is cumbersome due to time-varying morphology, physiological variations of the patient & noise and needs a skilled observer introducing additional inter-observer variabilities. Therefore, computer aided diagnosis based on an efficient feature extraction algorithm can provide the solution. Additionally in the literature, majority of the existing techniques for ECG signal analysis relied heavily on its pre-processing that is computationally expensive prohibiting their usage on portable ECG devices, which normally lack sufficient computational resources.

Therefore, fractional Fourier transform (FrFT) is proposed to be used in this paper for effective feature extraction in the time-fractional-frequency domain through its filtering effect that also facilitates easier noise separation. The novelty of the present work to efficiently detect R-peaks in the presence of various types of noise/distortions/physiological variabilities using raw ECG datasets without any pre-processing/filtering technique. Principal component analysis (PCA) is proposed to be utilized for detecting R-peaks with higher accuracies based on the obtained eigenvalues and eigenvectors, which belong to a new orthogonal basis (Chawla 2008).

The paper is structured as; Sect. 2 provides details of the used database(s), feature extraction using FrFT, detection using PCA and definition of evaluation parameters. Section 3 showcases and discusses some important obtained results followed by conclusion at the end.

2 Materials and methods

In this section, details of the used ECG database, feature extraction technique, detection technique, and performance evaluating parameters are presented.

Figure 1 shows the technique proposed in this paper.

Fig. 1
figure 1

Proposed technique

2.1 ECG database

During last three decades, MIT-BIH arrhythmia (M/B Ar DB) database has been widely used (Sunkaria et al. 2010; Rodriguez et al. 2015; Zidelmal et al. 2012) by majority of researchers from different countries. Therefore in this paper, the same database viz. M/B Ar DB is used to provide suitable comparisons with the results reported in other similar existing studies.

2.2 Feature extraction using fractional Fourier transform (FrFT)

FrFT is one of the most widely used technique among other existing signal processing tools that provides both time and frequency information along the intermediate axis that lie at a certain angle (α) with the reference time axis (Ozaktas et al. 2001; Lin et al. 2004; Daamouche et al. 2012). This rotation angle is measured in counterclockwise direction of rotation of u axis w.r.t time axis. It’s value lies between 0 and \(\frac{\pi }{2}\) and it provides time–frequency description of the signal (Lin 1999; Singh and Singh 2017; Sejdic et al. 2009; Pipberger et al. 1990) in the intermediate domain created by the rotating vector as shown in Fig. 2.

Fig. 2
figure 2

The angle of rotation of α

Mathematically, pth (p = 2α/π) order FrFT of a signal x (t) ∈ L2 (R) is defined as (Zayed 1996)

$$ X_{p} \left( u \right) = F^{p} \left\{ {x\left( t \right)} \right\}\left( u \right) = \mathop \int \limits_{ - \infty }^{\infty } x\left( t \right)K_{p} \left( {t,u} \right)dt $$
(1)
$$ {\text{where}}\,K_{p} \left( {t,u} \right) = \sqrt {\frac{1 - j\cot \alpha }{{2\pi }}} \exp \left( {j\frac{{t^{2} + u^{2} }}{2}\cot \alpha - jut\csc \alpha } \right), {\text{when}}\,\alpha \ne k\pi $$
(2)
$$ K_{p} \left( {t,u} \right) = \delta \left( {u - t} \right),\,{\text{when}}\,\alpha = 2k\pi $$
(3)
$$ K_{p} \left( {t,u} \right) = \delta \left( {u + t} \right),\,{\text{when}}\,\alpha = \left( {2k + 1} \right)\pi $$
(4)

Frequency analysis makes it easier to handle frequency sensitive additives like noise/distortion. FrFT has been proposed to be applied for ECG signal analysis in this paper for both extracting the features and denoising as shown in Fig. 3. It transforms a signal (either from time or frequency domain) into an intermediate domain between time and frequency. Infact, the signal is rotated in time–frequency domain which has a filtering effect resulting in retention of original pathological information (Pipberger et al. 1990). Figure 3 shows the above mechanism. In Fig. 3a, it is clearly shown that if basic (ordinary) filter is used, then useful clinical information is lost during selection of passband and stopband (shown by red boundary for more clarity). But after fractional Fourier transform (FrFT), noise gets separated easily due to rotation at an angle enabling effective filtering with effective feature extraction in time-fractional-frequency domain (Fig. 3b and c) yielding original recorded ECG signal without noise which retains all pathological information (Fig. 3d).

Fig. 3
figure 3

Filtering effect of FrFT a Raw ECG signal, b FrFT at rotation angle 0 < α < π/2, c filtered signal, and d original ECG signal after rotation without noise

After feature extraction step, R-peak detection is performed using PCA as illustrated in next subsection.

2.3 Principal component analysis (PCA)

PCA is well known for trimming the dimensions of new variables without loosing any information. The new set of variables are called principal components (PCs) (Chawla 2008). All PCs are orthogonal in nature and are formulated based on supremum of eigenvalues (i.e. highest absolute value of an eigenvalue) (Rodriguez et al. 2015). In PCA, whole analysis relies on the value of eigenvalue, eigenvector and variance calculation (Gupta and Mittal 2019a). In this study, average first principal component (PC1) eigenvalue was 98.77% as observed for the whole M/B Ar DB. Detection process has been considered to consist of identifying two categories of patients viz. normal and abnormal.

In the first step, covariance (Cov) is calculated as (Gupta and Mittal 2019b)

$$ {\text{Covariance}}\left( {{\text{Cov}}} \right) = \frac{{\mathop \sum \nolimits_{{{\text{i}} = 1}}^{{\text{n}}} \left( {{\text{x}}_{{\text{i}}} - {\overline{\text{x}}}} \right)\left( {{\text{y}}_{{\text{i}}} - {\overline{\text{y}}}} \right)}}{{\left( {{\text{n}} - 1} \right)}} $$
(5)

In the second step, eigenvectors are computed using H

$$ {\text{H}}^{ - 1} {\text{Cov}} {\text{H}} = \wedge $$
(6)

where ^ denotes a diagonal matrix.

In the last step, projected data i.e. PCs are computed as

$$ {\text{Principal Components}}\left( {{\text{PC}}} \right) = [{\text{H}}^{{\text{T}}} \left( {{\text{x}} - {\overline{\text{x}}}} \right)^{{\text{T}}} ]^{{\text{T}}} $$
(7)

The performance of the proposed technique is adjudged on the basis of various performance parameters such as sensitivity, positive predictive value, and accuracy as defined in next subsection.

2.4 Performance evaluating parameters

The performance of the proposed technique for R-peak detection is evaluated using different parameters (Kaya et al. 2017; Kaya and Pehlivan 2015a; Phukpattaranont 2015; Thakor and Zhu 1991; Kaya and Pehlivan 2015b; Gupta and Mittal 2019c; Gupta and Mittal 2020; Gupta and Mittal 2021) which are mathematically explained as

$$ {\text{Sensitivity}}\left( {{\text{Se}}} \right) = \frac{{{\text{TP}}}}{{{\text{TP}} + {\text{FN}}}} $$
(8)
$$ {\text{Positive Predictive Value }}\left( {{\text{PPV}}} \right) = \frac{{{\text{TP}}}}{{{\text{TP}} + {\text{FP}}}} $$
(9)
$$ {\text{Accuracy}}\left( {{\text{Acc}}} \right) = \frac{{{\text{TP}} + {\text{TN}}}}{{{\text{TP}} + {\text{TN}} + {\text{FP}} + {\text{FN}}}} $$
(10)

where TP is the number of ‘True Positive’ which signifies correctly detected R-peaks, TN is the number of ‘True Negative’ which signifies correct identification of non R-peaks, FN is the ‘False Negative’ which signifies number of R-peaks that were not detected by the proposed technique, and FP is the ‘False Positive’ that signifies wrongly detected R-peaks.

3 Results and discussion

Efficacy of the analysis of an ECG signal heavily relies on variety of noises and artifacts that creep in during its recording. Therefore, an efficient pre-processing stage is required under such circumstances, but that further increases computation cost of the automated ECG signal analysis. In this paper, the proposed technique obviates the need of the pre-processing stage and the whole operation has been performed on the features extracted using FrFT followed by detection using PCA. This helps in lowering down the computational cost. The raw ECG signal is shown in Fig. 4. Real and imaginary parts of FrFT and its inverse operation are shown in Figs. 5 and 6, respectively. Figure 6 showcases the transformation characteristics of FrFT i.e. its capability to recover the original signal upon taking its inverse. This will enable the users to utilize the signal obtained after inverse FrFT for R-peaks detection. Detected wave components in the ECG signal according to variance calculation and R-peaks for M/B Ar DB are shown in Figs. 7 and 8, respectively.

Fig. 4
figure 4

Raw ECG signal from M/B Ar DB a dataset no. 232 m, b dataset no. 100 m

Fig. 5
figure 5

Real and imaginary part of FrFT for a dataset no. 232 m, b dataset no. 100 m

Fig. 6
figure 6

Inverse operation of FrFT for a dataset no. 232 m, b dataset no. 100 m

Fig. 7
figure 7

Detection of wave components as per variance

Fig. 8
figure 8

R-peak detection in a whole dataset no. 232 m, b whole ataset no. 100 m c for 3 s duration of dataset no. 100 m

Five different features viz. R-peaks, T waves, P waves, BLW, and noise components have been considered in this paper during detection. It can be observed from Fig. 7 that R-peaks, T-waves, P-waves, BLW and noise components (viz. EMG, PLI, low, and high frequency) are detected with a variance of 98.77%, 37.11%, 21.22%, 5.22% and 1.2%, respectively sequentially one after another in the decreasing order from desirable to undesirable components. This establishes the fact that PCA reduces the dimensions of selected features facilitating detection of R-peaks in different datasets on the basis of estimated variance of first principal component i.e. PC1.

Figure 8a shows R-peaks detection using PCA for M/B Ar DB record no. 232 m containing a total of 1777 R-peaks (shown in Table 1) with 1776 detected R-peaks and true positives (TPs), 01 false negatives (FNs) and zero both false positives (FPs) and true negatives (TNs). The detected six small peaks consist of five actual R-peaks and one FN. This result demonstrate strength of the proposed method that actual R-peaks hidden even in the smaller ECG signal peaks are detected with very small detection error e.g. as 01 in 1777 for 232 m data record. Similarly, all of the actual R-peaks (i.e. 2270) were detected with zero FN, FP and TN for the record no. 100 m as shown in Fig. 8b and summarized in Table 1. Figure 8c shows R-peak detection in dataset no. 100 m for a time duration of 3 s using PCA (where 3 R-peaks are shown by blue color arrow).

Table 1 TP, FN, FP and TN calculation after applying FrFT and PCA

Table 1 shows the detected R-peaks, TPs, FNs, FPs and TNs obtained using the proposed technique. It is revealed that datasets such as 100 m, 103 m, 107 m, 109 m, 115 m, 117 m, 119 m, 123 m, 124 m, 212 m, 219 m, 220 m, 230 m, 231 m, attain Se, PPV, and Acc of 100% due to less detection error (FN and FP) in the proposed technique.

Table 2 summarizes the findings and compare them with other existing state-of-the-art techniques on the basis of evaluation parameters viz. Se, PPV and Accuracy. It is observed that the proposed technique outperforms the existing techniques on the basis of these parameters in general. Despite of Se having similar values (e.g. in Manikandan and Soman 2012; Rakshit and Das 2017), the values of PPV and Acc are less. Therefore, it can be concluded that out of all the compared techniques, only the proposed technique provides higher values of all the assessment parameters simultaneously.

Table 2 Comparison of the proposed and existing techniques for M/B Ar DB

Table 3 summarizes the overall comparison of the proposed and other existing techniques on the basis of Total beats, TP and FN + FP for the entire M/B Ar DB. It is observed from Table 3 that the overall performance of the proposed technique is better as compared to that of the existing techniques.

Table 3 Comparison of the proposed and existing techniques on the basis of total beats, TP, and (FN + FP)

Table 4 outlines merits and demerits of the proposed and existing techniques. It indicates that the proposed technique has low computational cost as the pre-processing stage is skipped without compromising important clinical attributes.

Table 4 Comparison of the proposed and existing techniques on the basis of relative merits/demerits

The selected assessment parameters in this paper viz. Se, PPV and Acc indicate robustness of a technique in the context of duplicity (D), which exists in the detection results, if total detected beats (TP + FN + FP + TN) are higher as compared to total actual beats. It should be as low as possible in detection/classification type problems. It is observed that Zidelmal et al. (2012), Sharma and Sharma (2017), Saini et al. (2013), and Dohare et al. (2013) have reported the duplicity of 0.1762%, 0.1242%, 0.1373%, and 0.6620%, respectively. On the other hand, the proposed technique has duplicity of 0.0789%. Therefore, it can be concluded that the proposed technique outperforms the existing techniques on this count also. These results indicate that quality of biology-related information is retained in the FrFT features extracted from an ECG signal for identifying different heart abnormalities alongwith other benefit of FrFT such as denoising, time-fractional-frequency portrays, etc.

4 Conclusion

The proposed technique has been implemented successfully on M/B Ar DB yielding Se of 99.93%, PPV of 99.95%, and Acc of 99.88%, which are consistently of higher values unlike one or two parameters (at the most of equal value) provided by the existing techniques at one point of time. The proposed technique also achieves a FN + FP of 138, and D of 0.0789%, which are least among the existing techniques. As ECG signal processing has three main pillars viz. pre-processing, feature extraction, and detection. The obtained results demonstrates that FrFT fulfills the need of both efficient pre-processing and feature extraction whereas PCA effectively detects R-peaks in both situations of the patient being normal/abnormal. This signify its effectiveness for analyzing the time-varying signals. The proposed technique is also expected to reduce the computational time because pre-processing has not been used separately for denoising the raw ECG signal.

Though FrFT is effective for analyzing time-varying signals but it is not suitable for locating fractional Fourier domain (FrFD) frequency contents, which is an important aspect. Also, it cannot detect the local structures present in the signal. Despite this shortcoming, the present paper has proposed its efficient utilization for detecting R-peaks in an ECG signal facilitating arrhythmias detection implicitly. In future, the proposed technique may be improvised suitably for explicit and timely detection of the presence of arrhythmias.