[go: up one dir, main page]

CN108836305A - A kind of ECG feature extracting method of fusion Butterworth filtering and wavelet transformation - Google Patents

A kind of ECG feature extracting method of fusion Butterworth filtering and wavelet transformation Download PDF

Info

Publication number
CN108836305A
CN108836305A CN201810429640.2A CN201810429640A CN108836305A CN 108836305 A CN108836305 A CN 108836305A CN 201810429640 A CN201810429640 A CN 201810429640A CN 108836305 A CN108836305 A CN 108836305A
Authority
CN
China
Prior art keywords
wave
ecg
signal
waves
accuracy
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201810429640.2A
Other languages
Chinese (zh)
Other versions
CN108836305B (en
Inventor
郭树理
韩丽娜
陈启明
桂心哲
张祎彤
张禾
刘宏斌
范利
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chinese PLA General Hospital
Beijing Institute of Technology BIT
Original Assignee
Chinese PLA General Hospital
Beijing Institute of Technology BIT
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chinese PLA General Hospital, Beijing Institute of Technology BIT filed Critical Chinese PLA General Hospital
Priority to CN201810429640.2A priority Critical patent/CN108836305B/en
Publication of CN108836305A publication Critical patent/CN108836305A/en
Application granted granted Critical
Publication of CN108836305B publication Critical patent/CN108836305B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • AHUMAN NECESSITIES
    • A61MEDICAL OR VETERINARY SCIENCE; HYGIENE
    • A61BDIAGNOSIS; SURGERY; IDENTIFICATION
    • A61B5/00Measuring for diagnostic purposes; Identification of persons
    • A61B5/24Detecting, measuring or recording bioelectric or biomagnetic signals of the body or parts thereof
    • A61B5/316Modalities, i.e. specific diagnostic methods
    • A61B5/318Heart-related electrical modalities, e.g. electrocardiography [ECG]
    • AHUMAN NECESSITIES
    • A61MEDICAL OR VETERINARY SCIENCE; HYGIENE
    • A61BDIAGNOSIS; SURGERY; IDENTIFICATION
    • A61B5/00Measuring for diagnostic purposes; Identification of persons
    • A61B5/72Signal processing specially adapted for physiological signals or for diagnostic purposes
    • A61B5/7225Details of analogue processing, e.g. isolation amplifier, gain or sensitivity adjustment, filtering, baseline or drift compensation
    • AHUMAN NECESSITIES
    • A61MEDICAL OR VETERINARY SCIENCE; HYGIENE
    • A61BDIAGNOSIS; SURGERY; IDENTIFICATION
    • A61B5/00Measuring for diagnostic purposes; Identification of persons
    • A61B5/72Signal processing specially adapted for physiological signals or for diagnostic purposes
    • A61B5/7235Details of waveform analysis
    • A61B5/725Details of waveform analysis using specific filters therefor, e.g. Kalman or adaptive filters

Landscapes

  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Engineering & Computer Science (AREA)
  • Surgery (AREA)
  • Animal Behavior & Ethology (AREA)
  • Veterinary Medicine (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • Public Health (AREA)
  • Biophysics (AREA)
  • Pathology (AREA)
  • Biomedical Technology (AREA)
  • Heart & Thoracic Surgery (AREA)
  • Medical Informatics (AREA)
  • Molecular Biology (AREA)
  • General Health & Medical Sciences (AREA)
  • Physiology (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Psychiatry (AREA)
  • Power Engineering (AREA)
  • Cardiology (AREA)
  • Measurement And Recording Of Electrical Phenomena And Electrical Characteristics Of The Living Body (AREA)

Abstract

一种融合巴特沃斯滤波和小波变换的ECG特征提取方法,属于医学计算机技术领域。核心思想为:对原始ECG信号工频干扰进行了去噪处理;同时使用曲线拟合的方式,去基线漂移;在获取到较为精确的ECG信号后,使用差分阈值法和小波变换的方法分别对Q波、R波和S波分别进行定位,与专家标注的信息比对,分别调整阈值、尺度和平移量参数,得到最佳的定位结果。基于上述结果,针对Q波、R波和S波,分别选取差分阈值或者小波变换方法进行定位。本发明能够对原始的ECG信号进行更为精确的去噪处理,并且,能够实现QRS波的精确定位,为心电图的数字化分析提供基础。

An ECG feature extraction method combining Butterworth filter and wavelet transform belongs to the field of medical computer technology. The core idea is: to denoise the original ECG signal power frequency interference; at the same time, use the curve fitting method to remove the baseline drift; The Q wave, R wave, and S wave are positioned separately, compared with the information marked by experts, and the threshold, scale, and translation parameters are adjusted respectively to obtain the best positioning results. Based on the above results, for Q wave, R wave and S wave, the differential threshold or wavelet transform method is selected for positioning. The invention can perform more accurate denoising processing on the original ECG signal, and can realize the precise positioning of the QRS wave, so as to provide a basis for the digitized analysis of the electrocardiogram.

Description

一种融合巴特沃斯滤波和小波变换的ECG特征提取方法An ECG Feature Extraction Method Combining Butterworth Filter and Wavelet Transform

技术领域technical field

本发明涉及一种心电信号特征提取的方法,尤其涉及一种融合巴特沃斯滤波和小波变换的ECG特征提取方法,属于医学计算机技术领域。The invention relates to a method for extracting features of electrocardiographic signals, in particular to a method for extracting ECG features combined with Butterworth filter and wavelet transform, and belongs to the technical field of medical computers.

背景技术Background technique

长久以来,心血管疾病因其高发病率和高死亡率严重威胁着人类的健康和生命。局世界卫生组织(WHO)估计,目前世界上每年有3600万人死于心血管疾病、糖尿病、呼吸系统疾病和恶性肿瘤等非传染性疾病,占全球死亡总数的2/3,到2020年,数目要攀升到4400万。For a long time, cardiovascular disease has seriously threatened human health and life because of its high morbidity and high mortality. The World Health Organization (WHO) estimates that 36 million people die each year from non-communicable diseases such as cardiovascular disease, diabetes, respiratory system disease and malignant tumors in the world, accounting for 2/3 of the total global deaths. By 2020, The number will climb to 44 million.

《中国心血管病报告(2015)》显示,2014年中国心血管病死亡率仍居疾病死亡构成的首位,高于肿瘤及其他疾病。2014年农村心血管病死亡率为295.63/10万,其中心脏病死亡率为143.72/10万,脑血管病死亡率为151.91/10万(脑出血74.51/10万,脑梗死45.30/10万);城市心血管病死亡率为261.99/10万,其中心脏病死亡率为136.21/10万,脑血管病死亡率为125.78/10万(脑出血52.25/10万,脑梗死41.99/10万)。随着中国社会老龄化步伐的加速,这些数据均在快速增长,心血管疾病已成为我国的重大公共卫生问题之一。所以,心脏类疾病的预防、诊断和治疗尤为重要,是当今医学人员的巨大挑战和研究热点。The "China Cardiovascular Disease Report (2015)" shows that in 2014, the mortality rate of cardiovascular disease in China still ranked first in the composition of disease deaths, higher than that of tumors and other diseases. In 2014, the mortality rate of cardiovascular disease in rural areas was 295.63/100,000, of which the mortality rate of heart disease was 143.72/100,000, and the mortality rate of cerebrovascular disease was 151.91/100,000 (cerebral hemorrhage 74.51/100,000, cerebral infarction 45.30/100,000) The mortality rate of cardiovascular diseases in the city is 261.99/100,000, of which the mortality rate of heart disease is 136.21/100,000, and the mortality rate of cerebrovascular disease is 125.78/100,000 (cerebral hemorrhage 52.25/100,000, cerebral infarction 41.99/100,000). With the acceleration of the aging of Chinese society, these data are increasing rapidly, and cardiovascular disease has become one of the major public health problems in our country. Therefore, the prevention, diagnosis and treatment of heart diseases are particularly important, which is a huge challenge and research hotspot for medical personnel today.

心电图(Electrocardiogram,ECG)检查通过放置在人体表面不同部位的电极,记录也肌细胞在每个也动周期收缩和舒张的过程中产生的电流,同时记录电流随心动周期方向和强弱的变化趋势并实时描绘心电变化曲线,用以判断心脏电活动的情况,可以判断心肌细胞是否死亡、是否存在缺血、是否存在冲动传导异常,并记录具有临床意义的特征性心电图改变。除此之外,某些电解质紊乱的疾病心电图也有特征性改变。如高钾血症会出现T波高尖、QT间期缩短,血钙降低会出现ST段延长等;进行ECG信号的特征提取对临床研究具有重要的意义。Electrocardiogram (ECG) records the current generated by muscle cells during the contraction and relaxation of each motor cycle through electrodes placed on different parts of the human body surface, and also records the change trend of the current with the direction and strength of the cardiac cycle And draw the ECG change curve in real time to judge the electrical activity of the heart. It can determine whether the myocardial cells are dead, whether there is ischemia, whether there is abnormal impulse conduction, and record the characteristic ECG changes with clinical significance. In addition, there are also characteristic changes in the electrocardiogram of certain electrolyte disorders. For example, hyperkalemia will lead to high peak T waves, shortened QT interval, and low blood calcium will cause ST segment prolongation, etc. The feature extraction of ECG signals is of great significance to clinical research.

但在心电信号的检测过程中,存在工频干扰、环境噪声等因素的影响,影响了测量时的精度。并且目前由于心电图的智能分析的准确性和可靠性并不能与心脏病专家的分析相提并论,所以它在实际临床应用中的比例并不大。However, in the detection process of the ECG signal, there are factors such as power frequency interference and environmental noise, which affect the accuracy of the measurement. And at present, because the accuracy and reliability of the intelligent analysis of the electrocardiogram cannot be compared with the analysis of cardiologists, so its proportion in actual clinical application is not large.

发明内容Contents of the invention

本发明的目的在于进一步提高现有心电信号的采集准确度以及各个QRS波段的精确检测,提出了一种融合巴特沃斯滤波和小波变换的ECG特征提取方法。The purpose of the present invention is to further improve the acquisition accuracy of existing electrocardiographic signals and the precise detection of each QRS band, and proposes an ECG feature extraction method combining Butterworth filter and wavelet transform.

本发明的核心思想为:对原始ECG信号工频干扰进行了去噪处理;同时使用曲线拟合的方式,去基线漂移;在获取到较为精确的ECG信号后,使用差分阈值法和小波变换的方法分别对Q波、R波和S波分别进行定位,与专家标注的信息比对,分别调整阈值、尺度和平移量参数,得到最佳的定位结果。The core idea of the present invention is: to denoise the original ECG signal power frequency interference; at the same time use the way of curve fitting to remove the baseline drift; Methods The Q wave, R wave and S wave were respectively positioned, compared with the information marked by experts, and the threshold, scale and translation parameters were adjusted respectively to obtain the best positioning results.

一种融合巴特沃斯滤波和小波变换的ECG特征提取方法,包括如下步骤:An ECG feature extraction method that combines Butterworth filter and wavelet transform, comprising the steps of:

步骤A、对原始ECG信号进行频谱分析得出最高频率和最低频率,再使用巴特沃斯滤波器对原始ECG信号进行滤波处理,得到滤波后的ECG1信号;步骤A又具体包括如下子步骤:Step A, performing spectrum analysis on the original ECG signal to obtain the highest frequency and the lowest frequency, and then using the Butterworth filter to filter the original ECG signal to obtain the filtered ECG 1 signal; Step A specifically includes the following sub-steps:

SA.1通过公式(1)使用离散傅里叶变换的方法,对ECG信号的频谱进行分析,得到ECG信号频谱X(e),进一步得ECG信号的最高频率f1以及工频干扰和其他噪声干扰频段的最低频率f2SA.1 Use the discrete Fourier transform method to analyze the spectrum of the ECG signal through the formula (1) to obtain the ECG signal spectrum X(e ), and further obtain the highest frequency f 1 of the ECG signal, power frequency interference and other The lowest frequency f 2 of the noise interference frequency band;

其中,X(e)为ECG信号的频谱,ω为ECG信号的频率,ECG(n)为ECG信号的第n个幅值;Wherein, X(e ) is the frequency spectrum of the ECG signal, ω is the frequency of the ECG signal, and ECG(n) is the nth amplitude of the ECG signal;

在得到的X(e)中,低频段的最高频率,即为ECG信号的最高频率f1;高频段的最低频率,是工频干扰和其他噪声干扰频段的最低频率f2In the obtained X(e ), the highest frequency of the low frequency band is the highest frequency f 1 of the ECG signal; the lowest frequency of the high frequency band is the lowest frequency f 2 of the power frequency interference and other noise interference frequency bands;

SA.2对ECG信号经巴特沃斯滤波器进行滤波,得到滤波后的ECG信号ECG1,具体通过公式(2)进行巴特沃斯滤波:SA.2 Filter the ECG signal through the Butterworth filter to obtain the filtered ECG signal ECG 1 , specifically carry out the Butterworth filter through the formula (2):

其中,公式(2)中的N代表整数集,|H(ω)|为巴特沃斯滤波器的模,|H(ω)|2为模的平方;ωc(2πf1<ωc<2πf2)为巴特沃斯滤波器的截止频率,p(p∈N)为阶数;Among them, N in the formula (2) represents an integer set, |H(ω)| is the modulus of the Butterworth filter, |H(ω)| 2 is the square of the modulus; ω c (2πf 1c <2πf 2 ) is the cut-off frequency of the Butterworth filter, and p(p∈N) is the order;

步骤B、对步骤A输出的ECG1进行曲线拟合、求取多项式系数并去基线漂移,得到去基线漂移后的信号,ECG2Step B. Carry out curve fitting to the ECG 1 output in step A, obtain polynomial coefficients and remove the baseline drift, obtain the signal after removing the baseline drift, ECG 2 ;

步骤B又包括如下子步骤:Step B includes the following sub-steps:

SB.1基于公式(3)进行曲线拟合:SB.1 Carry out curve fitting based on formula (3):

其中,y为用来拟合的多项式,多项式的阶次q(q∈N),a0,a1,...,ap为q阶多项式的系数,x为采样时间序列,xi为x的第i次方;Among them, y is the polynomial used for fitting, the order of the polynomial is q(q∈N), a 0 , a 1 ,..., a p are the coefficients of the q-order polynomial, x is the sampling time series, and x i is x to the ith power;

SB.2基于公式(4),求取公式(3)中的多项式系数;SB.2 Calculate the polynomial coefficient in formula (3) based on formula (4);

其中,为多项式系数组成的向量,为ECG信号的幅值向量,C=[1 x x2 ... xq]T,CT为C的转置;in, is a vector of polynomial coefficients, is the magnitude vector of the ECG signal, C=[1 xx 2 ... x q ] T , C T is the transpose of C;

SB.3基于公式(5),得到去基线漂移后的信号;SB.3 Based on the formula (5), obtain the signal after removing the baseline drift;

ECG2=ECG1-y (5)ECG 2 =ECG 1 -y (5)

公式(5)中,ECG2为去基线漂移后的信号,ECG1为滤波后的信号;y是式公(3)的输出;In formula (5), ECG 2 is the signal after baseline drift removal, ECG 1 is the signal after filtering; y is the output of formula (3);

步骤C、将步骤B输出的ECG2信号使用差分阈值的方法先进行R波的定位,再进行Q波和S波的定位,分别输出R波、Q波和S波的位置;Step C, the ECG 2 signal output in step B uses the method of differential threshold to first locate the R wave, and then perform the positioning of the Q wave and S wave, and output the positions of the R wave, Q wave and S wave respectively;

步骤C又包含如下子步骤:Step C includes the following sub-steps:

SC.1基于公式(6)和公式(7),顺序计算ECG2信号的一阶差分S(n)和二阶差分W(n);SC.1 Calculate the first-order difference S(n) and the second-order difference W(n) of the ECG 2 signal sequentially based on formula (6) and formula (7);

S(n)=ECG2(n)-ECG2(n-1) (6)S(n)=ECG 2 (n)-ECG 2 (n-1) (6)

W(n)=S(n)-S(n-1) (7)W(n)=S(n)-S(n-1) (7)

其中,S(n)为第n个一阶差分,ECG2(n)为ECG2信号的第n个幅值,ECG2(n-1)为ECG2信号的第n-1个幅值,W(n)为第n个二阶差分,S(n-1)为第n-1个一阶差分;Wherein, S(n) is the nth first-order difference, ECG 2 (n) is the nth amplitude of the ECG 2 signal, ECG 2 (n-1) is the n-1th amplitude of the ECG 2 signal, W(n) is the nth second-order difference, S(n-1) is the n-1th first-order difference;

SC.2使用枚举法,确定步骤SC.1输出的S(n)的最大值max1和W(n)的最大值max2SC.2 use the enumeration method to determine the maximum value max 1 of S(n) and the maximum value max 2 of W(n) output by step SC.1 ;

SC.3基于公式(8),设定阈值门限Y1SC.3 Based on the formula (8), set the threshold Y 1 :

Y1=m1·max1(0<m1<1) (8)Y 1 =m 1 ·max 1 (0<m 1 <1) (8)

公式(8)中,阈值门限为Y1,m1是人为设定的系数,其范围为(0,1);In the formula (8), the threshold threshold is Y 1 , and m 1 is an artificially set coefficient, and its range is (0,1);

SC.4判断S(n)中是否有连续k1(k1∈N)个点超过Y1且ECG2(n)>0,并根据判断结果进行如下操作:SC.4 Judge whether there are consecutive k 1 (k 1 ∈ N) points in S(n) exceeding Y 1 and ECG 2 (n) > 0, and perform the following operations according to the judgment result:

SC.4A若S(n)中有连续k1(k1∈N)个点超过Y1,且ECG2(n)>0,该点n即为这个范围的R波峰,所处位置为r,跳至SC.5;SC.4A If there are k 1 (k 1 ∈ N) consecutive points exceeding Y 1 in S(n), and ECG 2 (n) > 0, this point n is the R peak of this range, and its position is r , skip to SC.5;

其中,k1是大于等于2的整数;Wherein, k 1 is an integer greater than or equal to 2;

SC.4B若S(n)中没有连续k1(k1∈N)个点超过Y1,则k1=k1-1,跳至步骤SC.4;SC.4B If there are no consecutive k 1 (k 1 ∈ N) points in S(n) exceeding Y 1 , then k 1 =k 1 -1, skip to step SC.4;

SC.5基于公式(9)和(10),设定起点阈值门限Y2和终点阈值门限Y3SC.5 Based on formulas (9) and (10), set the starting threshold Y 2 and the ending threshold Y 3 :

Y2=m2·max2(0<m2<1) (9)Y 2 =m 2 ·max 2 (0<m 2 <1) (9)

Y3=m3·max2(0<m3<1) (10)Y 3 =m 3 ·max 2 (0<m 3 <1) (10)

公式(9)(10)中,阈值门限分别为Y2,Y3,m2,m3是人为设定的系数;In formulas (9) and (10), the thresholds are Y 2 and Y 3 respectively, and m 2 and m 3 are artificially set coefficients;

SC.6从每个R波向前搜索,判断W(n)中是否有连续k2(k2∈N)个点小于Y2,并根据判断结果进行如下操作:SC.6 Search forward from each R wave, judge whether there are consecutive k 2 (k 2 ∈ N) points in W(n) smaller than Y 2 , and perform the following operations according to the judgment result:

SC.6A若W(n)中有连续k2(k2∈N)个点小于Y2,该点n即为该点为这个范围的QRS波的起点s,跳至SC.5;SC.6A If there are k 2 (k 2 ∈ N) consecutive points in W(n) smaller than Y 2 , the point n is the starting point s of the QRS wave in this range, skip to SC.5;

其中,k2是大于等于2的整数;Wherein, k 2 is an integer greater than or equal to 2;

SC.6B若W(n)中没有连续k2(k2∈N)个点小于Y2,则k2=k2-1,跳至步骤SC.6;SC.6B If there are no consecutive k 2 (k 2 ∈N) points in W(n) smaller than Y 2 , then k 2 =k 2 -1, skip to step SC.6;

SC.7从每个R波向后搜索,判断W(n)中是否有连续k3(k3∈N)个点小于Y3,并根据判断结果进行如下操作:SC.7 Search backward from each R wave, judge whether there are consecutive k 3 (k 3 ∈ N) points in W(n) smaller than Y 3 , and perform the following operations according to the judgment result:

其中,k3是大于等于2的整数;Wherein, k 3 is an integer greater than or equal to 2;

SC.7A若W(n)中有连续k3(k3∈N)个点小于Y3,该点n即为该点为这个范围的QRS波的终点e,跳至SD.8;SC.7A If there are k 3 (k 3 ∈ N) consecutive points in W(n) smaller than Y 3 , this point n is the end point e of the QRS wave in this range, skip to SD.8;

SC.7B若W(n)中没有连续k3(k3∈N)个点小于Y3,则k3=k3-1,跳至步骤SC.7;SC.7B If there are no consecutive k 3 (k 3 ∈N) points in W(n) smaller than Y 3 , then k 3 =k 3 -1, skip to step SC.7;

SC.8基于公式(11),在Q波、R波和S波的起点s和R波所在r位置的范围内搜索幅值极小值点Q:SC.8 Based on the formula (11), search for the minimum amplitude point Q within the range of the starting point s of the Q wave, R wave and S wave and the position r of the R wave:

Q=min(ECG2(n)),(s<n<r) (11)Q=min(ECG 2 (n)),(s<n<r) (11)

公式(11)中,min(ECG2(n))为搜索ECG2(n)极小值的函数;In formula (11), min(ECG 2 (n)) is a function to search for the minimum value of ECG 2 (n);

基于公式(12),在R波和终点e的范围内搜索幅值极小值点S:Based on the formula (12), the amplitude minimum point S is searched within the range of the R wave and the terminal point e:

S=min(ECG2(n)),(r<n<e) (12)S=min(ECG 2 (n)),(r<n<e) (12)

SC.9通过步骤SC.4和步骤SC.8确定的R波、Q波和S波的位置,与专家标注的位置进行比较,基于公式(13),分别得到R波、Q波和S波的检测准确度p11,p12,p13SC.9 Compare the positions of R wave, Q wave and S wave determined by step SC.4 and step SC.8 with the positions marked by experts, and obtain R wave, Q wave and S wave respectively based on formula (13) The detection accuracy of p 11 , p 12 , p 13 :

公式(13)中,i的取值为1,2,3,N11,N12,N13分别为ECG信号中R波、Q波和S波的个数,N11 *,N12 *,N13 *分别为检测正确的R波、Q波和S波的个数;In the formula (13), the value of i is 1, 2, 3, N 11 , N 12 , N 13 are respectively the number of R wave, Q wave and S wave in the ECG signal, N 11 * , N 12 * , N 13 * are respectively the number of correctly detected R wave, Q wave and S wave;

步骤D、将步骤B处理后的ECG2信号使用小波变换的方法得到不同阶层的小波分解图,然后通过检测小波变换系数模极大值的位置和幅度,输出Q,R,S波所在位置;步骤D又包含如下步骤:Step D, using the wavelet transform method to obtain wavelet decomposition diagrams of different levels of the ECG 2 signal processed in step B, and then output the positions of Q, R, and S waves by detecting the position and amplitude of the wavelet transform coefficient modulus maximum; Step D comprises the following steps again:

SD.1基于公式(14),(15),使用双正交样条小波对ECG信号进行小波变换,得到不同阶层下的小波分解图;SD.1 Based on the formulas (14) and (15), the biorthogonal spline wavelet is used to perform wavelet transformation on the ECG signal, and the wavelet decomposition diagrams at different levels are obtained;

其中,x0(n)=ECG2(n),即为处理后的ECG信号;Z为自然数集(下同);x(j)(n)为xj-1(n)的高频段信号在j尺度上的二进小波变换,d(j)(n)为xj-1(n)的低频段信号在j尺度上的二进小波变换,hj-1(k),gj-1(k)分别为设定的第k组正交的数字低通滤波器和高通滤波器系数;Among them, x 0 (n)=ECG 2 (n), which is the processed ECG signal; Z is a natural number set (the same below); x (j) (n) is the high-frequency signal of x j-1 (n) The binary wavelet transform on the j scale, d (j) (n) is the binary wavelet transform of the low-frequency signal of x j-1 (n) on the j scale, h j-1 (k), g j- 1 (k) is respectively the digital low-pass filter and the high-pass filter coefficient of the k group orthogonality of setting;

SD.2基于SD.1得到的不同尺度下的小波分解图,对c(c∈N)尺度下的波形,检测幅值极大值点M和极小值点L;检测两点间幅值为p(p<ε)的点,其中,ε为幅值趋近于零的数值,p即为原ECG信号的R波所在位置;SD.2 Based on the wavelet decomposition diagrams at different scales obtained in SD.1, for waveforms at the scale of c(c∈N), detect the amplitude maximum point M and the minimum value point L; detect the amplitude between two points is the point of p(p<ε), where ε is the value whose amplitude is close to zero, and p is the position of the R wave of the original ECG signal;

SD.3基于SD.2得到的R波位置p和公式(16)对b(b∈N)尺度下的波形,搜索R波前位置的模极小值,即为Q波,SD.3 Based on the R wave position p obtained in SD.2 and the formula (16), search for the modulus minimum at the front position of the R wave for the waveform at the b (b∈N) scale, which is the Q wave.

Q=x(b)(n)<x(b)(n-1),x(b)(n)<x(b)(n+1),(n<p) (16)Q=x (b) (n)<x (b) (n-1), x (b) (n)<x (b) (n+1), (n<p) (16)

其中,x(b)(n)为b尺度下,ECG信号第n个序列的幅值;Wherein, x (b) (n) is the magnitude of the nth sequence of the ECG signal at the b scale;

搜索R波后位置的模极小值,即为S波,Search for the modulus minimum at the position after the R wave, which is the S wave,

S=x(b)(n)<x(b)(n-1),x(b)(n)<x(b)(n+1),(n>p) (17)S=x (b) (n)<x (b) (n-1), x (b) (n)<x (b) (n+1), (n>p) (17)

其中,x(b)(n)为b尺度下,ECG信号第n个序列的幅值;Wherein, x (b) (n) is the magnitude of the nth sequence of the ECG signal at the b scale;

SD.4通过步骤SD.2和步骤SD.3检测的R波、Q波和S波的位置,与专家标注的位置进行比较,基于公式(18),分别得到R波、Q波和S波的检测准确度p21,p22,p23SD.4 Compare the positions of R wave, Q wave and S wave detected by step SD.2 and step SD.3 with the positions marked by experts, and obtain R wave, Q wave and S wave respectively based on formula (18) The detection accuracy of p 21 , p 22 , p 23 :

公式(18)中,i的取值为1,2,3,N21,N22,N23分别为ECG信号中R波、Q波和S波的个数,N21 *,N22 *,N23 *分别为检测正确的R波、Q波和S波的个数;In the formula (18), the value of i is 1, 2, 3, N 21 , N 22 , N 23 are respectively the number of R wave, Q wave and S wave in the ECG signal, N 21 * , N 22 * , N 23 * are respectively the number of correctly detected R wave, Q wave and S wave;

其中,步骤D和步骤C也可以交换顺序;Wherein, step D and step C can also exchange order;

步骤E、通过专家标注的R波,Q波和S波对差分阈值法的所人为设定的参数进行反复调整,对小波变换的阶层进行反复调整,直至准确度收敛;步骤E又包含如下步骤:Step E, repeatedly adjust the artificially set parameters of the difference threshold method through the R wave, Q wave and S wave marked by experts, and repeatedly adjust the wavelet transform hierarchy until the accuracy converges; step E also includes the following steps :

SE.1分别基于步骤C获得的R波,Q波和S波与通过反复与专家标注的点比较,调整m1,m2,m3的值,分别决定是否跳至步骤C,具体为:SE.1 Adjust the values of m 1 , m 2 , and m 3 based on the R wave, Q wave, and S wave obtained in step C and the points marked by experts repeatedly, and decide whether to skip to step C, specifically:

SE.1A基于步骤C获得的R波,与通过反复与专家标注的R波进行比较,若准确度p11提高,则调整m1的值,跳至步骤C;若准确度p11没有提高,则跳至步骤SE.1B;SE.1A Based on the R wave obtained in step C, compare it with the R wave marked by experts repeatedly. If the accuracy p 11 improves, adjust the value of m 1 and skip to step C; if the accuracy p 11 does not improve, Then skip to step SE.1B;

步骤SE.1B基于步骤C获得的Q波,与通过反复与专家标注的Q波比较,Step SE.1B is based on the Q wave obtained in step C, compared with the Q wave marked by repeated consultation with experts,

若准确度p12提高,则调整m2的值,跳至步骤C;若准确度p12没有提高,则跳至步骤SE.1C;If the accuracy p 12 is improved, then adjust the value of m 2 and skip to step C; if the accuracy p 12 is not improved, then skip to step SE.1C;

步骤SE.1C基于步骤C获得的S波,与通过反复与专家标注的S波比较,Step SE.1C is based on the S wave obtained in step C, compared with the S wave marked by experts repeatedly,

若准确度p13提高,则调整m3的值,跳至步骤C;若准确度p13没有提高,则跳至步骤SE.2;If the accuracy p 13 is improved, then adjust the value of m 3 and skip to step C; if the accuracy p 13 is not improved, then skip to step SE.2;

SE.2分别基于步骤D获得的R波,Q波和S波与通过反复与专家标注的点比较,调整b,c的值,分别决定是否跳至步骤D,具体为:SE.2 Based on the R wave, Q wave and S wave obtained in step D and the points marked by experts repeatedly, adjust the values of b and c to decide whether to skip to step D, specifically:

SE.2A基于步骤D获得的R波,与通过反复与专家标注的R波进行比较,若准确度p21提高,则调整b的值,跳至步骤D;若准确度p21没有提高,则跳至步骤SE.2B;SE.2A Based on the R wave obtained in step D, compare it with the R wave marked by experts repeatedly. If the accuracy p 21 improves, adjust the value of b and skip to step D; if the accuracy p 21 does not improve, then Skip to step SE.2B;

步骤SE.2B基于步骤D获得的Q波、S波,与通过反复与专家标注的Q波和S波比较,Step SE.2B is based on the Q wave and S wave obtained in step D, compared with the Q wave and S wave marked by experts repeatedly,

若准确度p22、p23均提高,则调整c的值,跳至步骤D;若准确度p22、p23至少一个没有提高,则跳至步骤F。If both the accuracy p 22 and p 23 are improved, then adjust the value of c and skip to step D; if at least one of the accuracy p 22 and p 23 is not improved, then skip to step F.

步骤F、分别比较步骤C和步骤D的检测准确度,分别针对R波、Q波和S波,选择准确度高的检测方法,步骤F又包含如下步骤:Step F, comparing the detection accuracy of step C and step D respectively, and selecting a detection method with high accuracy for R wave, Q wave and S wave respectively, step F includes the following steps:

SF.1比较p11和p21的大小,若p11≥p21,则跳至步骤C,进行R波的提取,若p11<p21,则跳至步骤D,进行R波的提取;SF.1 Compare the size of p 11 and p 21 , if p 11 ≥ p 21 , then skip to step C to extract R wave, if p 11 <p 21 , then skip to step D to extract R wave;

SF.2比较p12和p22的大小,若p12≥p22,则跳至步骤C,进行Q波的提取,若p12<p22,则跳至步骤D,进行Q波的提取;SF.2 Compare the size of p 12 and p 22 , if p 12 ≥ p 22 , skip to step C to extract Q wave, if p 12 < p 22 , skip to step D to extract Q wave;

SF.3比较p13和p23的大小,若p13≥p23,则跳至步骤C,进行S波的提取,若p13<p23,则跳至步骤D,进行S波的提取,本方法结束。SF.3 Compare the size of p 13 and p 23 , if p 13 ≥ p 23 , then skip to step C to extract S wave, if p 13 <p 23 , then skip to step D to extract S wave, This method ends.

有益效果Beneficial effect

本发明一种融合巴特沃斯滤波和小波变换的ECG特征提取方法,对比已有技术,具有如下有益效果:能够对原始的ECG信号进行更为精确的去噪处理,并且,能够实现QRS波的精确定位,为心电图的数字化分析提供基础。An ECG feature extraction method fused with Butterworth filter and wavelet transform of the present invention has the following beneficial effects compared with the prior art: the original ECG signal can be denoised more accurately, and the QRS wave can be realized Accurate positioning provides the basis for digital analysis of ECG.

附图说明Description of drawings

图1是本发明一种融合巴特沃斯滤波和小波变换的ECG特征提取方法的Q波、R波以及S波的提取流程图。Fig. 1 is a flow chart of extracting Q wave, R wave and S wave of an ECG feature extraction method that combines Butterworth filter and wavelet transform according to the present invention.

具体实施方式Detailed ways

下面,结合附图并举实施例,对本发明进行详细描述。Hereinafter, the present invention will be described in detail with reference to the accompanying drawings and examples.

实施例1Example 1

本发明提出了一种融合巴特沃斯滤波和小波变换的ECG信号特征提取方法,如图1所示。具体包括如下步骤:The present invention proposes an ECG signal feature extraction method that combines Butterworth filter and wavelet transform, as shown in FIG. 1 . Specifically include the following steps:

步骤1、对原始ECG信号进行频谱分析得出最高频率和最低频率,再使用巴特沃斯滤波器对原始ECG信号进行滤波处理,得到滤波后的ECG1信号;步骤1又具体包括如下子步骤:Step 1. Perform spectrum analysis on the original ECG signal to obtain the highest frequency and the lowest frequency, and then use the Butterworth filter to filter the original ECG signal to obtain the filtered ECG 1 signal; Step 1 specifically includes the following sub-steps:

S1.1通过公式(19)使用离散傅里叶变换的方法,对ECG信号的频谱进行分析,得到ECG信号频谱的最高频率和最低频率,X(e):S1.1 Use the discrete Fourier transform method to analyze the spectrum of the ECG signal through the formula (19), and obtain the highest frequency and the lowest frequency of the ECG signal spectrum, X(e ):

其中,X(e)为ECG信号的频谱,ω为ECG信号的频率,ECG(n)为ECG信号的第n个幅值;Wherein, X(e ) is the frequency spectrum of the ECG signal, ω is the frequency of the ECG signal, and ECG(n) is the nth amplitude of the ECG signal;

在得到的X(e)中,低频段的最高频率,即为ECG信号的最高频率f1;高频段的最低频率,是工频干扰和其他噪声干扰频段的最低频率f2In the obtained X(e ), the highest frequency of the low frequency band is the highest frequency f 1 of the ECG signal; the lowest frequency of the high frequency band is the lowest frequency f 2 of the power frequency interference and other noise interference frequency bands;

S1.2对ECG信号经巴特沃斯滤波器进行滤波,得到滤波后的ECG信号ECG1,基于公式(20)进行巴特沃斯滤波;S1.2 Filter the ECG signal through a Butterworth filter to obtain a filtered ECG signal ECG 1 , and perform Butterworth filtering based on formula (20);

其中,公式(20)中的N代表整数集,|H(ω)|为巴特沃斯滤波器的模,|H(ω)|2为模的平方;ωc=2π×50Hz为巴特沃斯滤波器的截止频率,p=2为阶数;Wherein, N in the formula (20) represents an integer set, |H(ω)| is the modulus of the Butterworth filter, |H(ω)| 2 is the square of the modulus; ω c =2π×50Hz is the Butterworth The cutoff frequency of the filter, p=2 is the order;

步骤2、对步骤SA.2输出的ECG1进行曲线拟合、求取多项式系数并去基线漂移,得到去基线漂移后的信号ECG2Step 2. Carry out curve fitting to the ECG 1 output in step SA.2, obtain polynomial coefficients and remove the baseline drift, and obtain the signal ECG 2 after the baseline drift is removed;

步骤2又包括如下子步骤:Step 2 includes the following sub-steps:

S2.1基于公式(21)进行曲线拟合;S2.1 Carry out curve fitting based on formula (21);

其中,y为用来拟合的多项式,多项式的阶次q=3,a0,a1,a2,a3为q阶多项式的系数,x为采样时间序列,xi为x的第i次方;Among them, y is the polynomial used for fitting, the order of the polynomial is q=3, a 0 , a 1 , a 2 , and a 3 are the coefficients of the q-order polynomial, x is the sampling time series, and x i is the ith of x power;

S2.2基于公式(22),求取公式(3)中的多项式系数;S2.2 Calculate the polynomial coefficient in formula (3) based on formula (22);

其中,为多项式系数组成的向量,为ECG信号的幅值向量,C=[1 x x2 x3]T,CT为C的转置;in, is a vector of polynomial coefficients, is the magnitude vector of the ECG signal, C=[1 xx 2 x 3 ] T , C T is the transpose of C;

S2.3基于公式(23),得到去基线漂移后的信号;S2.3 Based on formula (23), obtain the signal after removing the baseline drift;

ECG2=ECG1-y (23)ECG 2 = ECG 1 -y (23)

公式(23)中,ECG2为去基线漂移后的信号,ECG1为滤波后的信号;y是式公(21)的输出;In formula (23), ECG 2 is the signal after baseline drift removal, ECG 1 is the signal after filtering; y is the output of formula (21);

步骤3、将步骤2输出的ECG2信号使用差分阈值的方法先进行R波的定位,再进行Q波和S波的定位,分别输出R波、Q波和S波的位置;Step 3. The ECG 2 signal output in step 2 is used to locate the R wave first, then the Q wave and S wave, and output the positions of the R wave, Q wave, and S wave respectively by using the differential threshold method;

步骤3又包含如下子步骤:Step 3 includes the following sub-steps:

S3.1基于公式(24)和公式(25),顺序计算ECG2信号的一阶差分S(n)和二阶差分W(n);S3.1 Sequentially calculate the first-order difference S(n) and the second-order difference W(n) of the ECG 2 signal based on formula (24) and formula (25);

S(n)=ECG2(n)-ECG2(n-1) (24)S(n)=ECG 2 (n)-ECG 2 (n-1) (24)

W(n)=S(n)-S(n-1) (25)W(n)=S(n)-S(n-1) (25)

其中,S(n)为第n个一阶差分,ECG2(n)为ECG2信号的第n个幅值,ECG2(n-1)为ECG2信号的第n-1个幅值,W(n)为第n个二阶差分,S(n-1)为第n-1个一阶差分;Wherein, S(n) is the nth first-order difference, ECG 2 (n) is the nth amplitude of the ECG 2 signal, ECG 2 (n-1) is the n-1th amplitude of the ECG 2 signal, W(n) is the nth second-order difference, S(n-1) is the n-1th first-order difference;

S3.2使用枚举法,确定步骤S3.1输出的S(n)的最大值max1和W(n)的最大值max2S3.2 use enumeration method to determine the maximum value max 1 of S(n) output by step S3.1 and the maximum value max 2 of W(n);

S3.3基于公式(26),设定阈值门限Y1S3.3 Based on the formula (26), set the threshold Y 1 :

Y1=m1·max1(0<m1<1) (26)Y 1 =m 1 ·max 1 (0<m 1 <1) (26)

公式(26)中,阈值门限为Y1,m1=0.7;In formula (26), the threshold is Y 1 , m 1 =0.7;

S3.4判断S(n)中是否有连续k1(k1∈N)个点超过Y1且ECG2(n)>0,并根据判断结果进行如下操作:S3.4 Judge whether there are consecutive k 1 (k 1 ∈ N) points in S(n) exceeding Y 1 and ECG 2 (n) > 0, and perform the following operations according to the judgment result:

S3.4A若S(n)中有连续k1(k1∈N)个点超过Y1,且ECG2(n)>0,该点n即为这个范围的R波峰,所处位置为r,跳至S3.5;S3.4A If there are k 1 (k 1 ∈ N) consecutive points in S(n) exceeding Y 1 , and ECG 2 (n) > 0, the point n is the R peak of this range, and its position is r , skip to S3.5;

其中,k1是大于等于2的整数;Wherein, k 1 is an integer greater than or equal to 2;

S3.4B若S(n)中没有连续k1(k1∈N)个点超过Y1,则k1=k1-1,跳至步骤SC.4;S3.4B If there are no consecutive k 1 (k 1 ∈ N) points in S(n) exceeding Y 1 , then k 1 =k 1 -1, skip to step SC.4;

S3.5基于公式(27)和(28),设定起点阈值门限Y2和终点阈值门限Y3S3.5 Based on formulas (27) and (28), set the starting threshold threshold Y 2 and the ending threshold threshold Y 3 :

Y2=m2·max2(0<m2<1) (27)Y 2 =m 2 ·max 2 (0<m 2 <1) (27)

Y3=m3·max2(0<m3<1) (28)Y 3 =m 3 ·max 2 (0<m 3 <1) (28)

公式(27)(28)中,阈值门限分别为Y2,Y3,m2=0.5,m3=0.6;In the formulas (27) and (28), the thresholds are respectively Y 2 and Y 3 , m 2 =0.5, m 3 =0.6;

S3.6从每个R波向前搜索,判断W(n)中是否有连续k2(k2∈N)个点小于Y2,并根据判断结果进行如下操作:S3.6 Search forward from each R wave, judge whether there are consecutive k 2 (k 2 ∈ N) points in W(n) smaller than Y 2 , and perform the following operations according to the judgment result:

S3.6A若W(n)中有连续k2=5个点小于Y2,该点n即为该点为这个范围的QRS波的起点s,跳至S3.5;S3.6A If there are consecutive k 2 = 5 points in W(n) smaller than Y 2 , the point n is the starting point s of the QRS wave in this range, skip to S3.5;

其中,k2是大于等于2的整数;Wherein, k 2 is an integer greater than or equal to 2;

S3.6B若W(n)中没有连续k2=5个点小于Y2,则k2=k2-1,跳至步骤S3.6;S3.6B If there are no consecutive k 2 =5 points in W(n) smaller than Y 2 , then k 2 =k 2 -1, skip to step S3.6;

S3.7从每个R波向后搜索,判断W(n)中是否有连续k3=5个点小于Y3,并根据判断结果进行如下操作:S3.7 Search backward from each R wave, judge whether there are consecutive k 3 =5 points in W(n) smaller than Y 3 , and perform the following operations according to the judgment result:

其中,k3是大于等于2的整数;Wherein, k 3 is an integer greater than or equal to 2;

S3.7A若W(n)中有连续k3=5个点小于Y3,该点n即为该点为这个范围的QRS波的终点e,跳至S4.8;S3.7A If there are k 3 = 5 consecutive points in W(n) smaller than Y 3 , the point n is the end point e of the QRS wave in this range, skip to S4.8;

S3.7B若W(n)中没有连续k3=5个点小于Y3,则k3=k3-1,跳至步骤S3.7;S3.7B If there are no consecutive k 3 =5 points in W(n) smaller than Y 3 , then k 3 =k 3 -1, skip to step S3.7;

S3.8基于公式(29),在Q波、R波和S波的起点s和R波所在r位置的范围内搜索幅值极小值点Q:S3.8 Based on the formula (29), search for the minimum amplitude point Q within the range of the starting point s of the Q wave, R wave and S wave and the position r of the R wave:

Q=min(ECG2(n)),(s<n<r) (29)Q=min(ECG 2 (n)),(s<n<r) (29)

公式(29)中,min(ECG2(n))为搜索ECG2(n)极小值的函数;In formula (29), min(ECG 2 (n)) is a function to search for the minimum value of ECG 2 (n);

基于公式(30),在R波和终点e的范围内搜索幅值极小值点S:Based on the formula (30), the amplitude minimum point S is searched within the range of the R wave and the terminal point e:

S=min(ECG2(n)),(r<n<e) (30)S=min(ECG 2 (n)),(r<n<e) (30)

S3.9通过步骤S3.4和步骤S3.8确定的R波、Q波和S波的位置,与专家标注的位置进行比较,基于公式(13),分别得到R波、Q波和S波的检测准确度p11,p12,p13S3.9 Compare the positions of R wave, Q wave and S wave determined by step S3.4 and step S3.8 with the positions marked by experts, and obtain R wave, Q wave and S wave respectively based on formula (13) The detection accuracy of p 11 , p 12 , p 13 :

公式(31)中,i的取值为1,2,3,N11,N12,N13分别为ECG信号中R波、Q波和S波的个数,N11 *,N12 *,N13 *分别为检测正确的R波、Q波和S波的个数;In the formula (31), the value of i is 1, 2, 3, N 11 , N 12 , N 13 are respectively the number of R wave, Q wave and S wave in the ECG signal, N 11 * , N 12 * , N 13 * are respectively the number of correctly detected R wave, Q wave and S wave;

步骤4、将步骤2处理后的ECG2信号使用小波变换的方法得到不同阶层的小波分解图,然后通过检测小波变换系数模极大值的位置和幅度,输出Q,R,S波所在位置;步骤4又包含如下步骤:Step 4, use the wavelet transform method to obtain the wavelet decomposition diagrams of different levels of the ECG 2 signal processed in step 2, and then output the position of the Q, R, and S waves by detecting the position and amplitude of the modulus maximum value of the wavelet transform coefficient; Step 4 further includes the following steps:

S4.1基于公式(32),(33),使用双正交样条小波对ECG信号进行小波变换,得到不同阶层下的小波分解图;S4.1 Based on formulas (32) and (33), perform wavelet transformation on the ECG signal using biorthogonal spline wavelet to obtain wavelet decomposition diagrams at different levels;

其中,x0(n)=ECG2(n),即为处理后的ECG信号;Z为自然数集(下同);x(j)(n)为xj-1(n)的高频段信号在j尺度上的二进小波变换,d(j)(n)为xj-1(n)的低频段信号在j尺度上的二进小波变换,hj-1(k),gj-1(k)分别为设定的第k组正交的数字低通滤波器和高通滤波器系数;Among them, x 0 (n)=ECG 2 (n), which is the processed ECG signal; Z is a natural number set (the same below); x (j) (n) is the high-frequency signal of x j-1 (n) The binary wavelet transform on the j scale, d (j) (n) is the binary wavelet transform of the low-frequency signal of x j-1 (n) on the j scale, h j-1 (k), g j- 1 (k) is respectively the digital low-pass filter and the high-pass filter coefficient of the k group orthogonality of setting;

S4.2基于S4.1得到的不同尺度下的小波分解图,对2尺度下的波形,检测幅值极大值点M和极小值点L;检测两点间幅值为p(p<0.05)的点,p即为原ECG信号的R波所在位置;S4.2 Based on the wavelet decomposition diagrams at different scales obtained in S4.1, for waveforms at 2 scales, detect the amplitude maximum point M and the minimum value point L; the amplitude between the two points is detected to be p(p< 0.05), p is the position of the R wave of the original ECG signal;

S4.3基于S4.2得到的R波位置p和公式(34)对1尺度下的波形,搜索R波前位置的模极小值,即为Q波,S4.3 Based on the R wave position p obtained in S4.2 and the formula (34) for the waveform at scale 1, search for the modulus minimum value of the front position of the R wave, which is the Q wave.

Q=x(b)(n)<x(b)(n-1),x(b)(n)<x(b)(n+1),(n<p) (34)Q=x (b) (n)<x (b) (n-1),x (b) (n)<x (b) (n+1),(n<p)(34)

其中,x(b)(n)为1尺度下,ECG信号第n个序列的幅值;Wherein, x (b) (n) is the magnitude of the nth sequence of the ECG signal at a scale of 1;

搜索R波后位置的模极小值,即为S波,Search for the modulus minimum at the position after the R wave, which is the S wave,

S=x(b)(n)<x(b)(n-1),x(b)(n)<x(b)(n+1),(n>p) (35)S=x (b) (n)<x (b) (n-1), x (b) (n)<x (b) (n+1), (n>p) (35)

其中,x(b)(n)为1尺度下,ECG信号第n个序列的幅值;Wherein, x (b) (n) is the magnitude of the nth sequence of the ECG signal at a scale of 1;

S4.4通过步骤S4.2和步骤S4.3检测的R波、Q波和S波的位置,与专家标注的位置进行比较,基于公式(36),分别得到R波、Q波和S波的检测准确度p21,p22,p23S4.4 Compare the positions of R wave, Q wave and S wave detected by step S4.2 and step S4.3 with the positions marked by experts, and obtain R wave, Q wave and S wave respectively based on formula (36) The detection accuracy of p 21 , p 22 , p 23 :

公式(13)中,i的取值为1,2,3,N21,N22,N23分别为ECG信号中R波、Q波和S波的个数,N21 *,N22 *,N23 *分别为检测正确的R波、Q波和S波的个数;In the formula (13), the value of i is 1, 2, 3, N 21 , N 22 , N 23 are respectively the number of R wave, Q wave and S wave in the ECG signal, N 21 * , N 22 * , N 23 * are respectively the number of correctly detected R wave, Q wave and S wave;

其中,步骤4和步骤3也可以交换顺序;Wherein, step 4 and step 3 can also exchange order;

步骤5、通过专家标注的R波,Q波和S波对差分阈值法的所人为设定的参数进行反复调整,对小波变换的阶层进行反复调整,直至准确度收敛;步骤5又包含如下步骤:Step 5. Repeatedly adjust the artificially set parameters of the differential threshold method through the R wave, Q wave and S wave marked by experts, and repeatedly adjust the wavelet transform hierarchy until the accuracy converges; Step 5 also includes the following steps :

S5.1分别基于步骤3获得的R波,Q波和S波与通过反复与专家标注的点比较,调整m1,m2,m3的值,分别决定是否跳至步骤3,具体为:S5.1 Based on the R wave, Q wave and S wave obtained in step 3 and the points marked by experts repeatedly, adjust the values of m 1 , m 2 , and m 3 to decide whether to skip to step 3, specifically:

S5.1A基于步骤3获得的R波,与通过反复与专家标注的R波进行比较,若准确度p11提高,则调整m1的值,跳至步骤3;若准确度p11没有提高,则跳至步骤S5.1B;S5.1A Based on the R wave obtained in step 3, compare it with the R wave marked by experts repeatedly. If the accuracy p 11 improves, adjust the value of m 1 and skip to step 3; if the accuracy p 11 does not improve, Then skip to step S5.1B;

步骤S5.1B基于步骤3获得的Q波,与通过反复与专家标注的Q波比较,Step S5.1B is based on the Q wave obtained in step 3, compared with the Q wave marked by experts repeatedly,

若准确度p12提高,则调整m2的值,跳至步骤3;若准确度p12没有提高,则跳至步骤S5.1C;If the accuracy p12 is improved, then adjust the value of m2 , and skip to step 3; if the accuracy p12 is not improved, then skip to step S5.1C;

步骤S5.1C基于步骤3获得的S波,与通过反复与专家标注的S波比较,Step S5.1C is based on the S wave obtained in step 3, compared with the S wave marked by experts repeatedly,

若准确度p13提高,则调整m3的值,跳至步骤3;若准确度p13没有提高,则跳至步骤S5.2;If the accuracy p13 is improved, then adjust the value of m3 and skip to step 3; if the accuracy p13 is not improved, then skip to step S5.2;

S5.2分别基于步骤4获得的R波,Q波和S波与通过反复与专家标注的点比较,调整b,c的值,分别决定是否跳至步骤4,具体为:S5.2 Based on the R wave, Q wave and S wave obtained in step 4 and the points marked by experts repeatedly, adjust the values of b and c to decide whether to skip to step 4, specifically:

S5.2A基于步骤4获得的R波,与通过反复与专家标注的R波进行比较,若准确度p21提高,则调整b的值,跳至步骤4;若准确度p21没有提高,则跳至步骤S5.2B;S5.2A Based on the R wave obtained in step 4, compare it with the R wave marked by experts repeatedly. If the accuracy p 21 is improved, adjust the value of b and skip to step 4; if the accuracy p 21 does not increase, then Skip to step S5.2B;

步骤S5.2B基于步骤4获得的Q波、S波,与通过反复与专家标注的Q波和S波比较,Step S5.2B is based on the Q wave and S wave obtained in step 4, compared with the Q wave and S wave marked by experts repeatedly,

若准确度p22、p23均提高,则调整c的值,跳至步骤4;若准确度p22、p23至少一个没有提高,则跳至步骤6。If both the accuracy p 22 and p 23 are improved, then adjust the value of c and skip to step 4; if at least one of the accuracy p 22 and p 23 is not improved, then skip to step 6.

步骤6、分别比较步骤3和步骤4的检测准确度,分别针对R波、Q波和S波,选择准确度高的检测方法,步骤5又包含如下步骤:Step 6, compare the detection accuracy of step 3 and step 4 respectively, respectively for R wave, Q wave and S wave, select the detection method with high accuracy, step 5 comprises the following steps again:

S6.1比较p11和p21的大小,若p11≥p21,则跳至步骤3,进行R波的提取,若p11<p21,则跳至步骤4,进行R波的提取;S6.1 Compare the size of p 11 and p 21 , if p 11 ≥ p 21 , skip to step 3 to extract the R wave, and if p 11 < p 21 , skip to step 4 to extract the R wave;

S6.2比较p12和p22的大小,若p12≥p22,则跳至步骤3,进行Q波的提取,若p12<p22,则跳至步骤4,进行Q波的提取;S6.2 Compare the size of p 12 and p 22 , if p 12 ≥ p 22 , skip to step 3 to extract Q wave, if p 12 < p 22 , skip to step 4 to extract Q wave;

S6.3比较p13和p23的大小,若p13≥p23,则跳至步骤3,进行S波的提取,若p13<p23,则跳至步骤4,进行S波的提取,本方法结束。S6.3 Compare the size of p 13 and p 23 , if p 13 ≥ p 23 , skip to step 3 to extract S wave, if p 13 < p 23 , skip to step 4 to extract S wave, This method ends.

需要说明的是,本说明书所述的仅为本发明的较佳实施例而已,以上实施例仅用于说明本发明的技术方案而非对本发明的限制。凡本领域技术人员依本发明的构思通过逻辑分析、推理或者有限的实验可以得到的技术方案,皆应在本发明的范围之内。It should be noted that what is described in this specification is only a preferred embodiment of the present invention, and the above embodiments are only used to illustrate the technical solution of the present invention rather than limit the present invention. All technical solutions obtained by those skilled in the art through logical analysis, reasoning or limited experiments according to the concept of the present invention shall fall within the scope of the present invention.

Claims (2)

1. An ECG feature extraction method fusing Butterworth filtering and wavelet transformation is characterized in that: carrying out denoising processing on the power frequency interference of the original ECG signal; simultaneously, baseline drift is removed by using a curve fitting mode; after relatively accurate ECG signals are obtained, respectively positioning Q waves, R waves and S waves by using a differential threshold value method and a wavelet transformation method, comparing the positioning Q waves, the R waves and the S waves with information labeled by experts, and respectively adjusting parameters of a threshold value, a scale and a translation quantity to obtain an optimal positioning result;
the method comprises the following steps:
step A,Performing spectral analysis on the original ECG signal to obtain the highest frequency and the lowest frequency, and filtering the original ECG signal by using a Butterworth filter to obtain a filtered ECG1A signal; step a further comprises the following substeps:
SA.1 analyzing the spectrum of the ECG signal by using the discrete Fourier transform method according to formula (1) to obtain the spectrum X (e) of the ECG signal) Further, the maximum frequency f of the ECG signal is obtained1And the lowest frequency f of the frequency bands of power frequency interference and other noise interference2
Wherein, X (e)) Is the frequency spectrum of the ECG signal, ω is the frequency of the ECG signal, and ECG (n) is the nth amplitude of the ECG signal;
in the obtained X (e)) The highest frequency of the middle and low frequency bands, i.e. the highest frequency f of the ECG signal1(ii) a The lowest frequency of the high frequency band is the lowest frequency f of the frequency band of power frequency interference and other noise interference2
SA.2 filtering the ECG signal with a Butterworth filter to obtain a filtered ECG signal1Specifically, butterworth filtering is performed by equation (2):
wherein N in formula (2) represents an integer set, | H (ω) | is a mode of the Butterworth filter, | H (ω) | does not include2Is the square of the mode; omegac(2πf1<ωc<2πf2) P (p ∈ N) is the order, which is the cut-off frequency of the Butterworth filter;
step B, ECG outputted from step A1Performing curve fitting, calculating polynomial coefficient and removing baseline drift to obtain signal after removing baseline drift, ECG2
Step B again comprises the following substeps:
sb.1 curve fitting is performed based on equation (3):
where y is the polynomial to be fitted, the order of the polynomial q (q e N), a0,a1,...,apIs the coefficient of a polynomial of order q, x being the sampling time series, xiIs the ith power of x;
SB.2, based on the formula (4), calculating polynomial coefficients in the formula (3);
wherein,is a vector composed of polynomial coefficients,for amplitude vectors of ECG signals, C ═ 1 xx2... xq]T,CTIs the transposition of C;
SB.3 obtaining the signal after baseline drift removal based on the formula (5);
ECG2=ECG1-y (5)
in equation (5), ECG2For removing the post-baseline-shift signal, ECG1Is a filtered signal; y is the output of equation (3);
step C, ECG output from step B2The signal uses a differential threshold method to position R waves, then position Q waves and S waves, and respectively output the positions of the R waves, the Q waves and the S waves;
step C in turn comprises the following substeps:
SC.1 sequentially calculates ECG based on equation (6) and equation (7)2A first order difference S (n) and a second order difference W (n) of the signals;
S(n)=ECG2(n)-ECG2(n-1) (6)
W(n)=S(n)-S(n-1) (7)
where S (n) is the nth first order difference, ECG2(n) is ECG2Nth amplitude of signal, ECG2(n-1) is ECG2The nth-1 amplitude of the signal, W (n) is the nth second order difference, and S (n-1) is the nth-1 first order difference;
SC.2 determines the maximum value max of S (n) output in step SC.1 by using an enumeration method1And maximum value max of W (n)2
SC.3 sets a threshold Y based on formula (8)1
Y1=m1·max1(0<m1<1) (8)
In equation (8), the threshold is Y1,m1Is an artificially set coefficient, and the range is (0, 1);
SC.4 judges whether there is a continuous k in S (n)1(k1E N) points exceeding Y1And ECG2(n) > 0, and according to the judgment result, the following operations are carried out:
SC.4A if there are consecutive k in S (n)1(k1E N) points exceeding Y1And ECG2(n) > 0, the point n is the R wave crest in the range, the position is R, and the jump is carried out to SC.5;
wherein k is1Is an integer of 2 or more;
SC.4B if there is no consecutive k in S (n)1(k1E N) points exceeding Y1Then k is1=k1-1, jump to step sc.4;
SC.5 sets the threshold value Y of the starting point based on the equations (9) and (10)2And an endpoint threshold Y3
Y2=m2·max2(0<m2<1) (9)
Y3=m3·max2(0<m3<1) (10)
In the formulas (9) and (10), the threshold values are Y2,Y3,m2,m3Is a coefficient set artificially;
SC.6 search and judge forward from each R waveWhether there is a succession of k in the section W (n)2(k2E is N) points less than Y2And according to the judgment result, the following operations are carried out:
SC.6A if W (n) has consecutive k2(k2E is N) points less than Y2The point n is the starting point s of the QRS wave with the range, and the jump is made to sc.5;
wherein k is2Is an integer of 2 or more;
SC.6B if there is no consecutive k in W (n)2(k2E is N) points less than Y2Then k is2=k2-1, jump to step sc.6;
SC.7 searches backward from each R wave to determine whether there are consecutive k in W (n)3(k3E is N) points less than Y3And according to the judgment result, the following operations are carried out:
wherein k is3Is an integer of 2 or more;
SC.7A if W (n) has consecutive k3(k3E is N) points less than Y3The point n is the end point e of the QRS wave with the point in the range, and the jump is carried out to SD.8;
SC.7B if there are no consecutive k in W (n)3(k3E is N) points less than Y3Then k is3=k3-1, jump to step sc.7;
sc.8 searches for an amplitude minimum value point Q in the range of the origin S of Q-wave, R-wave, and S-wave and the R-position where the R-wave is located, based on equation (11):
Q=min(ECG2(n)),(s<n<r) (11)
in formula (11), min (ECG)2(n)) is a search ECG2(n) a function of minima;
based on equation (12), an amplitude minimum value point S is searched for in the range of the R wave and the end point e:
S=min(ECG2(n)),(r<n<e) (12)
SC.9 compares the positions of the R wave, the Q wave and the S wave determined in the steps SC.4 and SC.8 with the positions marked by the experts, and based on the formula (13), the detection accuracy p of the R wave, the Q wave and the S wave is respectively obtained11,p12,p13
In the formula (13), the value of i is 1, 2, 3, N11,N12,N13The number of R wave, Q wave and S wave in ECG signal, N11 *,N12 *,N13 *Respectively detecting the number of correct R waves, Q waves and S waves;
step D, processing the ECG processed in the step B2The signal uses wavelet transform method to get wavelet decomposition pictures of different levels, then outputs Q, R, S wave position by detecting position and amplitude of wavelet transform coefficient modulus maximum; step D comprises the following steps:
SD.1 based on formulas (14) and (15), performing wavelet transformation on the ECG signal by using dual-orthogonal spline wavelets to obtain wavelet decomposition views under different levels;
wherein x is0(n)=ECG2(n), i.e. the processed ECG signal; z is a natural number set (the same below); x is the number of(j)(n) is xj-1(n) a dyadic wavelet transform of the high band signal on the j scale, d(j)(n) is xj-1(n) a dyadic wavelet transform of the low band signal on the j scale, hj-1(k),gj-1(k) A set kth set of orthogonal digital low pass filter and high pass filter coefficients, respectively;
SD.2, based on wavelet decomposition diagrams under different scales obtained by SD.1, detecting a maximum value point M and a minimum value point L of the amplitude for the waveform under the scale of c (c belongs to N); detecting a point with an amplitude value p (p is less than epsilon) between two points, wherein epsilon is a numerical value with the amplitude value approaching zero, and p is the position of an R wave of the original ECG signal;
SD.3 searches the mode minimum value of the R wave front position based on the R wave position p obtained by SD.2 and the waveform of b (b belongs to N) scale of formula (16), namely Q wave,
Q=x(b)(n)<x(b)(n-1),x(b)(n)<x(b)(n+1),(n<p) (16)
wherein x is(b)(n) is the amplitude of the nth sequence of the ECG signal on the b scale;
searching the mode minimum value of the position after the R wave, namely the S wave,
S=x(b)(n)<x(b)(n-1),x(b)(n)<x(b)(n+1),(n>p) (17)
wherein x is(b)(n) is the amplitude of the nth sequence of the ECG signal on the b scale;
SD.4 compares the positions of the R wave, the Q wave and the S wave detected in the steps SD.2 and SD.3 with the positions marked by experts, and respectively obtains the detection accuracy p of the R wave, the Q wave and the S wave based on a formula (18)21,p22,p23
In the formula (18), the value of i is 1, 2, 3, N21,N22,N23The number of R wave, Q wave and S wave in ECG signal, N21 *,N22 *,N23 *Respectively detecting the number of correct R waves, Q waves and S waves;
wherein, the step D and the step C can also exchange the sequence;
e, repeatedly adjusting artificially set parameters of a difference threshold method through R waves, Q waves and S waves labeled by experts, and repeatedly adjusting a wavelet transform hierarchy until accuracy is converged; step E also comprises the following steps:
SE.1 adjusting m based on R-, Q-and S-waves obtained in step C, respectively, and by repeated comparison with expert-labeled points1,m2,m3Respectively determining whether to jump to the step C, specifically:
SE.1A based on the R wave obtained in step C, and by repeating the process withComparing the R waves marked by the experts, and judging whether the accuracy is p11Increasing, then adjusting m1Jumping to step C; if accuracy p11If not, jumping to the step SE.1B;
step se.1b, based on the Q-wave obtained in step C, compares with the Q-wave labeled by the expert repeatedly,
if accuracy p12Increasing, then adjusting m2Jumping to step C; if accuracy p12If not, jumping to the step SE.1C;
step se.1c, based on the S-wave obtained in step C, compares with the S-wave labeled by the expert repeatedly,
if accuracy p13Increasing, then adjusting m3Jumping to step C; if accuracy p13If not, jumping to the step SE.2;
and SE.2, respectively based on the R wave, the Q wave and the S wave obtained in the step D and the points marked by the experts through repeated comparison, adjusting the values of b and c, and respectively determining whether to jump to the step D, wherein the specific steps are as follows:
SE.2A based on the R wave obtained in step D, compare with the R wave labeled by the expert through repetition, if the accuracy p21If yes, adjusting the value of b, and jumping to the step D; if accuracy p21If not, jumping to step SE.2B;
step se.2b is based on the Q-wave, S-wave obtained in step D, compared with the Q-wave and S-wave labeled by experts by iteration,
if accuracy p22、p23If the values are all increased, adjusting the value of c, and jumping to the step D; if accuracy p22、p23If at least one is not increased, jumping to the step F;
step F, respectively comparing the detection accuracy of the step C and the detection accuracy of the step D, and selecting a detection method with high accuracy aiming at the R wave, the Q wave and the S wave, wherein the step F comprises the following steps:
SF.1 comparison of p11And p21If p is the size of11≥p21Jumping to the step C to extract R wave, if p11<p21Jumping to the step D, and extracting R waves;
SF.2 comparison of p12And p22If p is the size of12≥p22Jumping to step C, extracting Q wave, if p12<p22Jumping to the step D, and extracting the Q wave;
SF.3 comparison of p13And p23If p is the size of13≥p23Jumping to step C, extracting S wave, if p13<p23And D, jumping to the step D to extract the S wave, and ending the method.
2. The method of extracting features of an ECG incorporating butterworth filtering and wavelet transformation as claimed in claim 1, wherein: step D and step C may also be in an alternating order.
CN201810429640.2A 2018-05-08 2018-05-08 A kind of ECG feature extracting method of fusion Butterworth filtering and wavelet transformation Active CN108836305B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810429640.2A CN108836305B (en) 2018-05-08 2018-05-08 A kind of ECG feature extracting method of fusion Butterworth filtering and wavelet transformation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810429640.2A CN108836305B (en) 2018-05-08 2018-05-08 A kind of ECG feature extracting method of fusion Butterworth filtering and wavelet transformation

