A Method for Extracting Electrocardiogram P-Wave Features Based on Curvature
By preprocessing and correcting the ECG signal based on curvature, the accuracy and complexity of P-wave feature extraction are solved, and efficient and flexible P-wave feature extraction and heart rate variability analysis are achieved.
Patent Information
- Application Number
- CN202310467132.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-27
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2043-04-27
AI Technical Summary
In the prior art, the P-wave feature extraction method of ECG has problems such as low accuracy, severe noise interference, complex calculations and limited application range, especially the positioning of the P-wave start point and end point is difficult to accurately extract.
The curvature-based electrocardiogram P-wave feature extraction method is used to pre-process the electrocardiogram signal, and the curvature of the signal waveform is calculated to locate the waveform turning point, the P-wave features are screened using the threshold method and the positioning peak search method, and corrected by the window and maximum method, and finally the PP period sequence is calculated.
It improves the accuracy and flexibility of P-wave feature extraction, has a wide range of application, is simple to calculate and high efficiency, and can accurately extract P-wave feature points from various electrocardiogram signal databases, supporting the analysis of heart rate variability.
Smart Images

Figure CN116439723B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of electrocardiogram feature extraction, and particularly relates to a method for extracting electrocardiogram P-wave features based on curvature. Background Technique
[0002] Cardiovascular diseases have become the biggest killers threatening human life and health. As a most commonly used non-invasive tool for diagnosing heart health, electrocardiogram can be used to screen and diagnose cardiovascular diseases by analyzing its shape, amplitude and duration. Traditional electrocardiogram analysis relies on doctors' experience and judgment, which has the disadvantages of time-consuming, laborious and non-objective. Therefore, the method of using a computer to extract electrocardiogram features and perform electrocardiogram analysis has been more and more widely used. A normal electrocardiogram includes three main characteristic waves, namely P-wave, QRS complex and T-wave. Among them, because the R peak in the QRS complex has the highest amplitude, there are relatively mature feature extraction technologies, and the T-wave feature extraction has also been widely studied. However, the feature extraction of the P-wave is still an unsolved problem so far because of its small amplitude and susceptibility to signal noise.
[0003] The P-wave is the first characteristic wave that appears in a normal electrocardiogram, which records the potential change generated by the excitement of the sinoatrial node causing atrial activation. Under normal circumstances, the duration of the P-wave is 80 to 110 ms, and the amplitude is less than 0.25 mv, which is much smaller than the amplitude of the R-wave peak. Therefore, the P-wave is an electrocardiogram feature wave with low amplitude and low signal-to-noise ratio. The appearance of the P-wave in the electrocardiogram represents the start of a new cardiac cycle. The start of the P-wave indicates the start of the excitement of the sinoatrial node. A cardiac cycle is the time interval from the start of one heartbeat to the start of the next heartbeat, that is, the time interval from the start point of one P-wave to the start point of the next P-wave, which is called the PP interval. However, due to the difficulty in extracting the features of the P-wave, in general applications, the RR interval, which is easier to extract, can only be used to represent the cardiac cycle. Therefore, it is crucial to solve the problem of P-wave feature extraction and obtain the true cardiac cycle, that is, the PP interval.
[0004] There have been some studies on the extraction of P wave features in the ECG. The most commonly used method is to use wavelet transform to extract P wave features [BSOUL AAR, JI SY, WARD K, et al. Detection of P, QRS, and T Components of ECG using wavelet transformation [C]. Complex Medical Engineering, CME. ICME International Conference on Date of Conference: 2009: 1-6.]. However, due to the low amplitude and low signal-to-noise ratio of the P wave, this method is easily affected by the noise in the ECG, the accuracy of feature extraction is insufficient, and the effect is not ideal. There are also many improved methods for extracting P wave features using wavelet transform, such as the wavelet-amplitude-slope based method [Wan Xiangkui, Qin Shuren, Liang Xiaorong, Ding Jianping. A new P wave detection method based on “wavelet-amplitude-slope” [J]. Journal of Biomedical Engineering, 2006, (04): 722-725.] This method introduces amplitude and slope as criteria, which improves the accuracy of P wave feature detection, but still uses a fixed length time window before the start of the QRS wave as the detection interval of the P wave, which is difficult to be universally applicable to ECGs with diverse morphologies. In addition, there are also techniques based on machine learning and deep learning that are used for feature extraction of ECG signals [Ma Jianhong, Duan Hao, Han Ying. A review of research on feature wave segmentation methods in ECG signals [J]. Journal of Zhengzhou University (Science Edition), 2023, 55 (02): 79-87.], but machine learning techniques are generally complex and computationally intensive; deep learning techniques require a large amount of sample data for training, which takes a long time for sample training and is complex to operate, increasing the difficulty of P wave feature extraction. There are also some methods that can only extract the peak point of the P wave [Liu Xiuling, Xiong Peng, Liu Ming, etc. A method for detecting P and T characteristic waves of electrocardiogram signals [P]. Hebei Province: CN111685759A, 2020-09-22.][Pan Min, Ma Yiwen, Zhao Jing. A P wave detection method based on double-density wavelet transform [P]. Zhejiang Province: CN110420022A, 2019-11-08.], which does not mention how to extract the starting and ending points of the P wave, and cannot meet all the needs of P wave feature extraction.
[0005] Therefore, the current feature extraction methods still have many defects, and P-wave feature extraction is still a difficult problem that needs to be solved urgently. Summary of the invention
[0006] In order to overcome the deficiencies of the above-mentioned existing technologies, the object of the present invention is to propose a method for extracting electrocardiogram P-wave features based on curvature. After preprocessing the electrocardiogram signal, the curvature of the signal waveform is calculated to find the waveform turning points in the electrocardiogram. Then, the required electrocardiogram P-wave features are screened out through threshold and peak location methods, and the extracted electrocardiogram P-waves are corrected using windowing and maximum / minimum value methods. Finally, the accurate cardiac cycle sequence of the electrocardiogram, namely the PP cycle sequence, is calculated, and the heart rate variability of the electrocardiogram signal is calculated using the PP cycle sequence. The present invention is an electrocardiogram P-wave feature extraction method based on waveform curvature with high accuracy in feature point extraction, simple calculation, flexible use, wide application range, and can be used in most electrocardiogram signals.
[0007] To achieve the above object, the present invention adopts the following technical solutions:
[0008] An electrocardiogram P-wave feature extraction method based on curvature, characterized in that after preprocessing the electrocardiogram signal, further filtering is performed to extract different feature points, the curvature of the filtered signal is calculated to find the waveform turning points in the electrocardiogram, the R peak is located first through the threshold method, and then based on the R peak, peak location is performed to screen out the required electrocardiogram P-wave features, and the extracted electrocardiogram P-waves are corrected using windowing and maximum / minimum value methods, and finally the accurate cardiac cycle sequence of the electrocardiogram, namely the PP cycle sequence, is calculated.
[0009] The different feature points described above include the starting point, peak point, and ending point of the P-wave.
[0010] The electrocardiogram P-wave feature extraction method based on curvature is characterized by including the following steps:
[0011] Step 1, preprocess the electrocardiogram signal, perform zero-phase digital filtering on the electrocardiogram signal using a band-pass filter to filter out high-frequency noise and baseline fluctuations in the signal;
[0012] Step 2, extract different feature points: perform further filtering on the electrocardiogram signal at different frequencies, calculate the curvature of the electrocardiogram signal after filtering at different frequencies, perform peak location operations on the obtained curvature map, save the obtained curvature peak results, and mark them on the electrocardiogram signal. Set a threshold to screen out all the curvature peaks representing the R peak of the electrocardiogram. Based on the obtained R peak, perform forward peak location, and extract feature points and save the results according to the order of the appearance positions of different P-wave feature points in the electrocardiogram signal;
[0013] Step 3, open a window around the initially extracted P-wave feature points, and use the maximum / minimum value method to correct the obtained electrocardiogram P-wave feature points to obtain the final P-wave feature extraction results;
[0014] Step 4: Calculate the PP interval sequence of the electrocardiogram using the extracted P-wave starting points, which is the true cardiac cycle sequence of the electrocardiogram signal, and calculate the heart rate variability of the electrocardiogram signal using the PP cycle sequence.
[0015] The specific method of the said Step 2 is as follows:
[0016] 2.1) The electrocardiogram signal further filtered to extract the electrocardiogram signals of the P-wave starting point (Pstart) and peak point (Ppeak) is the filtered electrocardiogram 1, and the electrocardiogram signal further filtered to extract the P-wave ending point (Pend) is the filtered electrocardiogram 2;
[0017] 2.2) Calculate the curvature of the signals of the filtered electrocardiogram 1 and the filtered electrocardiogram 2: First, determine the step size with reference to the sampling frequency of the electrocardiogram: Let the signal sampling frequency be fs; the step size is h, and set the step size h as That is, the step size is the time interval between two adjacent sampling points; after determining the appropriate step size, use the gradient function to calculate the simulated first derivative of the electrocardiogram signal, use the del2 function to calculate the simulated second derivative of the electrocardiogram signal, and combine the curvature calculation formula Calculate the curvature values of each point in the electrocardiogram and draw the electrocardiogram signal curvature diagram;
[0018] 2.3) The peaks in the curvature diagram represent the turning points in the electrocardiogram signal. Perform peak searching on the obtained electrocardiogram signal curvature diagram to obtain the curvature peaks and their corresponding positions, mark the curvature peaks on the preprocessed electrocardiogram, determine the threshold required to extract the R-peak peak point, that is, any value within the electrocardiogram that is greater than the values of the other turning points and less than the amplitude value of the R-peak point, and retain the turning points with values above the threshold as the R-peak point;
[0019] 2.4) After obtaining the position of the R-peak among the turning points of the electrocardiogram, perform P-wave feature extraction: Extract the P-wave starting point and peak point from the curvature peak sequence obtained by calculating the curvature of the filtered electrocardiogram 1 signal. Based on the position of the R-peak peak point in the curvature peak sequence, search for peaks forward to find the P-wave starting point and peak point; Extract the P-wave ending point from the curvature peak sequence obtained by calculating the curvature of the filtered electrocardiogram 2 signal. Based on the position of the R-peak peak in this sequence, search for peaks forward to obtain the P-wave ending point, and complete the extraction of all P-wave feature points.
[0020] The specific method of the said Step 3 is as follows:
[0021] Use the method of windowing to find the maximum and minimum values to correct the small errors existing in the initially extracted P-wave feature points:
[0022] 3.1) Correct the result of P-wave onset extraction. Window before and after the initially extracted P-wave onset point to obtain the minimum values within the two windows. Denote the minimum value obtained by windowing forward as X1, and the minimum value obtained by windowing backward as X2. Calculate the difference X = |X1 - X2| between the minimum values within the two windows. Then set a threshold on the amplitude of the P-wave peak point. After observing the feature points with inaccurate positioning, set the threshold within the range of 1 / 2 to 1 / 4 of the P-wave peak amplitude. Compare the difference X with the set threshold. If X is less than the threshold, select the minimum value point X2 obtained by windowing backward from the initially extracted P-wave feature point; if X is greater than the threshold, select the minimum value point X1 obtained by windowing forward from the initially extracted P-wave feature point.
[0023] 3.2) Correct the result of P-wave peak point extraction. Window near the initially extracted P-wave feature point. With the value of the initially extracted P-wave feature point as the center of the window, find the maximum value within the window range and save the corrected result.
[0024] 3.3) Correct the result of P-wave termination point extraction. Use the method of windowing to find the minimum value to correct the minor error existing in the initially extracted P-wave termination point. Window before and after the initially extracted P-wave feature point to obtain the minimum values within the two windows. Denote the minimum value obtained by windowing forward as X1, and the minimum value obtained by windowing backward as X2. Calculate the difference X = |X1 - X2| between the minimum values within the two windows. Then set a threshold on the amplitude of the P-wave peak point. The threshold is set within the range of 1 / 2 to 1 / 4 of the P-wave peak amplitude. Compare the difference X with this threshold. Compare the difference X with the set threshold. If X is less than the threshold, select the minimum value point X1 obtained by windowing forward from the initial value; if X is greater than the threshold, select the minimum value point X2 obtained by windowing backward from the initial value.
[0025] The specific method of step 4 is as follows: The cardiac cycle (PP cycle) of the electrocardiogram signal refers to the duration of each heartbeat, that is, the time interval from the P-wave onset point of one heartbeat to the P-wave onset point of the next heartbeat:
[0026] PP(i) = Pstart(i + 1) - Pstart(i)
[0027] On the basis of obtaining the P-wave onset point sequence of the electrocardiogram signal through processing steps 1 to 3, calculate the time difference between adjacent two P-wave onset points to obtain the PP cycle sequence of the electrocardiogram, and perform time-domain, frequency-domain, and non-linear analyses on the PP cycle respectively using the heart rate variability analysis method.
[0028] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0029] After preprocessing the electrocardiogram (ECG) signals, the present invention calculates the curvature of the signal waveforms to find the waveform turning points in the electrocardiogram. Then, the required ECG P-wave features are screened out by means of threshold and peak localization. The extracted ECG P-waves are corrected by windowing and the maximum / minimum value method. Finally, the accurate cardiac cycle sequence of the electrocardiogram, namely the PP cycle sequence, is calculated, and the heart rate variability of the ECG signal is calculated using the PP cycle sequence. Compared with other ECG P-wave feature extraction methods, it has the following advantages:
[0030] First: The method of using curvature to extract ECG P-wave features has high accuracy. Through preprocessing, most of the high-frequency noise and baseline fluctuations in the ECG signal are filtered out, avoiding the influence of noise on the accuracy of feature extraction. Also, through curvature peak searching and the threshold method, the QRS complex is located first, and then three characteristic points of the P-wave are found by searching for peaks forward with the R peak as the reference, reducing the positioning error. Finally, the correction of P-wave feature positioning is carried out by windowing and the maximum / minimum value method, further improving the accuracy of P-wave feature point extraction. Therefore, through these three parts of operations, the accuracy and precision of P-wave features in the extraction process are guaranteed.
[0031] Second: The method for extracting ECG P-wave features is simple to operate and has a small computational load. Compared with machine learning methods with huge computational loads and complex methods, and deep learning methods that require a large number of data samples for training, which are time-consuming and laborious, this method can extract the ECG P-wave features through relatively simple operations, without the need for a large amount of calculation, has low requirements for computer equipment, and has a short feature extraction time and high efficiency.
[0032] Third: The method for extracting ECG P-wave features has high flexibility and can extract all the characteristic points of the P-wave as needed. This method can flexibly adjust the parameters for extracting P-wave features, and extract the starting point, ending point, and peak point of the P-wave respectively. Compared with some other methods that can only extract the peak features of the P-wave, this method can meet all the characteristic information needs of P-wave analysis.
[0033] Fourth: The method for extracting ECG P-wave features has a wide range of applications and has been verified in multiple ECG signal databases. This method has been experimented in the MIT-BIH normal ECG database, BLOCK DATA ECG database, ECG data with autonomic nerve activation, and ECG data with noise stimulation, and the results of P-wave feature extraction are all accurate. It can be seen that this method is not only applicable in normal ECG databases, but also applicable in ECG data collected under some special circumstances, with a very wide range of applications.
[0034] Fifth: The method for extracting ECG P-wave features uses the extracted P-wave feature values for the next step of calculation and analysis, obtains the true cardiac cycle (PP cycle) sequence, and further obtains the time-domain and frequency-domain indexes of heart rate variability for relevant analysis of heart health. Brief Description of the Drawings
[0035] Figure 1 is an example of a normal electrocardiogram.
[0036] Figure 2 are the waveform characteristics of the electrocardiogram signal before processing.
[0037] Figure 3 is the electrocardiogram waveform after filtering.
[0038] Figure 4 are the positions of the peak point and the starting point of the P wave in the filtered electrocardiogram 1.
[0039] Figure 5 is the position of the termination point of the P wave in the filtered electrocardiogram 2.
[0040] Figure 6 is the process of calculating the curvature of the electrocardiogram.
[0041] Figure 7 is the result of peak seeking in the curvature map of the filtered electrocardiogram 1.
[0042] Figure 8 is the result of peak seeking in the curvature map of the filtered electrocardiogram 2.
[0043] Figure 9 is the process of extracting the characteristic points of the P wave in the electrocardiogram.
[0044] Figure 10 is the extraction result of the peak point of the R wave.
[0045] Figure 11 is the extraction result of all the characteristic points of the P wave in the electrocardiogram.
[0046] Figure 12 is the flow chart for correcting the initially extracted P wave characteristic points by the maximum and minimum value method.
[0047] Figure 13 is the extraction result of the corrected starting point of the P wave.
[0048] Figure 14 is the extraction result of the corrected peak point of the P wave.
[0049] Figure 15 is the extraction result of the corrected termination point of the P wave.
[0050] Figure 16 is the process of extracting the P wave characteristics of the electrocardiogram using curvature. Detailed Description of the Invention
[0051] The present invention will be further described in detail below with reference to the accompanying drawings.
[0052] A method for extracting P wave characteristics of an electrocardiogram based on curvature, see Figure 16, the specific steps include:
[0053] Step 1, preprocess the electrocardiogram (ECG) signal. Analyze according to the quality of the electrocardiogram, and select a Butterworth band-pass filter to filter the ECG signal to filter out the high-frequency noise and the fluctuations in the baseline part of the signal.
[0054] As a physiological electrical signal, the ECG signal has characteristics such as weakness, low frequency, and high impedance, and is extremely vulnerable to interference from different sources, which affects the signal quality. As shown in the appendix, Figure 2 the ECG signal has a lot of noise before processing, and the waveform features are difficult to identify in the ECG signal. Therefore, before extracting the features of the P wave in the ECG signal, the ECG signal should be preprocessed first to reduce the influence of noise interference and baseline drift on the extraction of feature points.
[0055] According to the characteristics of the ECG signal, a Butterworth band-pass filter is selected to filter the signal. The order of the Butterworth filter is selected as 3, and the band-pass filtering frequency is set to 0.5 - 45 Hz to filter out the high-frequency noise and power frequency interference of the ECG signal. The filtfilt function in MATLAB is used to implement zero-phase digital filtering. This function is often used for zero-phase filtering of the ECG signal, which helps to accurately retain the position of the features in the filtered waveform in the position of the unfiltered signal. As shown in the appendix, Figure 3 after filtering, compared with the original electrocardiogram, the high-frequency components of the electrocardiogram are reduced, the tiny fluctuations in the baseline part are significantly reduced, the signal quality is improved, and the position information of the feature points of the ECG signal is still accurate.
[0056] Step 2, further filter the ECG signal at different frequencies to extract the P wave feature points. Calculate the curvature of the ECG signal after filtering at different frequencies, perform peak searching on the obtained curvature map, save the curvature peak sequence, set a threshold to extract the R peak, and search for peaks forward based on the obtained R peak to extract the P wave feature points and save the results.
[0057] 2.1) Extract different feature points Pstart, Ppeak, and Pend from the preprocessed ECG signal. For the extraction requirements of different feature points, select different frequencies to filter the ECG signal and save the filtering results of the ECG signal at different frequencies for extracting different feature points.
[0058] The filtering frequency for further low-pass filtering of the electrocardiogram (ECG) signal to extract the P-wave starting point and peak point is set at 15 - 25 Hz. The ECG signal obtained by low-pass filtering at a frequency of 15 - 25 Hz is called filtered ECG 1. The filtering frequency for further low-pass filtering of the ECG signal to extract the P-wave termination point is set at 5 - 10 Hz. The ECG signal obtained by low-pass filtering at a frequency of 5 - 10 Hz is called filtered ECG 2. The filtered ECG 1 and filtered ECG 2 are respectively compared with the pre-primarily processed ECG signal. The comparison results are as shown in Appendix Figure 4 and Appendix Figure 5 It can be seen that the positions of the P-wave peak point and starting point in the filtered ECG 1 and the position of the P-wave termination point in the filtered ECG 2 are all turning points at fixed positions before the R peak. The R peak can be located first, and then the required P-wave characteristic points can be searched forward. Using this rule, subsequent operations are carried out.
[0059] 2.2) Calculate the curvature of the ECG signal after filtering at different frequencies, perform peak searching operations on the obtained signal curvature diagram, and save all the obtained peak results. Each curvature peak in the ECG curvature diagram corresponds to a turn in the ECG signal;
[0060] Curvature, in a general sense, refers to the degree of bending of a curve or surface. In a two-dimensional plane, if an arc with two infinitely close points on a continuous and smooth curve as endpoints is regarded as an arc on a certain circle, then the radius of this circle is defined as the curvature radius of the curve at this point, and the curvature is defined as the reciprocal of the curvature radius. Thus, the flatter the curve, the larger the radius of this circle and the smaller the curvature; the more curved the curve, the smaller the radius of this circle and the larger the curvature.
[0061] Generally speaking, calculating the curvature at a certain point of a curve is determined by calculating the curvature of the osculating circle at that point. For a continuous curve, the curvature formula is:
[0062]
[0063] Although the electrocardiogram appears to be a continuous curve, in fact, the ECG signal is a time series composed of discrete points. Therefore, when calculating the curvature of the ECG signal, direct differentiation cannot be used, and a numerical simulation method should be adopted:
[0064] Determine the step size with reference to the sampling frequency of the electrocardiogram: Let the signal sampling frequency be fs; the step size is h, and the step size h is set to That is, the step size is the time interval between two adjacent sampling points; for calculating the curvature of the electrocardiogram, if the step size is too short, the calculated curvature results will be too messy to extract useful information, and if the step size is too long, some useful information of the electrocardiogram features will be lost. After determining the appropriate step size according to the electrocardiogram signal, the present invention uses the gradient function in MATLAB to calculate the simulated first derivative of the electrocardiogram signal, uses the del2 function in MATLAB to calculate the simulated second derivative of the electrocardiogram signal, and combines the curvature calculation formula
[0065]
[0066] to calculate the curvature values of each point in the electrocardiogram and draw the curvature diagram of the electrocardiogram signal. The process of electrocardiogram curvature calculation is as shown in the appendix Figure 6 as follows
[0067] For the electrocardiogram signals that have undergone different frequency filtering operations to extract different electrocardiogram P-wave features, namely filtered electrocardiogram 1 and filtered electrocardiogram 2, both are operated according to the above curvature calculation method to obtain the curvature diagrams of the electrocardiogram signals for extracting different P-wave features;
[0068] Perform peak searching on the previously calculated electrocardiogram curvature diagrams: each turning point in the electrocardiogram signal will be represented as a peak in the curvature diagram. Use the findpeaks function in MATLAB to perform peak searching on the obtained electrocardiogram curvature diagram to obtain all the peaks and their corresponding positions in the curvature diagram, and save the peak searching results, that is, all the turning points in the electrocardiogram signal are obtained. Mark the extracted turning points on the preprocessed electrocardiogram, as shown in the appendix Figure 7 and the appendix Figure 8 are the peak searching results of the curvature diagrams of the electrocardiogram signals with the above different filtering frequencies. It can be seen that the peak searching operation for curvature has a high accuracy in extracting the turning points of the electrocardiogram, and all the required electrocardiogram P-wave feature points are included in the turning point sequence
[0069] 2.3) Mark the curvature peak sequences calculated from the electrocardiogram signals filtered at different frequencies on their respective electrocardiogram signals. Since the peak value of the R peak in the electrocardiogram is much higher than that of other wave peaks, the peak point of the R peak is the one with the largest amplitude among all waveform features, and it is also the most easily extracted feature point that is not easily disturbed by noise. Set a threshold to extract the curvature peak point representing the R peak of the electrocardiogram and its position information in the curvature peak sequence
[0070] First, it is necessary to observe the preprocessed electrocardiogram (ECG) signal to determine the threshold required for extracting the peak points of the R wave. The threshold is set to any value greater than the values of the remaining turning points in the electrocardiogram and less than the amplitude value of the R peak point. Points with values above the threshold are retained in the curvature peak sequence, and their position information in the turning point sequence is recorded, thereby extracting the R wave and obtaining the position of the R peak value in the turning point sequence, so as to subsequently locate the required P wave characteristic points based on this position. The extraction result of the R peak peak point is as shown in the example Figure 10 as shown
[0071] 2.4) In the curvature peak sequence calculated after filtering at different frequencies, taking the obtained R wave as a reference, search for peaks forward. According to the order of the appearance positions of different P wave characteristic points in the ECG signal, the required P wave characteristic points of the electrocardiogram are screened out, different characteristic points are extracted, and the results are saved. The overall feature extraction process is as shown in the appendix Figure 9 as shown
[0072] Extraction of the P wave starting point: It is carried out in the curvature peak sequence obtained by calculating the curvature of the filtered ECG 1 signal. As shown in the appendix Figure 4 as shown, the P wave starting point in the filtered ECG 1 is the curvature peak point at a fixed position before the R peak. Taking the position of the R peak peak point in this sequence as a reference, search for peaks forward in the curvature peak sequence of the ECG filtered 1, thereby obtaining the time point when the P wave starting point of the electrocardiogram appears in the ECG signal and completing the extraction of the P wave starting point feature;
[0073] Extraction of the P wave peak point: It is carried out in the curvature peak sequence obtained by calculating the curvature of the filtered ECG 1 signal. As shown in the appendix Figure 4 as shown, the P wave peak point in the filtered ECG 1 is the curvature peak point at a fixed position before the R peak. Taking the position of the R peak peak point in this sequence as a reference, search for peaks forward in the curvature peak sequence of the ECG filtered 1, thereby obtaining the time point when the P wave peak point of the electrocardiogram appears in the ECG signal and completing the extraction of the P wave peak point feature;
[0074] Extraction of the termination point of the P wave: It is carried out in the curvature peak sequence obtained by calculating the curvature of the filtered ECG 2 signal. As shown in the appendix Figure 5 as shown, the P wave termination point in the filtered ECG 2 is the curvature peak point at a fixed position before the R peak. Taking the position of the R peak peak point in this sequence as a reference, search for peaks forward in the curvature peak sequence of the ECG filtered 2, thereby obtaining the time point when the P wave termination point of the electrocardiogram appears in the ECG signal and completing the extraction of the P wave termination point feature;
[0075] Thus, all the characteristic points of the P wave in the electrocardiogram are extracted, and the feature extraction result is as shown in the appendix Figure 11As shown, most of the P-wave characteristic points are accurately located, and only a few characteristic points have slightly deviated extraction results. Therefore, the following feature correction module is required to further correct the extraction positions of the electrocardiogram P-wave characteristic points.
[0076] Step 3: Window around the initially extracted P-wave characteristic points, and use the maximum and minimum value method to correct the obtained electrocardiogram P-wave characteristic points to obtain the final P-wave feature extraction results.
[0077] In some cases, there are small errors in several points among the electrocardiogram P-wave characteristic points extracted by the above modules. Therefore, for the small errors existing in the initially extracted P-wave characteristic points, they need to be corrected. Since the characteristic points of the P-wave are the inflection points of its electrocardiogram characteristic waveform and are generally the maximum and minimum values within a certain range nearby, the maximum and minimum value method is selected to correct the initially extracted P-wave characteristic points. The specific operation process is as follows Figure 12 As shown, the correction methods for different P-wave characteristic points are slightly different due to their characteristics, but the overall idea is to use the method of windowing to find the maximum and minimum values for feature point correction.
[0078] 3.1) Correct the extraction result of the P-wave starting point. After analyzing the positioning error, it is found that most of the errors are that the extraction point is before the real characteristic point, and a small part of the errors are that the extraction point is after the real characteristic point. Therefore, the correction of the P-wave starting point cannot simply be windowing to find the minimum value, but windows should be opened before and after the initially extracted P-wave characteristic point. The window sizes before and after are generally set at 10 - 30 ms. Find the minimum values in the two windows respectively. The minimum value obtained by windowing forward is denoted as X1, and the minimum value obtained by windowing backward is denoted as X2. Calculate the difference X = |X1 - X2| of the minimum values in the two windows, and then set a threshold, which is set in the range of 1 / 2 - 1 / 4 of the amplitude at the P-wave peak. Compare the difference X with the set threshold. If X is less than the threshold, select the minimum value point X2 obtained by windowing backward from the initially extracted P-wave characteristic point; if X is greater than the threshold, select the minimum value point X1 obtained by windowing forward from the initial value as the corrected P-wave starting point. The effect after correcting the P-wave starting point is as follows Figure 13 As shown, it can be seen that the previous error of the P-wave starting point is corrected after passing through the correction module, and the extraction accuracy of the P-wave starting point is further improved.
[0079] 3.2) Correct the extraction result of the P-wave peak point. Since the peak value of the P-wave is the maximum value within its nearby range and is less affected by the baseline fluctuation, only window around the originally extracted value, with the extracted feature value as the center of the window. The window size is generally set at 10 - 40 ms. Find the maximum value within the window range and save the corrected result. The correction effect of the P-wave peak point is as follows Figure 14As shown, the positioning of the P-wave peak point after correction is more accurate.
[0080] 3.3) Correct the extraction result of the P-wave termination point. The correction method is roughly similar to that of the P-wave starting point. The minimum value obtained by windowing forward is denoted as X1, and the minimum value obtained by windowing backward is denoted as X2. Calculate the difference X = |X1 - X2| between the minimum values in the two windows. Then set a threshold, which is set within the range of 1 / 2 to 1 / 4 of the amplitude at the P-wave peak. Compare the difference X with the set threshold. The difference from the correction method of the P-wave starting point is that if X is less than the threshold, select the minimum value point X1 obtained by windowing forward from the initial value; if X is greater than the threshold, select the minimum value point X2 obtained by windowing backward from the initial value as the corrected P-wave termination point. The extraction result of the corrected P-wave termination point is as shown in the appendix Figure 15 As shown, some individual positioning errors that existed before have been corrected, and the positioning of the P-wave termination point is more accurate.
[0081] The extraction of the electrocardiogram P-wave characteristics has been completed up to this step. The final extraction result of the electrocardiogram P-wave characteristics is very accurate, and it does not require a large amount of complex calculations. The method is simple and feasible, and it is also relatively flexible for the extraction of P-wave characteristic points. Individual or all electrocardiogram P-wave characteristic points can be extracted separately according to needs.
[0082] Step 4: Use the extracted P-wave starting point to obtain the PP interval sequence of the electrocardiogram, that is, the real electrocardiogram cardiac cycle sequence, and calculate the heart rate variability of the electrocardiogram signal using the PP cycle sequence;
[0083] The cardiac cycle (PP cycle) of the electrocardiogram signal refers to the duration of each heartbeat, which is the time interval from the start of one heartbeat to the start of the next heartbeat, that is, the time interval from the P-wave starting point in one heartbeat to the P-wave starting point in the next heartbeat:
[0084] PP(i) = Pstart(i + 1) - Pstart(i)
[0085] After obtaining the P-wave starting point sequence of the electrocardiogram signal through the above several modules, according to the above principle, the time difference between two adjacent P-wave starting points can be calculated to obtain the PP cycle sequence of the electrocardiogram.
[0086] Previously, the cardiac cycle sequences used to calculate heart rate variability were all RR cycle sequences. After obtaining the PP cycle sequence of the electrocardiogram signal through this method, the existing heart rate variability analysis methods can be used to perform time-domain, frequency-domain, and non-linear analyses on the PP cycles respectively to obtain the corresponding heart rate variability indexes.
[0087] (1) Time-domain analysis
[0088] The time-domain analysis of heart rate variability, as the name implies, analyzes the law of heart rate changes from the perspective of the time domain. Commonly used indicators include SDNN, RMSSD, pNN50, etc.;
[0089] SDNN: Standard deviation of the cardiac cycle;
[0090] RMSSD: Root mean square of the differences between adjacent cardiac cycles;
[0091] pNN50: Percentage of the differences between adjacent cardiac cycles greater than 50 ms;
[0092] (2) Frequency-domain analysis
[0093] The frequency-domain analysis of heart rate variability analyzes the law of heart rate changes from another perspective, that is, the perspective of spectral analysis;
[0094] The frequency-domain analysis method is to perform a fast Fourier transform (FFT) or an autoregressive parameter model method (AR) operation on a sequence of PP intervals, and then analyze the obtained power spectrum diagram. The most commonly used indicators are HF, LF, and LF / HF;
[0095] HF power: Absolute power of the low-frequency band (0.15–0.4 Hz);
[0096] LF power: Absolute power of the low-frequency band (0.04–0.15 Hz);
[0097] LF / HF: Ratio of low-frequency to high-frequency power.
[0098] (3) Nonlinear analysis
[0099] Poincare plot: That is, the scatter plot of PP intervals. The abscissa of the plot is the i-th PP cycle, and the ordinate is the (i + 1)-th PP cycle.
[0100] As can be seen from the embodiments and the accompanying drawings, compared with the prior art, the present invention first locates the QRS complex through curvature peak finding and threshold method, and then finds three characteristic points of the P wave by seeking peaks forward with the R peak as the reference, reducing the positioning error; finally, the correction of the P wave feature positioning is carried out through windowing and extreme value method, further improving the accuracy of the extraction of P wave characteristic points;
[0101] Using curvature to extract the characteristics of the electrocardiogram P wave can extract the characteristics of the electrocardiogram P wave without a large amount of calculation, with low requirements for computer equipment, and short time and high efficiency for feature extraction;
[0102] Using the PP interval sequence obtained after feature extraction, the time-domain, frequency-domain, and nonlinear indicators of heart rate variability can be further obtained for relevant analysis of cardiac health.
Claims
1. A method for extracting electrocardiogram P-wave features based on curvature, characterized in that After preprocessing the electrocardiogram (ECG) signal, further filtering is performed to extract different feature points. The curvature of the filtered signal is calculated to find the waveform turning points in the ECG. The R peak is located first by the threshold method, and then based on the R peak, the peak search is carried out to screen out the required P wave features of the ECG. The extracted P wave of the ECG is corrected using the windowing and extreme value method. Finally, the accurate cardiac cycle sequence of the ECG, that is, the PP cycle sequence, is calculated. The different feature points include the starting point, peak point, and ending point of the P wave. The method for extracting P wave features of the ECG based on curvature includes the following steps: Step 1: Preprocess the ECG signal. Use a band-pass filter to perform zero-phase digital filtering on the ECG signal to filter out the high-frequency noise and the fluctuations in the baseline part of the signal. Step 2: Extract different feature points. Further filter the ECG signal at different frequencies, calculate the curvature of the ECG signal after filtering at different frequencies, perform peak search on the obtained curvature graph of the ECG signal, save the obtained curvature peak results, and mark them on the ECG signal. Set a threshold to screen out all the curvature peaks representing the R peak of the ECG. Based on the obtained R peak, perform peak search forward. According to the sequence of the appearance positions of different P wave feature points in the ECG signal, extract the feature points and save the results. Step 3: Open a window around the initially extracted P wave feature points, and use the extreme value method to correct the obtained P wave feature points of the ECG to obtain the final P wave feature extraction results. Step 4: Use the extracted starting point of the P wave to calculate the cardiac cycle sequence of the ECG, that is, the PP cycle sequence, and calculate the heart rate variability of the ECG signal using the PP cycle sequence.
2. The method for extracting electrocardiogram P wave features based on curvature according to claim 1, wherein The specific method of Step 2 is as follows: 2.1) The ECG signal obtained by further filtering to extract the ECG signal of the starting point (Pstart) and peak point (Ppeak) of the P wave is the filtered ECG 1, and the ECG signal obtained by further filtering to extract the ECG signal of the ending point (Pend) of the P wave is the filtered ECG 2. 2.2) Calculate the curvature of the signals for Filtered ECG 1 and Filtered ECG 2: First, determine the step size with reference to the sampling frequency of the electrocardiogram: Let the signal sampling frequency be fs; the step size is h, and the step size h is set to , that is, the step size is the time interval between two adjacent sampling points; after determining the appropriate step size, use the gradient function to calculate the simulated first derivative of the ECG signal, use the del2 function to calculate the simulated second derivative of the ECG signal, and combine the curvature calculation formula to calculate the curvature values of each point in the electrocardiogram and draw the curvature diagram of the ECG signal; 2.3) The peak in the curvature graph of the ECG signal represents the turning point in the ECG signal. Perform peak search on the obtained curvature graph of the ECG signal to obtain the curvature peak and its corresponding position. Mark the curvature peak on the preprocessed ECG. Determine the threshold required to extract the peak point of the R peak, that is, any value within the range greater than the values of the other turning points and less than the amplitude value of the R peak point in the ECG. Retain the turning points with values above the threshold as the R peak points. 2.4) After obtaining the position of the R peak among the turning points of the ECG, perform P wave feature extraction. Extract the starting point and peak point of the P wave from the curvature peak sequence obtained by calculating the curvature of the filtered ECG 1 signal. Based on the position of the R peak point in the curvature peak sequence, perform peak search forward to find the starting point and peak point of the P wave. Extract the ending point of the P wave from the curvature peak sequence obtained by calculating the curvature of the filtered ECG 2 signal. Based on the position of the R peak in this sequence, perform peak search forward to obtain the ending point of the P wave, and complete the extraction of all P wave feature points.
3. A method for extracting electrocardiogram P-wave features based on curvature according to claim 1, characterized in that, The specific method of Step 3 is as follows: Use the windowing and extreme value method to correct the small errors existing in the initially extracted P wave feature points. 3.1) Correct the result of P wave starting point extraction. Open windows before and after the initially extracted P wave starting point respectively to obtain the minimum values within the two windows. Denote the minimum value obtained by opening the window forward as X1, and the minimum value obtained by opening the window backward as X2. Calculate the difference X = |X1 - X2| between the minimum values within the two windows. Then set a threshold on the amplitude of the P wave peak point. After observing individual feature points with inaccurate positioning, set the threshold within the range of 1 / 2 to 1 / 4 of the P wave peak amplitude. Compare the difference X with the set threshold. If X is less than the threshold, select the minimum value point X2 obtained by opening the window backward from the initially extracted P wave feature point; if X is greater than the threshold, select the minimum value point X1 obtained by opening the window forward from the initially extracted P wave feature point. 3.2) Correct the result of P wave peak point extraction. Open a window near the initially extracted P wave feature point. Take the value of the initially extracted P wave feature point as the center of the window, find the maximum value within the window range, and save the corrected result. 3.3) Correct the result of P wave ending point extraction. Use the window opening and maximum / minimum value method to correct the small errors existing in the initially extracted P wave ending point. Open windows before and after the initially extracted P wave feature point respectively to obtain the minimum values within the two windows. Denote the minimum value obtained by opening the window forward as X1, and the minimum value obtained by opening the window backward as X2. Calculate the difference X = |X1 - X2| between the minimum values within the two windows. Then set a threshold on the amplitude of the P wave peak point. The threshold is set within the range of 1 / 2 to 1 / 4 of the P wave peak amplitude. Compare the difference X with this threshold. Compare the difference X with the set threshold. If X is less than the threshold, select the minimum value point X1 obtained by opening the window forward from the initial value; if X is greater than the threshold, select the minimum value point X2 obtained by opening the window backward from the initial value.
4. A method for extracting electrocardiogram P-wave features based on curvature according to claim 1, characterized in that, The specific method of step 4 is as follows: The cardiac cycle of the electrocardiogram signal, that is, the PP cycle, refers to the duration of each heartbeat, that is, the time interval from the P wave starting point in one heartbeat to the P wave starting point in the next heartbeat; Based on the P wave starting point sequence of the electrocardiogram signal obtained by processing through steps 1 to 4, calculate the time difference between adjacent two P wave starting points to obtain the PP cycle sequence of the electrocardiogram, and perform time domain, frequency domain, and non-linear analysis on the PP cycle respectively using the heart rate variability analysis method.
Citation Information
Patent Citations
P-wave detection method based on double density wavelet transform
CN110420022A
Method for detecting P and T characteristic waves of electrocardiosignal
CN111685759A
Method for determining P wave position of electrocardiosignal and device for realizing method
CN105030228A
Method for combining electrocardiogram with respiration to calculate heart rate variability on basis of EMD decomposition
CN108814579A