1 Introduction

The Internet of Things (IoT) is a digital revolution classified as a big technological revolution [1]. It is applied in many industries, especially Industry 4.0 with large commercial applications and small domestic applications. Also, the IoT is used with more smart connected devices, this revolution is increasingly morphing into the Internet of Everything [2, 3]. With the help of a framework made up of various sensors, wireless links, actuators, and technologies of data processing which interact with one another to increase communication capacity for different applications, the IoT is designed to link objects in the physical world to the Internet network for information exchange [4, 5]. Large sensor networks collect a lot of data, which slows down network traffic and reduces the overall performance in terms of compute power, device battery life, and other factors [6,7,8]. Numerous methods have been investigated to enhance data transmission, and the compressive sensing (CS) technique appears to be a strong candidate [9,10,11]. In order to share the bodily states and biomedical signals of a remote patient with a healthcare provider, an IoT framework is essential in biomedical applications. An Electrocardiogram (ECG) signal can be used to remotely detect a patient’s heart, thus this signal is one of the significant biological signals that should be taken into consideration. Moreover, in order to transfer the ECG signal to a cloud, a convenient compression rate for this signal is required to match internet bandwidth requirements. Therefore, to serve numerous remote patients simultaneously. The decompressed signal’s quality must also be sufficient to produce correct data analytics results for machine learning (ML) techniques to anticipate arrhythmia [12, 13].

Figure 1 illustrates the typical ECG signal. There are P, Q, R, S, T, and U waves in this signal. The P wave is the moniker for the initial positive wave. Q, R, and S waves make up the QRS complex wave. Ventricular re-polarization causes the T wave, which has a smooth shape. Prior to the P wave of the following cycle, the U wave arrives after the T wave. In this paper, a CS technique is proposed to automatically extract ECG features to be constructed. The created technique starts by breaking down the original ECG signal using the DWT and the mother wavelet from Daubahies is the db6 wavelet. This algorithm starts to remove high-frequency components that contain a noise component and low-frequency components which includes a baseline drift de-trending. Then, the preprocessed signal is used to aid in the automatic feature extraction from the ECG signal [14]. The utilized ECG signals are obtained from the MIT/BIH database via the Physionet repository with a could be saved in text format [15]. The motivation of using the CS technique is to compress ECG signals and it is convenient to occupy a small space for several IoT cloud memory storages.

Fig. 1
figure 1

Typical ECG signal

This paper has three contributions as follows:

  • Implementing the CS technique to compress ECG signals.

  • Improving the maximum compression ratio (CR) of testing for the proposed technique with different samples of ECG signals.

  • Comparing and assessing the performance of the CS technique based on various performance metrics by utilizing the MIT-BIH database.

The organization of this paper is as follows: Section 2 introduces related works by presenting the most recent compression techniques in this field. Section 3 describes the methodology of the proposed technique for the compression of ECG signals. Section 4 demonstrates performance metrics to validate the proposed CS technique. Section 5 introduces the ECG signal acquisition based on IoT nodes and provides the performance evaluation for sending data on IoT systems. The experimental findings are covered in Section 6 with its discussions. The conclusion drawn from this work is presented in Section 7.

2 Related works

In the literature, there are many approaches to compressing ECG signals [16,17,18,19,20]. In [16], Lu et al. introduced an adaption of a sensing matrix to compress ECG signals. Luisa et al. [17] presented a simple CS and hybrid CS, which were used with cluster-based methods. In [18], a method formulated the multiple measurement vectors compressive sensing issue and spreads signals of uplink access across several subcarriers with equalization processing. This method has a sliding window whose set length was calculated via the rate of heartbeats which performed as a comparable piece of work. The window should be small due to the creation of a transmission that is close to real-time. For reconstruction ECG signals with fewer samples, a suitable amount of heartbeats on the window were included [19]. Hassan et al. [20], presented a dynamic CS technique to compress ECG signals. They achieved a high compression ratio (CR) of 16. Petkovski et al. [21], suggested a wavelet transform based on a compression algorithm, namely Set Partitioning In Hierarchical Trees (SPIHT). The coding was applied using several images. The approach was updated to work in a one-dimensional situation to compress ECG data.

The most difficult to solve can be categorized as choosing the appropriate transformations to acquire the sparse signal of the ECG. This sparse signal can be used to ensure the reconstruction of the original signal when the CS approach is applied. The capacity of each modification to reconstruct the sparse ECG signal is what sets them apart from one another [22]. Their good performance in reconstructing the original signal determines the appropriate transformation to be employed in this field of research. Three transformers: wavelet [23], discrete cosine [24], and walsh hadamard [25] are the most common transformation techniques utilized to compress ECG signals. Finally, the proposed curvelet transform produces efficient results compared to previous studies presented in this literature. The CS technique is described in detail in the parts that follow, along with examples of how well it works. The analysis of the results is presented based on the CT transformation which is the best technique for extracting the sparse ECG signal. A. Cuk et al. [26] presented a method for parkinson’s disease detection which was based on long-short term memory neural networks with tuning attention. In [27], A. Minic et al. proposed recurrent neural networks for anomaly detection in electrocardiogram sensor data.

3 Methodology

The compressive sensing (CS) technique is implemented to compress ECG signals based on curvelet transform. The proposed CS technique is selected due to its much less memory storage, higher data transmission rate, and many times less power consumption. One of the advantages of the CS is the reduction of the sampling rate for sparse signals which have many zero coefficients. Also, the CS performs a reconstruction of ECG signals with the removal of noise.

3.1 The proposed CS technique

Figure 2 shows the flowchart of the CS technique. This technique is applied to an ECG signal for compression and recovery. As shown in this flowchart, there are three steps for recovery and three steps for compressing. For recovery, the first step is loading the ECG signal, while the second step is selecting the level of the signal. The third step is applying the curvelet transform to determine the ECG signal’s sparsity. The optimum number for the threshold value is 58.19 mV, while the selected ECG is a single signal. For compressing steps, the first step entails the CS technique on the sparse ECG signal, while the second step is the quantizing of the signal’s sampled values. The third step is that the quantized values must be encoded. The encoding algorithm which applied is the run length encoding (RLE). This algorithm is proposed to reduce the time complexity and computations of ECG signals. RLE is a lossless compression technique in which a sequence of redundant data i.e., “1, 0”. This sequence represents repeated data into the ECG signal and how many times the sequence appears in the ECG signal. The used data is passed to the last compression stage and can be thought of as having entered the reconstruction stage. The recovery stage, which follows the compression stage in reverse order, is likewise depicted in Fig. 2. The compressed data is subjected to a decoding method in the first recovery stage. Dequantizing data in order to acquire the sparse signal is the second step. In the third stage, the sparse signal, which is thought of as the rebuilt ECG signal is subjected to an inverse curvelet. This flowchart effectively summarized the suggested technique. The impact of the proposed curvelet to acquire the sparse ECG signal.

Fig. 2
figure 2

Flowchart of the proposed CS technique

3.2 Analysis of the proposed curvelet transformation

Curvelet is a transform utilized in a line or super-plane singularities [28]. Consider a f(X1, X2) as a particular signal in two dimensions, and Continuous Curvelet Transform (CCT) represented by CCTf (A,B,\(\theta\)) in realtime R2 is calculated using Eq. (1) [28].

$${CCT}_f\left(A,B,\theta\right)=\int_{R^2}\psi_{A,B,\theta}(X_1,X_2).f\left(X_1,X_2\right)dX_1{dX}_2$$
(1)

Equation (2) [28] is used to describe the curvelet \({\psi}_{A, B, \theta }\)in 2-D as a function of the wavelet in 1-D.

$${\psi}_{A, B, \theta }\left({X}_{1}, {X}_{2}\right)= {A}^{{~}^{-1}\!\left/ \!{~}_{2}\right.} \ \psi\left(\frac{{X}_{1 }cos\theta +{X}_{2} sin\theta -B}{A}\right)$$
(2)