Publications (2)

Publication Number Publication Date
CN108836305A true CN108836305A (en) 2018-11-20
CN108836305B CN108836305B (en) 2019-04-12

Family

ID=64212855

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810429640.2A Active CN108836305B (en) 2018-05-08 2018-05-08 A kind of ECG feature extracting method of fusion Butterworth filtering and wavelet transformation

Country Status (1)

Country Link
CN (1) CN108836305B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109542021A (en) * 2018-12-24 2019-03-29 广东理致技术有限公司 A kind of sensor weak signal data acquisition method and device
CN112244862A (en) * 2020-10-14 2021-01-22 哈尔滨理工大学 ECG Signal Denoising Algorithm Based on RFDA Wavelet Threshold
CN112611444A (en) * 2020-12-30 2021-04-06 西安和其光电科技股份有限公司 Distributed optical fiber vibration monitoring system and method capable of achieving accurate positioning

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5025794A (en) * 1988-08-30 1991-06-25 Corazonix Corporation Method for analysis of electrocardiographic signal QRS complex
CN101799974A (en) * 2010-03-12 2010-08-11 上海交通大学 Electrocardio signal transmission method based on self-adaptive codebook
CN101828916A (en) * 2010-05-07 2010-09-15 深圳大学 Electrocardiosignal processing system
US20160022164A1 (en) * 2009-11-03 2016-01-28 Vivaquant Llc Detecting fiducial points in physiological signals
CN106037720A (en) * 2015-12-04 2016-10-26 贵州大学 Application method of hybrid continuous information analysis technology in medicine
CN107693011A (en) * 2017-11-13 2018-02-16 湖北科技学院 A baseline filtering method for electrocardiogram signal
CN107788969A (en) * 2017-09-29 2018-03-13 成都瑞迪康医疗科技有限公司 The automatic testing method of QRS complex in a kind of electrocardiosignal

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5025794A (en) * 1988-08-30 1991-06-25 Corazonix Corporation Method for analysis of electrocardiographic signal QRS complex
US20160022164A1 (en) * 2009-11-03 2016-01-28 Vivaquant Llc Detecting fiducial points in physiological signals
CN101799974A (en) * 2010-03-12 2010-08-11 上海交通大学 Electrocardio signal transmission method based on self-adaptive codebook
CN101828916A (en) * 2010-05-07 2010-09-15 深圳大学 Electrocardiosignal processing system
CN106037720A (en) * 2015-12-04 2016-10-26 贵州大学 Application method of hybrid continuous information analysis technology in medicine
CN107788969A (en) * 2017-09-29 2018-03-13 成都瑞迪康医疗科技有限公司 The automatic testing method of QRS complex in a kind of electrocardiosignal
CN107693011A (en) * 2017-11-13 2018-02-16 湖北科技学院 A baseline filtering method for electrocardiogram signal

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109542021A (en) * 2018-12-24 2019-03-29 广东理致技术有限公司 A kind of sensor weak signal data acquisition method and device
CN112244862A (en) * 2020-10-14 2021-01-22 哈尔滨理工大学 ECG Signal Denoising Algorithm Based on RFDA Wavelet Threshold
CN112244862B (en) * 2020-10-14 2024-05-14 哈尔滨理工大学 Electrocardiogram signal denoising algorithm based on RFDA wavelet threshold
CN112611444A (en) * 2020-12-30 2021-04-06 西安和其光电科技股份有限公司 Distributed optical fiber vibration monitoring system and method capable of achieving accurate positioning

