**4.2 PCG signal filtering**

The proposed morphological approach for noise suppression and detection of heart murmurs from the PCG signal was tested from the Pascal Classifying Heart Sound Challenge [49].

*Mathematical Morphology and the Heart Signals DOI: http://dx.doi.org/10.5772/intechopen.104113*

**Figure 12**, shows a noisy signal that has been filtered by the morphological filter. This filter uses two successive operators including closing and opening.

These operators are combined with a single structuring element *B* to suppress noise. For this, the selection of the shape and size of *B* is very important so as not to distort the information of the signal.

In this context, the length *L* of *B* is *0.15\*Fs* and the sampling frequency *Fs = 8000 Hz*, so we get *L = 1200*.

It depends on the duration of heart sounds S1 and S2 which are basic frequency (0.1–0.15) second, (70–0.14) ms, respectively.

After noise suppression, the next step is heart murmur suppression. It uses an average filter, which is combined with a structuring element *B*.

Knowing that heart murmurs are a frequency content above 100 Hz. Starting from this hypothesis, the length *L* of *B = 0.15\*f,* f = 100 Hz then we obtain that *L =* 15.

**Figure 13** below shows heart murmur suppression.

#### **4.3 ECG signal wave detections**

The proposed morphological approach for detecting the beginnings and endings of QRS complexes, the T wave and the P wave of the ECG signal were tested from the MIT-BIH arrhythmia database.

**Figure 13.** *Murmurs detection of PCG signal.*

**Figure 14.** *Detection results (record 102).*

**Figure 15.** *Detection results (record 103).*

#### **Figure 16.**

*Detection results (record 113).*

For each (filtered) ECG input signal, the following procedures were performed:

(a) pre-processing the ECG signal; (b) detecting the RR heart rate by the morphological filter; (c) detection of the T wave by maxima of the erosion operator; (d) detection of the Q and S waves of the ECG signal by the closure operator; (e) the detection of the P wave is detected by the opening operator with a multi-scale structuring element.

**Figures 14** to **16** illustrate the results obtained on three different recording representing different morphologies where the power of the morphological transformation algorithm is clearly shown.