Equation (2) describes a wavelet in terms of an angle, taking into account that \(X_1\text{cos}\left(\theta\right)+X_2\text{sin}\left(\theta\right)\)= C, where C is a constant, while Eq. (3) [28] describes the Continuous Wavelet Transform (CWT).

$${CWT}_{f}\left({A}_{1}, {A}_{2}, {B}_{1}, {B}_{2}\right)=\int_{R^2}^{ }{\psi}_{\left({A}_{1}, {A}_{2}, {B}_{1},{B}_{2}\right)}\left({X}_{1}, {X}_{2}\right).f\left({X}_{1}, {X}_{2}\right) d{X}_{1} d{X}_{2}$$
(3)

Equation (4) shows the wavelet in 2-D as a multiplication of 1-D wavelet which described in Eq. (5) [28, 29].

$${\psi}_{\left({A}_{1}, {A}_{2}, {B}_{1}, {B}_{2}\right)}\left(X\right)={\psi}_{{A}_{1}, {B}_{1}}\left({X}_{1}\right){. \psi}_{{A}_{2}, {B}_{2}}\left({X}_{2}\right)$$
(4)
$${\psi}_{A, B}\left({X}_{1}\right)= {A}^{{~}^{-1}\!\left/ \!{~}_{2}\right.} \ \psi\left(\frac{t-A}{B}\right)$$
(5)

Where δ is Dirac delta function. The radon transform (RT) represented by Rf(θ,t) can be viewed as a 2-D wavelet transform that has been applied to the RT segments.

$${R}_{f}\left(\theta , t\right)= \int_{R^2}^{ }f\left({X}_{1}, {X}_{2}\right). \delta \left({X}_{1}cos\theta + {X}_{1 }sin\theta -t\right) d{X}_{1} d{X}_{2}$$
(6)

The ECG signal is transformed into a sparse signal using Eq. (7). Then, this sparse signal can be applied to CS technique. The continuous ridgelet transform (CRT) represented by \({ CRT}_{f}\left(A, \text{B}, \theta \right)\)in Eq. (7) is comparable to the 2-D CWT in Eq. (3).

$${ CRT}_{f}\left(A, B, \theta \right)= {A}^{{~}^{-1}\!\left/ \!{~}_{2}\right.}\int_{R}{ } \ \psi\left(\frac{t-B}{A}\right).\;{R}_{f}\left(\theta , t\right) dt$$
(7)

4 Performance metrics

In general, compression ratio (CR), percentage root mean difference (PRD), peak signal-to-noise ratio (PSNR), and mean squared error (MSE) are metrics utilized to evaluate the performance of compressed signals. These metrics are used as execution levels to approve this work and assess its merit in the target field. As a result, these metrics are briefly discussed in the next sub-sections.

4.1 Compression Ratio (CR)

The degree of compression achieved and the quality of the reconstructed signal can both be evaluated using specific performance assessment measures. The PRD, MSE, PSNR, and CR are some significant metrics that are frequently used [29, 30].

$$CR=\frac{Bit \ Rate \ of \ Orignal \ ECG \ Signal}{Bit \ Rate \ of \ Compressed \ ECG \ Signal}$$
(8)

4.2 Percentage Root Mean Difference (%PRD)

By measuring the difference error between a reconstructed signal \(\widehat{\text{x}}\) and an original signal x, the %PRD ensures the accuracy of the reconstruction.

$$\%PRD= \frac{x-\widehat{x}}{x} \times 100$$
(9)

4.3 Peak Signal-to-Noise Ratio (PSNR)

PSNR is calculated in terms of the mean square error with the square of a maximum value of the signal. Equation (10) presents the PSNR in dB.

$$PSNR= 10 \ {log}_{10}\frac{{\left({max}_{I}\right)}^{2}}{MSE}$$
(10)

4.4 Mean squared Error (MSE)

MSE is calculated based on the difference among the predicted value \({\widehat{\varvec{y}}}_{\left(\varvec{i}\right)}\) and the actual value \({\varvec{y}}_{\left(\varvec{i}\right)}\). Equation (11) shows the MSE metric.

$$MSE= {({y}_{\left(i\right)}-{\widehat{y}}_{\left(i\right)})}^{2}$$
(11)

Additionally, there are several other metrics to take into account to classify ECG signals as shown in Eqs. from (12) to (18) [31,32,33]. These metrics depend on many statistics such as True Positive (TrPos), True Negative (TrNeg), False Positive (FaPos), False Negative (FaNeg), Positive Predictive Value (PPV), and Negative Predictive Value (NPV).

$$Accuracy= \frac{TrPos+TrNeg}{TrPos+TrNeg+FaPos+FaNeg}$$
(12)
$$Precision= \frac{TrPos}{TrPos+FaPos}$$
(13)
$$Sensitivity= \frac{TrPos}{TrPos+FaNeg}$$
(14)
$$Specificity= \frac{TrNeg}{TrNeg+FaPos}$$
(15)
$$Recall= \frac{TrPos}{TrPos+FaNeg}$$
(16)
$$PPV=\frac{TrPos}{TrPos+FaPos}$$
(17)
$$NPV=\frac{TrNeg}{TrNeg+FaNeg }$$
(18)

5 ECG signal acquisition based on IoT nodes

Assuming that each IoT node in a wireless sensor network (WSN) can gather an associated electrocardiogram signal, which is frequently observed in biomedical networks. In order to achieve a point-reliable signal or knowledge recovery, the archived signal is used as the signal source in the simulation and is collected from the MIT/BIH database. Seven actual electrocardiogram signals with diverse alterations of objects are taken into consideration. For different compressed reconstruction algorithms, we alter the condition of the recovery accuracy and recovery rate [34,35,36]. It goes without saying that, if k is appropriately selected, the signals are completely rebuilt. However, the number of samples is significantly less than the Nyquist rate. This scheme can reduce the power consumption and communication hundreds over all networks for real-time observation using WSNs or IoT. Table 1 illustrates samples of the utilized ECG datasets with a reconstructed evaluation. The results of extensive performance are presented to show how well the utilized signal reconstruction software will function in WSNs or IoT. To see the important components of the proposed CS rule, a modest, low-power IoT network is initially implemented to gather ECG signals. The evaluation of an enormous IoT system demonstrates the quantifiability of the decentralized rule.

Table 1 The parameters of the utilized ECG datasets with a reconstructed evaluation

The tokenish M in the conducted experiments is 256. This tokenistic value is relaxed to 384 for obtaining a large number of dependent results. It means that only 18.75% of the primary information must be transmitted over a WSN in order for the primary signal to be successfully recovered. This condition results in a 91.35% reduction in the communication load across the WSN. In order to compare the three recovery algorithms “GPSR, LASSO, OMP” in addition to the planned ACSAR algorithm, we tested these algorithms on a 2048-bit graphical record signal (chfdbchf1). In order to find the best solution to demonstrate a quick and accurate response for knowledge with a group of sparseness building, such as an image or continuous signals, the GPSR is designed for bound-constrained optimization. The most popular l1 step-down in atomic number 55, known as LASSO, functions well under a wide range of situations. The effectiveness of the OMP has been shown to be crucial to determine a solution to the problem of an overly detailed illustration. The representation of the electrocardiogram signal has 1,974 keys less than 0.5, and the original electrocardiogram signal (chfdbchf1) has a size of 2,048. Figure 3 illustrated the original signal. The recovered ECG signals are created by the three recovery algorithms in compressed sensing reconstruction. These algorithms are compared in Fig. 4a, b, and c. Figure 4d displays the produced electrocardiogram signal by the ACSAR algorithm. Figure 4a, b, and c show the average reconstructed noise that is 0.3883, 0.2634, and 0.3239, for GPSR, LASSO, and OMP, respectively. The ACSAR reconstructed noise is shown in Fig. 4d; its value of 0.0878. It is clear that the predicted reconstructed algorithm offers a more accurate evaluation than the GPSR, LASSO, and OMP.