Also Published As

Publication number Publication date
CN108836305B (en) 2019-04-12

Similar Documents

Publication Publication Date Title
CN103549950B (en) Improved difference threshold detection algorithm for mobile ECG (electrocardiogram) monitoring
CN110236518B (en) Electrocardio and heart-shock signal combined classification method and device based on neural network
CN108272451B (en) QRS wave identification method based on improved wavelet transformation
CN104783787B (en) A kind of J wave detecting methods based on neutral net
CN105030228A (en) Method for determining P wave position of electrocardiosignal and device for realizing method
CN105212922A (en) The method and system that R wave of electrocardiosignal detects automatically are realized towards FPGA
CN108836305B (en) A kind of ECG feature extracting method of fusion Butterworth filtering and wavelet transformation
CN110090016B (en) Method and system for locating R-wave position, and automatic R-wave detection method using LSTM neural network
Zifan et al. Automated ECG segmentation using piecewise derivative dynamic time warping
Shaik et al. A method for QRS delineation based on STFT using adaptive threshold
Alhelal et al. FPGA-based denoising and beat detection of the ECG signal
CN109009087B (en) Rapid detection method for electrocardiosignal R wave
CN114587381A (en) Spike detection method based on multi-channel EEG intelligent screening and weighted sample generation
CN104382589B (en) Fetal electrocardiogram separation extraction method based on partial resampling by segments
Luengo et al. Blind analysis of atrial fibrillation electrograms: a sparsity-aware formulation
KR102451623B1 (en) Method and Apparatus for Comparing Features of ECG Signal with Difference Sampling Frequency and Filter Methods for Real-Time Measurement
CN110179456A (en) Electrocardio Noise Identification model training and electrocardio noise detecting method, device
Alhelal et al. Denoising and beat detection of ECG signal by Using FPGA
Khandait et al. ECG signal processing using classifier to analyses cardiovascular disease
Gómez-Herrero et al. Relative estimation of the Karhunen-Loève transform basis functions for detection of ventricular ectopic beats
Li et al. An automatic detection algorithm for T wave position based on T wave morphology
Mao et al. ECG Automatic Identification Method based on BP Neural
Wang et al. ECG Feature Wave Recognition Based on Adaptive Wavelet Thresholding Algorithm
Niknazar et al. Detection of characteristic points of ECG using quadratic spline wavelet transfrom
CN115153482B (en) Digital signal filtering processing method and system for blood flow graph

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant