A real-time detection method and system for electrocardiogram signal adaptive R wave
By preprocessing and wavelet decomposition of the body surface electrocardiogram signal, combined with threshold calculation and effectiveness judgment, the problem of inaccurate R wave detection in the prior art is solved, and the accurate identification and real-time detection of abnormal R waves are realized, thereby improving the improvement of the improvement of the The accuracy and reliability of electrocardiogram diagnosis.
Patent Information
- Application Number
- CN202010339268.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-04-26
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2040-04-26
AI Technical Summary
Existing R-wave detection algorithms are difficult to accurately identify R-waves in abnormal electrocardiograms, and the R-wave shape and amplitude are not fixed, resulting in poor diagnostic results.
Adaptive R-wave real-time detection method of ECG signals, the original ECG waveform data on the body surface is preprocessed, real-time detection and effectiveness judgment, update detection parameters, and combine wavelet decomposition and threshold calculation to improve detection accuracy and reliability. sex.
It realizes accurate identification of abnormal R waves, reduces noise interference, improves detection accuracy and reliability, and is suitable for real-time electrocardiogram analysis.
Smart Images

Figure CN113558631B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of electrocardiogram signal processing, and in particular to an electrocardiogram signal adaptive R-wave real-time detection method and system. Background Art
[0002] Normal cardiac electrical activity begins with the sinoatrial node, from which impulses are sent down through the channels of this special conduction system, successively exciting the atria and ventricles, causing the heart to contract and perform the function of pumping blood. This orderly transmission of electrical excitement will cause a series of potential changes, forming the corresponding waveform on the electrocardiogram. At present, the diagnosis of heart disease in the field of cardiac electrophysiology is based on the surface electrocardiogram and the intracardiac electrocardiogram, and the detection of R waves in the surface electrocardiogram is the basis of all diagnosis and discrimination.
[0003] Existing R wave detection algorithms, such as differential method, slope method, wavelet decomposition method, etc., have good detection results for standard R waves, but most R waves in abnormal electrocardiograms cannot be correctly identified.
[0004] Therefore, there is an urgent need for a method that can automatically adjust the real-time detection parameters of the R wave to solve problems such as the unstable shape and amplitude of the R wave. Summary of the invention
[0005] The purpose of the present invention is to provide an electrocardiogram signal adaptive R-wave real-time detection method and system to address the problem that the prior art cannot accurately identify the R-wave in an abnormal electrocardiogram.
[0006] In order to achieve the above object, the technical solution adopted by the present invention is:
[0007] A method for real-time detection of R waves of an electrocardiogram signal adaptively comprises the following steps;
[0008] S1: pre-processing the collected original surface ECG waveform data and outputting high-frequency data;
[0009] S2: According to the detection threshold and the preset R wave detection step W 2 detecting R waves in the high frequency data in real time;
[0010] S3: After detecting the R wave, judging its validity, outputting the validity judgment result of the current detected R wave, and continuing the R wave detection;
[0011] In the validity judgment, if the detected R wave is valid, the detection parameters are updated and the R wave position and R wave characteristic data are output. The present invention detects the R wave in real time through preprocessing, real-time detection and validity judgment steps, and updates the detection parameters according to the results of the real-time detection, so that the detection of the R wave is more accurate and effective, and the present invention can continuously optimize the detection parameters in practical applications, close to the characteristics of the R wave detected in real time, and more accurately and effectively identify abnormal R waves.
[0012] As a preferred embodiment of the present invention, step S1 includes the following process:
[0013] S11: input original ECG waveform data;
[0014] S12: removing baseline drift from the original ECG waveform data through a high-pass filter and removing high-frequency noise signals through a low-pass filter, and performing power frequency filtering processing using a power frequency filtering algorithm;
[0015] S13: The original ECG waveform data after filtering is subjected to wavelet decomposition through two wavelet functions of different scales, and high-frequency data is output. The present invention performs corresponding preprocessing on the original ECG waveform data, wherein the wavelet transform has a multi-resolution characteristic, and the characteristic that the position of each frequency component on the time axis remains unchanged after the transformation. For a short-term rapidly changing non-periodic signal, the frequency domain characteristics can be obtained while retaining its time domain characteristics. It is very suitable for R wave feature extraction, and is used in combination with filtering processing to effectively eliminate noise and other interference, reduce the difficulty of detection and make the detection data more accurate.
[0016] As a preferred embodiment of the present invention, the detection parameters include a detection threshold, an amplitude threshold and an RR interval mean, and the R wave characteristic data include a high frequency data maximum value, an R wave amplitude and an RR interval time.
[0017] As a preferred solution of the present invention, the step of obtaining the detection threshold in step S2 is:
[0018] S21: By obtaining the maximum value V of the high frequency data in the most recent time period max , and according to the formula T max =α*V max Calculate the initial threshold T max , output the initial detection threshold β 1 *T max , where α and β 1 All are preset coefficients;
[0019] S22: According to the initial threshold T maxDetecting R waves in the high-frequency data with a preset threshold detection step length W, obtaining the number of R waves in the time period, and calculating the heart rate and RR interval according to the detected R wave position and the number of R waves;
[0020] S23: Detect whether the heart rate is within the normal range and whether the absolute value of the difference between the RR interval and the mean RR interval is less than a preset value. If the conditions are met, the initial threshold T max If the condition is not met, the initial detection threshold is output and step S2 is entered. If the condition is not met, step S21 is repeated. The present invention greatly improves the reliability of the initial threshold and the accuracy of subsequent detection by threshold calculation and threshold validity judgment.
[0021] As a preferred embodiment of the present invention, the validity determination in step S3 includes the following steps:
[0022] S31: Amplitude detection: obtaining the amplitude of the high-frequency data and performing a preliminary comparison with a preset amplitude threshold. If the high-frequency data is greater than or equal to the amplitude threshold, continuing to perform the validity judgment step. If the high-frequency data is less than the amplitude threshold, the R wave is invalid and the R wave is re-detected.
[0023] S32: Calculating R wave characteristic data in the high frequency data;
[0024] S33: Compare the R wave characteristic data with the historical mean, and when the difference is less than γ 1 When , the R wave position and the R wave characteristic data are output, and the historical mean is updated; wherein the γ 1 is a preset value, and the historical mean is the average value of the R wave characteristic data of the most recent 10 R waves in the historical data. The present invention avoids the influence caused by interference from other factors by judging the effectiveness of the detected R wave and entering the historical data, thereby improving the reliability of the detected R wave. At the same time, the continuous updating of the detection data also greatly reduces the difficulty of subsequent detection and improves the accuracy of subsequent detection, making the method of the present invention more effective and reliable.
[0025] As a preferred solution of the present invention, when no R wave is detected in step S2 within a detection cycle, the detection parameters are cleared and step S21 is executed, and the detection cycle is a preset value.
[0026] As a preferred solution of the present invention, the step S2 will skip an invalid cycle of the R wave detection process after detecting the R wave, so as to skip the refractory period and reduce the amount of processing calculations. The invalid cycle is preset according to the refractory period of the target position.
[0027] As a preferred solution of the present invention, step S4 is further included, and step S4 is performed synchronously with step S2, for judging the stability of the heart rate at a preset update period, and updating the detection parameters according to the result of the judgment of the stability of the heart rate, and the judgment of the stability of the heart rate includes the following steps:
[0028] Calculate the cycle variance of the RR interval in the update cycle. If the cycle variance is less than the preset cycle variance threshold, determine that the heart rate is stable, and update the detection threshold, the RR interval mean and the amplitude threshold. The updating method is to calculate the average value of the existing detection parameters and the R wave characteristic data in the update cycle.
[0029] An electrocardiogram signal adaptive R-wave real-time detection system, comprising an acquisition module, a preprocessing module, a wavelet processing module, a threshold calculation module, a real-time detection module and a validity judgment module;
[0030] The acquisition module is used to collect raw ECG waveform data from the body surface; the preprocessing module is electrically connected to the acquisition module and is used to preprocess the raw ECG waveform data; the wavelet processing module is electrically connected to the preprocessing module and is used to perform wavelet decomposition on the raw ECG waveform data after preprocessing, and output high-frequency data with prominent R-wave characteristics to the threshold calculation module; the threshold calculation module is electrically connected to the wavelet processing module and is used to perform threshold calculation processing on the high-frequency data; the real-time detection module is electrically connected to the threshold calculation module and is used to detect the R wave; the validity judgment module is used to detect whether the R wave is valid and output the detection result.
[0031] As a preferred solution of the present invention, it also includes a periodic update module and an amplitude calculation module; the periodic update module is electrically connected to the real-time detection module and is used to update the detection data; the amplitude calculation module is arranged in the validity judgment module and is used to calculate the amplitude of the input data.
[0032] In summary, due to the adoption of the above technical solution, the beneficial effects of the present invention are:
[0033] 1. The present invention performs real-time detection of R waves through preprocessing, real-time detection and effectiveness judgment steps, and updates the detection parameters according to the results of real-time detection, so that the detection of R waves is more accurate and effective. It also enables the present invention to continuously optimize the detection parameters in practical applications, closely follow the characteristics of the R waves detected in real time, and more accurately and effectively identify abnormal R waves.
[0034] 2. The present invention performs corresponding preprocessing on the original ECG waveform data, wherein the wavelet transform has a multi-resolution characteristic and the characteristic that the position of each frequency component on the time axis remains unchanged after the transformation. For short-term rapidly changing non-periodic signals, the frequency domain characteristics can be obtained while retaining their time domain characteristics. It is very suitable for R-wave feature extraction. When used in combination with filtering processing, it effectively eliminates noise and other interference, reduces the difficulty of detection and makes the detection data more accurate.
[0035] 3. The present invention greatly improves the reliability of the initial threshold value through threshold calculation and threshold validity judgment, and also greatly improves the accuracy of subsequent detection of the present invention.
[0036] 4. The present invention avoids the influence caused by interference from other factors by judging the validity of the detected R wave and entering historical data, thereby improving the reliability of the detected R wave. At the same time, continuously updating the detection data also greatly reduces the difficulty of subsequent detection and improves the accuracy of subsequent detection, making the method of the present invention more effective and reliable.
[0037] 5. The present invention skips 11 acquisition cycles after detecting the R wave to achieve the effect of skipping the refractory period, thereby reducing the amount of processing calculations. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 It is a flow chart of a method for real-time R-wave adaptive detection of an electrocardiogram signal as described in Example 1 of the present invention.
[0039] Figure 2 It is a flow chart of a method for real-time R-wave adaptive detection of an electrocardiogram signal as described in Example 2 of the present invention.
[0040] Figure 3 It is a structural schematic diagram of an electrocardiogram signal adaptive R-wave real-time detection system described in Example 4 of the present invention.
[0041] Figure 4 It is a schematic diagram of the wavelet decomposition process of the wavelet decomposition module of the electrocardiogram signal adaptive R-wave real-time detection system described in Example 4 of the present invention. DETAILED DESCRIPTION
[0042] The present invention will be described in detail below in conjunction with the accompanying drawings.
[0043] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0044] Example 1
[0045] like Figure 1 As shown, a real-time detection method of R wave of an electrocardiogram signal adaptively comprises the following steps;
[0046] S1: pre-processing the collected original surface ECG waveform data and outputting high-frequency data;
[0047] S2: According to the detection threshold and the preset R wave detection step W 2 detecting R waves in the high frequency data in real time;
[0048] S3: After detecting the R wave, judging its validity, outputting the validity judgment result of the current detected R wave, and continuing the R wave detection;
[0049] In the validity judgment, if the detected R wave is valid, the detection parameters are updated and the R wave position and R wave characteristic data are output.
[0050] The detection parameters include a detection threshold, an amplitude threshold and an RR interval mean, and the R wave characteristic data include a high frequency data maximum value, an R wave amplitude and an RR interval time.
[0051] Example 2
[0052] like Figure 2 As shown, the difference between this embodiment and embodiment 1 is that this embodiment also includes wavelet transformation, threshold value calculation and periodic update process, including the following steps:
[0053] a) Preprocessing: collecting raw ECG waveform data from the body surface through hardware equipment, and preprocessing the raw ECG waveform data.
[0054] b) Wavelet transformation: The original ECG waveform data preprocessed in step a is subjected to wavelet decomposition through two wavelet functions of different scales, and high-frequency data with prominent R-wave features is output.
[0055] c) Threshold calculation: Perform threshold calculation processing on the high-frequency data to obtain an initial threshold, and output the initial threshold and R-wave characteristic data; the R-wave characteristic data includes the maximum value of the high-frequency data and the RR interval time.
[0056] d) Real-time detection: setting detection parameters according to the initial threshold and R-wave characteristic data, and detecting the R-wave in real time; after detecting the R-wave, judging its validity, and outputting the valid judgment result of the currently detected R-wave; if the R-wave is valid, recording the R-wave characteristic data and outputting the R-wave position and R-wave characteristic data.
[0057] e) Periodic update: Data is stored with the real-time RR interval as the storage period, and the heart rate stability is judged. If the heart rate is stable, the detection data is updated.
[0058] Wherein, step a includes the following process:
[0059] a1) Collecting original ECG waveform data and outputting the original ECG waveform data.
[0060] a2) After removing the baseline drift from the original ECG waveform data through a high-pass filter and removing the high-frequency noise signal through a low-pass filter, the original ECG waveform data is subjected to power frequency filtering processing using a power frequency filtering algorithm, and the pre-processed original ECG waveform data is output.
[0061] The step c comprises the following steps:
[0062] c1) Obtain the high-frequency data of the most recent time period and obtain the maximum value V of the high-frequency data max , according to the formula T max =α*V max Calculate the initial threshold T max , wherein the time period is a preset parameter, α is a preset coefficient, and satisfies 0.5<α<0.9; the time period is taken in the range of [4000ms-6000ms].
[0063] c2) according to the initial threshold T max Detecting R waves in the high-frequency data with a preset threshold detection step length W, obtaining the number of R waves in the time period, and calculating the RR interval and heart rate according to the detected R wave position and number;
[0064] If the initial threshold is calculated, it is considered that the calculation is completed. Otherwise, the input data will continue to be updated and recalculated after 1 second until the initial threshold is successfully calculated.
[0065] c3) Determine whether the calculated value meets the condition: the heart rate meets [35, 300] and the RR interval difference is less than 32ms. If the condition is met, output the initial threshold value T max And R wave characteristic data and enter step d. If the conditions are not met, enter step a.
[0066] The step e is performed simultaneously with the step d, and includes the following steps:
[0067] e1) Using the real-time RR interval as the storage period, when the number of storage times reaches 3, proceed to step e2.
[0068] e2) Determination of heart rate stability: Calculate the cycle variance of the RR interval in the storage cycle. If the cycle variance is less than the preset cycle variance threshold, determine that the heart rate is stable, update the detection threshold, the RR interval mean and the amplitude threshold, clear the storage times and enter step e1.
[0069] Example 3
[0070] The difference between this embodiment and embodiment 2 is that step d satisfies the following steps:
[0071] d1) According to the initial threshold T max Set the detection threshold and input data with a collection period of 16ms;
[0072] When the product of the input times and the acquisition period of 16ms is greater than 3 times the RR interval average, proceed to step c; the RR interval average is the average of the most recent 10 RR intervals in the historical data;
[0073] When the number of inputs is greater than 11 and the product of the number of inputs and the acquisition period 16 ms is less than 3 times the average RR interval, the real-time detection data is output and the process goes to step d2.
[0074] d2) Use R wave to detect step length W 2 Detecting the amplitude of the real-time detection data and comparing it with a preset amplitude threshold;
[0075] When the amplitude is greater than or equal to the amplitude threshold, proceed to step d3;
[0076] When the amplitude is less than the amplitude threshold, the process goes to step d1.
[0077] d3) performing wavelet decomposition on the real-time detection data to obtain high-frequency data, and comparing the product of the input number and the acquisition period 16 ms with the mean of the RR interval;
[0078] If the product is greater than or equal to the RR interval mean, proceed to step d4;
[0079] If the product is less than the RR interval mean, go to step d5.
[0080] d4) Using the preset validity detection step length W 3 Find the maximum value of the high frequency data, set the detection threshold = 90% detection threshold; and compare the maximum value with 75% of the detection threshold; wherein the step length W 3 Less than the step size W 2 ;
[0081] If the maximum value is greater than or equal to 75% of the detection threshold, it is determined that the R wave is detected, and the R wave characteristic data in the real-time detection data is calculated; and the R wave characteristic data is compared with the historical mean. When the difference is less than 30% of the historical mean, the R wave position and the R wave characteristic data are output and the R wave characteristic data is entered into the historical data, and the process goes to step d6; the historical mean is the average value of the R wave characteristic data of the most recent 10 R waves in the historical data;
[0082] If the maximum value is less than 75% of the detection threshold, it is determined that no R wave is detected, and the process goes to step d1;
[0083] The detection window t of step d1 1 The detection window t of step d4 2 are all preset values and satisfy t 2 =10t 1 .
[0084] d5) obtaining the maximum value of the data of the two most recent acquisition cycles in the high-frequency data, and comparing the maximum value with 85% of the detection threshold;
[0085] If the maximum value is greater than or equal to 85% of the detection threshold, it is determined that the R wave is detected, and the R wave characteristic data in the real-time detection data is calculated; and the R wave characteristic data is compared with the historical mean value. When the difference value is less than 30% of the historical mean value, the R wave position and the R wave characteristic data are output and the R wave characteristic data is entered into the historical data for updating, and the process proceeds to step d6;
[0086] If the maximum value is less than 85% of the detection threshold, it is determined that the R wave is not detected and the process goes to step d1.
[0087] d6) setting the input times to zero, entering step d1 and skipping the subsequent 11 consecutive acquisition cycles, not inputting data, and only accumulating the input times, so as to skip the refractory period and reduce the amount of processing calculations.
[0088] Example 4
[0089] like Figure 3 As shown, an electrocardiogram signal adaptive R-wave real-time detection system includes an acquisition module, a preprocessing module, a wavelet processing module, a threshold calculation module, a real-time detection module and a periodic update module.
[0090] The present invention collects surface ECG waveform data through an acquisition module, and after amplification and filtering, pre-processes the data through a pre-processing module to remove baseline drift and noise signals in the signal. The processed signal is input into a wavelet transform module to extract the R wave characteristic signal in the signal; the extracted R wave characteristic signal is input into an automatic threshold module for threshold calculation to obtain an initial threshold. Through the initial threshold, the real-time detection module performs real-time R wave detection and updates the detection threshold in real time, and then performs validity judgment to determine whether the detection result is an R wave, outputs the R wave position and R wave characteristic data, and inputs the detection result into an automatic cycle calculation module to obtain the signal ECG cycle and R wave amplitude.
[0091] Preprocessing module: The data is passed through a high-pass filter to remove baseline drift and a low-pass filter to remove high-frequency noise signals. The power frequency filtering algorithm is then used to perform power frequency filtering. The processed data is passed to the wavelet transform module.
[0092] Wavelet transform module: using designed wavelet function The inner product of the signal x(t) to be analyzed at two different scales is:
[0093] in, is the wavelet function The equivalent frequency domain representation of the function after displacement τ and scale a is: Among them, W x (a,τ) is the wavelet coefficient, X(ω), They are x(t), The above two formulas show that wavelet transform can be regarded as the Fourier transform of the basic frequency characteristics. The bandpass filter filters the heart rate at different scales a. The signal x(t) is filtered by the basic wavelet Binary expansion (take a = 2 j ,j=1,2,3… and binary translation (meaning each move ) can be used to form an odd function, and then we can get the binary discrete wavelet transform of the signal, that is, wavelet decomposition.
[0094] Decomposition process such as Figure 4 As shown, S is the original ECG waveform data, A1, A2, and A3 are low-frequency parts, which maintain the approximate waveform of the original signal, that is, approximate signals; D1, D2, and D3 are high-frequency parts, which highlight the detailed features of the signal, that is, detailed signals.
[0095] After preprocessing, the signal is decomposed by wavelet functions of two different scales to obtain the high-frequency part that highlights the R-wave characteristics, and the input threshold calculation data cache containing the R-wave characteristic signal and the real-time detection data cache will be obtained.
[0096] Threshold calculation module: Get the maximum value V of the input data cache max , threshold calculation initial threshold T max =T max =α*V max , search the data in the input data cache with a certain step length W, and use the initial threshold T maxCheck, when the first R wave is detected, update the threshold and record the position to skip the refractory period length (120-180ms), continue searching, and when the second R wave is detected, make a validity judgment. If the R wave is invalid, continue searching. If it is valid, calculate the cycle, update the threshold, record the original waveform characteristics of the R wave and the characteristics after wavelet decomposition, and output the initial threshold T max If the threshold value is calculated three times in a row and the results are all invalid, the threshold value, period, amplitude and other information are cleared and the initial threshold value is calculated again.
[0097] Real-time detection module: The real-time detection module also includes an amplitude calculation module and a validity judgment module; the real-time detection module obtains the initial threshold value T max Then, use the R wave to detect the step length W 2 is the time interval, β 1 *T max is the threshold value, t 1 The detection window size is milliseconds to detect R waves, and the refractory period and amplitude validity are added as pre-detection screening to reduce the amount of calculation. The RR interval mean is used as a reference standard to determine the size relationship between the detected period and the RR interval mean. When it is less than the RR interval mean, β 2 *T max The threshold is used as the detection standard. When it is greater than or equal to the mean of the RR interval, β 3 *T max The threshold is used as the detection standard, t 2 The detection window size in milliseconds is used to detect R waves, expressed in W. 3 As the step size, reduce the initial threshold T max 10% of the previous cycle mean (the minimum value shall not be less than half of the previous cycle mean). When no R wave is detected during the average of three consecutive RR intervals, the threshold, cycle, amplitude and other information are cleared and the initial threshold calculation is performed again. 1 ≥10, β 1 , β 2 , β 3 Satisfy 0.9>β 1 >β 1 >β 1 >0.5,t 2 =10t 1 , the step length W 3 Less than the step size W 2 .
[0098] Amplitude calculation module: When the real-time detection module detects an R wave, the original waveform amplitude of the detected R wave is calculated, and the amplitude of the prominent R wave characteristic signal data obtained by two-scale wavelet decomposition is calculated, and the obtained R wave characteristic data is passed to the validity judgment module.
[0099] Validity judgment module: The result obtained by the amplitude calculation module is compared with the R wave characteristics obtained by threshold calculation. If the characteristic difference is greater than the preset threshold γ, it is considered that the detected waveform is not an R wave. If the difference is less than the preset threshold γ, the R wave related characteristic parameters and thresholds are updated, where γ takes values in [0.6, 0.8].
[0100] Cycle update module: records n consecutive RR intervals, calculates the variance of the recorded cycles, and when the variance is less than the set threshold T, inputs the n RR interval length cache data into the threshold module, and then updates the cycle record cache, threshold record cache, and R wave feature record cache, where n is taken in [3,5].
[0101] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A real-time R-wave detection method for an electrocardiogram signal, characterized in that: The steps include: S1: pre-processing the collected original surface ECG waveform data and outputting high-frequency data; S2: Detecting the R wave in the high-frequency data in real time according to the detection threshold and the preset R wave detection step W2; S3: After detecting the R wave, judging its validity, outputting the validity judgment result of the current detected R wave, and continuing the R wave detection; In the validity judgment, if the detected R wave is valid, the detection parameters are updated and the R wave position and R wave characteristic data are output; the detection parameters include the detection threshold, the amplitude threshold and the RR interval mean, and the R wave characteristic data includes the maximum value of the high frequency data, the R wave amplitude and the RR interval time; The steps for obtaining the detection threshold are as follows: S21: by obtaining the maximum value V of the high frequency data in the most recent time period max , and according to the formula T max =α*V max Calculate the initial threshold T max , output the initial detection threshold β1*T max , where α and β1 are preset coefficients; S22: According to the initial threshold T max Detecting R waves in the high-frequency data with a preset threshold detection step length W, obtaining the number of R waves in the time period, and calculating the heart rate and RR interval according to the detected R wave position and the number of R waves; S23: Detect whether the heart rate is within the normal range and whether the absolute value of the difference between the RR interval and the mean RR interval is less than a preset value. If the conditions are met, the initial threshold T max If the condition is not met, the initial detection threshold is output and the process goes to step S2. If the condition is not met, the process goes to step S21 again. The validity judgment comprises the following steps: S31: Amplitude detection: obtaining the amplitude of the high-frequency data and performing a preliminary comparison with a preset amplitude threshold. If the high-frequency data is greater than or equal to the amplitude threshold, continuing to perform the validity judgment step. If the high-frequency data is less than the amplitude threshold, the R wave is invalid and the R wave is re-detected. S32: Calculating R wave characteristic data in the high frequency data; S33: Compare the R wave characteristic data with the historical mean, and when the difference is less than γ1, output the R wave position and the R wave characteristic data, and update the historical mean; wherein γ1 is a preset value, and the historical mean is the average value of the R wave characteristic data of the most recent 10 R waves in the historical data.
2. The method for real-time R wave detection of an electrocardiogram signal according to claim 1, characterized in that: Step S1 includes the following process: S11: input original ECG waveform data; S12: removing baseline drift from the original ECG waveform data through a high-pass filter and removing high-frequency noise signals through a low-pass filter, and performing power frequency filtering processing using a power frequency filtering algorithm; S13: performing wavelet decomposition on the filtered original ECG waveform data through two wavelet functions of different scales to output high-frequency data.
3. The method for real-time R wave detection of an electrocardiogram signal according to claim 1, characterized in that: When no R wave is detected in step S2 during a detection cycle, the detection parameters are cleared and step S21 is executed, and the detection cycle is a preset value.
4. The method for real-time R wave detection of an electrocardiogram signal according to claim 1, characterized in that: After detecting the R wave, step S2 will skip an invalid cycle of the R wave detection process, which is used to skip the refractory period and reduce the amount of processing calculations. The invalid cycle is preset according to the refractory period of the target position.
5. The method for self-adaptive real-time detection of R waves of an electrocardiogram signal according to claim 4, characterized in that: The method further includes step S4, which is performed synchronously with step S2 and is used to determine the stability of the heart rate at a preset update period and to update the detection parameters according to the result of the determination of the stability of the heart rate. The determination of the stability of the heart rate includes the following steps: Calculate the cycle variance of the RR interval in the update cycle. If the cycle variance is less than the preset cycle variance threshold, determine that the heart rate is stable, and update the detection threshold, the RR interval mean and the amplitude threshold. The updating method is to calculate the average value of the existing detection parameters and the R wave characteristic data in the update cycle.
6. An electrocardiogram signal adaptive R-wave real-time detection system, characterized in that: The system adopts an electrocardiogram signal adaptive R-wave real-time detection method as described in any one of claims 1 to 5, including an acquisition module, a preprocessing module, a wavelet processing module, a threshold calculation module, a real-time detection module and a validity judgment module; The acquisition module is used to collect original ECG waveform data from the body surface; The preprocessing module is electrically connected to the acquisition module and is used to preprocess the original ECG waveform data; the wavelet processing module is electrically connected to the preprocessing module and is used to perform wavelet decomposition on the preprocessed original ECG waveform data and output high-frequency data with prominent R-wave characteristics to the threshold calculation module; the threshold calculation module is electrically connected to the wavelet processing module and is used to perform threshold calculation processing on the high-frequency data; the real-time detection module is electrically connected to the threshold calculation module and is used to detect the R wave; the validity judgment module is used to detect whether the R wave is valid and output the detection result.
7. The electrocardiogram signal adaptive R-wave real-time detection system according to claim 6, characterized in that: It also includes a periodic update module and an amplitude calculation module; the periodic update module is electrically connected to the real-time detection module and is used to update the detection data; the amplitude calculation module is arranged in the validity judgment module and is used to calculate the amplitude of the input data.