Fig. 3
figure 3

Original ECG Signal

Fig. 4
figure 4

ECG reconstructed signals with GPSR, LASSO, OMP, and ACSAR (k = 74, M = 512)

6 Results and discussions

Figures 5, 6, 7 and 8 illustrate the CR versus the number of samples for healthy and sick people. Figures 9, 10, 11 and 12 show the PRD with the number of samples of healthy and unwell people. The results of the proposed work are compared to other compression techniques in previous published studies [7, 8, 10, 16, 17]. According to experimental findings, the utilized ECG signals are smoothed away from line discontinuities and represented very well by the curvelet transform. Through suggested optimization processes, the ECG is re-architected with high accuracy by applying a small number of data that are characterized as a sparse signal. Accordingly, it is demonstrated that CS-based ECG compression outperforms its DWT-based cousin in terms of superior reconstruction quality. For compressing ECG signals, the curvelet transform is the best choice due to the curvelet transform having a non-stationary property and being confined. Finally, the MIT-BIH database is selected for the ECG signal testing. The implementation of the proposed technique using MATLAB software.

Fig. 5
figure 5

Effect of increasing sample size on CR for normal people at record 100

Fig. 6
figure 6

Effect of increasing sample size on CR for normal people at record 105

Fig. 7
figure 7

Effect of increasing sample size on CR for normal people at record 420

Fig. 8
figure 8

Effect of increasing sample size on CR for normal people at record 425

Fig. 9
figure 9

Effect of increasing sample size on CR for normal people at record 100

Fig. 10
figure 10

Effect of increasing sample size on CR for normal people at record 105

Fig. 11
figure 11

Effect of increasing samples number on PRD for patient persons at record 420

Fig. 12
figure 12

Effect of increasing samples on PRD for patient persons at record 425

The simulation results show that CR in the suggested way produced fantastic outcomes. As a result, the CS technique is currently related to biomedical engineering. It encourages scholars to adopt this strategy as a superior one for this type of search, as well. This fact is illustrated in Figs. 6, 7 and 8, and 9. These statistics also show that an increase in the number of samples causes the CR to rise.

The PRD for the suggested approach has acceptable values, as shown in Fig. 11. The proposed CS outperforms the two most recent strategies in the same search domain in terms of PRD values for various sample sizes. These two methods used the DWT to obtain the sparse ECG signal. However, the suggested CS method employed the curvelet transform. The identical simulation is carried out for the patient people in the next figures.

The proposed CS technique is suitable to achieve the least amount of distortion between the original ECG signal and the reconstructed signal, as shown in Figs. 9, 10 and 11, and 12. This makes the CS technique robust for medical and IoT applications. Table 2; Fig. 13 illustrate comparisons between the proposed technique and previous studies in terms of performance metrics.

Table 2 Comparisons of the performance metrics for the previous studies and the proposed work
Fig. 13
figure 13

Comparisons between the proposed CS technique and previous studies in terms of performance metrics

7 Conclusion

In this paper, a compressive sensing (CS) technique is applied to compress ECG signals toward medical applications. This technique achieves a high compression ratio of the ECG signals with high quality reconstruction. The proposed CS achieved a PRD of 2.0 and a CR of 15.7. One limitation of proposed work is that the CS requires costly hardware to process ECG signals. Further, a curvelet transform (CT) is implemented to analyze the performance of the compression. Results demonstrate that the proposed CT achieved better performance based on the metrics of CR, PRD, PSNR, and MSE. The results illustrate that the proposed CT is superior than discrete wavelet transform (DWT). A DWT technique in previous works is compared to the CS technique, which is based on extracting sparse signals of ECG with the CT. Four signal processing algorithms “GPSR, LASSO, OMP, and ACSAR” are used to compare the CS technique. In future work, various compression techniques could be applied to other biomedical signals to improve their performance. Also, one could use different evaluation metrics and datasets to assess the performance of the CS technique.