The method and system that is used for heart rate measurement
Technical field
The present invention relates to a kind of method and system that is used for heart rate measurement, more particularly, relate to and a kind ofly detecting and method and system that the heart rate of individuality is measured through QRS wave group to the ECG signal to be detected (ECG) of individuality.
Background technology
When the heartbeat of individuality, electric signal streams is crossed heart, and it can be obtained through the appropriate device that is connected on the individual skin.Typical and complete ECG signal comprises and is considered to the complete waveform that is made up of P ripple, Q ripple, R ripple, S ripple and T ripple that wherein, Q ripple, R ripple and S ripple are called formation " QRS wave group " sometimes jointly.Generally speaking, the P ripple is produced by the depolarization in atrium, and the QRS wave group is produced by the depolarization of ventricle, and the T ripple is produced by the polarization again of ventricular muscle.Usually, the R ripple is the most significant ripple in the waveform of whole ECG signal, has that waveform is precipitous, amplitude big, a narrow width, the characteristics that are easy to discern.Therefore, individual heart rate can detect through the number to the R ripple of ECG signal in the unit interval and be determined.
At present, there has been multiple heart rate monitor to be provided on the market this R ripple or QRS wave group have been detected, and then detected heart rate at body surface.Heart rate monitor comprises two parts at least, is respectively a pulse sensing unit and a heart rate display unit, and wherein this pulse sensing unit comprises a pick off (or electrode) and a filter circuit.This device can obtain through the pulse pressure pick off and be placed individual ECG signal.In order accurately to respond to pulse signal, the pulse pressure pick off must be highly stable with contacting of skin, yet during the heart rate when measuring motion, the vibrations of pulse sensing unit are easy to cause generating noise.And ECG signal and noise level thereof vary with each individual.Even for same individual, they also can time to time change.
Though in order to address this problem, had several different methods to be suggested, most methods all has following one or more shortcoming: poor anti jamming capability, to doctor's experience pay attention to not enough, calculation of complex and/or real-time not enough.
Summary of the invention
The technical problem that the present invention will solve is, to above-mentioned method for measuring heart rate poor anti jamming capability, doctor's experience is paid attention to defectives such as not enough, calculation of complex and/or real-time are not enough, a kind of method and system that are used for heart rate measurement is provided.
The technical solution adopted for the present invention to solve the technical problems is: construct a kind of method that is used for heart rate measurement, comprising:
(a), gather the heartbeat waveform data, and be spaced apart the cycle with the very first time and read said heartbeat waveform data, the said very first time contains once heart beating at interval at least;
(b), according to the heartbeat waveform data computation threshold value at least two nearest cycles;
(c), gather the heartbeat waveform data in the next cycle, according to the R ripple in the threshold decision QRS wave group and write down the number of times of R ripple in this cycle;
(d), judge whether to reach the preset detection time, if not, execution in step (b); If the R ripple number of times of then adding up in the said preset detection time is exported as heart rate.
In the method that is used for heart rate measurement of the present invention; In said step (b), comprise: according to this heartbeat waveform data maximum of heartbeat waveform data computation in each cycle of gathering and the difference of minima, the heartbeat waveform data of taking off one-period if said difference is lower than predetermined value replace the heartbeat waveform data in this cycle to carry out threshold calculations.
In the method that is used for heart rate measurement of the present invention, in step (b), may further comprise the steps:
(b1) get at least two interior heartbeat waveform data of cycle recently, and calculate the maximum difference value and the maximum waveform values of the heartbeat waveform data in said at least two cycles respectively;
(b2) be taken to the maximum difference value of the heartbeat waveform data in few two cycles and arithmetic average delta0, the avgh of maximum waveform values, according to following formula:
C1=0.4*delta0
C2=5*C1/9
G1=0.4*avgh
Obtain three judgment threshold C1, C2, G1.
In the method that is used for heart rate measurement of the present invention; Gather the heartbeat waveform data with second interval in the said step (a); Said second interval is 1/500 of very first time interval, and the heartbeat waveform data in said at least two cycles only write down the maximum difference value of heartbeat waveform in each said cycle and the minimum and maximum value of heartbeat waveform; In step (c), the heartbeat waveform data in the said next cycle need write down each heartbeat waveform value of gathering with said second interval in the said cycle.
In the method that is used for heart rate measurement of the present invention, in step (c), judge that the process of R ripple comprises: the Q point of judging the QRS wave group earlier; Judge the R point of QRS wave group again; After finding the Q point of QRS wave group, flag state X, find the R point of QRS wave group after; Flag state Y is with the process of status indication X, Y marker for judgment R ripple.
In the method that is used for heart rate measurement of the present invention, in the said step (c), whenever find the R ripple of a QRS wave group, jump the judgement that 20~25 heartbeat waveform data are carried out the R ripple more backward.
In the method that is used for heart rate measurement of the present invention, in step (c), saidly skip 20~25 heartbeat waveform data and comprise the heartbeat waveform data in the next cycle.
In the method that is used for heart rate measurement of the present invention, in step (d), be meant said detection time from the beginning image data to the time that stops data collection.
In the method that is used for heart rate measurement of the present invention; When in step (d), adding up R ripple number of times, if effective time is 60s, the R ripple number of getting in this 60s is that the heart beating number of times is a heart rate; If the not enough 60s of effective time; Then get the interval of nearest two R ripples, the R ripple number that should occur in the calculating 60s is as heart rate, and said effective time is meant has carried out all very first time interlude sums that the R ripple is judged.
The present invention also provides a kind of system that is used for heart rate measurement, comprises data acquisition unit, memory element, threshold calculations unit, judging unit and statistic unit:
Said data acquisition unit is used to gather the heartbeat waveform data;
Memory element is used to store the data of said collection;
Computing unit is used for data computing;
Judging unit further is divided into first judging unit and second judging unit, and first judging unit is used to judge the R ripple, and second judging unit is used to judge whether to reach detection time;
Statistic unit, the R ripple number of times that is used to add up in the said preset detection time is exported as heart rate.
The present invention is used for the method and system of heart rate measurement; It uses segmentation self study, difference, the comprehensive method of judging of amplitude; Solve poor anti jamming capability, doctor's experience is paid attention to problems such as not enough, calculation of complex and/or real-time are not enough, realize identification, and then measure heart rate the R ripple.And only need write down the heartbeat waveform value and the data that are used for threshold calculations of current period, practice thrift internal memory.
Description of drawings
To combine accompanying drawing and embodiment that the present invention is described further below, in the accompanying drawing:
Fig. 1 is a QRS oscillogram according to an embodiment of the invention;
Fig. 2 is the flow chart that the present invention is used for the method embodiment of heart rate measurement;
Fig. 3 is the block diagram that the present invention is used for the system embodiment of heart rate measurement.
The specific embodiment
Embodying characteristic of the present invention will combine accompanying drawing to be described in detail in the explanation of back segment with some exemplary embodiments of advantage.Be understood that the present invention can have various variations on various embodiment, its neither departing from the scope of the present invention, and explanation wherein and accompanying drawing be used as the usefulness of explanation in itself, but not in order to restriction the present invention.
As shown in Figure 1, be the QRS oscillogram of one embodiment of the invention.When the Q point, the heartbeat waveform value rises suddenly, and the unexpected forward of difference at this moment becomes big, can detect this Q point with first difference threshold value C1.But the point that satisfies this condition also might be an accidental fluctuation, rises in order to ensure waveform after this point, and certain height is arranged, and also will judge with the threshold value G1 of height.After finding the Q point, because the waveform after the Q point is constantly rising, promptly difference is for just; Waveform descends suddenly after the R ripple; And R point waveform is the most precipitous, and difference is maximum in the whole QRS waveform for negative and absolute value, so can judge with second threshold value C2 of difference.
As shown in Figure 2, be the flow chart of an embodiment of method for measuring heart rate of the present invention.In the present embodiment, this method for measuring heart rate comprises:
Beginning;
Step S1: be spaced apart the cycle with the very first time and gather the heartbeat waveform data, whenever gather a secondary data at a distance from second interval, said second interval is 1/500 of very first time interval;
Step S2: the heartbeat waveform data of gathering at least two cycles; Write down the maximum difference (adjacent two vertical values is poor in the heartbeat waveform) of data in these several cycles and the minimum and maximum value of heartbeat waveform; Calculate the poor of at interval interior heartbeat waveform maximum of each very first time and minima; Judge that signal has or not or power; If difference be lower than predetermined value can regard as wear bad, do not wear or should not have heart beating in the cycle; The heartbeat waveform data of taking off one-period replace the heartbeat waveform data in this cycle to carry out threshold calculations, get the maximum difference value of data in said at least two cycles and arithmetic average delta0, the avgh of maximum waveform values respectively, according to following formula:
C1=0.4*delta0
C2=5*C1/9
G1=0.4*avgh
Can calculate three judgment threshold C1, C2 and G1;
Step S3: gather the heartbeat waveform data in the next cycle,, travel through the heartbeat waveform data in this cycle according to 3 threshold value C1, C2 and G1 of nearest calculating; During greater than G1, judge that this is the Q point greater than C1 and waveform values when finding a point to satisfy difference, and flag state X; Continue to seek backward and satisfy the point of difference value less than-C2, this point is the R ripple, flag state Y; Status indication X, Y are used for the process of marker for judgment R ripple, the number of times of R ripple in the minute book cycle;
Step S4: judge whether to reach the preset detection time, if not, execution in step S2 is if execution in step S5 is meant from the beginning image data to the time that stops data collection said detection time;
Step S5: if effective time is 60s; The R ripple number of getting in this 60s is that the heart beating number of times is a heart rate; If the not enough 60s of effective time; Then get the interval of nearest two R ripples, the R ripple number that should occur in the calculating 60s is as heart rate, and said effective time is meant has carried out all very first time interlude sums that the R ripple is judged;
Finish.
As shown in Figure 3, be the block diagram that the present invention is used for the system of heart rate measurement.This system comprises data acquisition unit 31, memory element 32, computing unit 33, judging unit 34 and statistic unit 35.
Data acquisition unit 31 can be the pulse pressure pick off, is used to gather the heartbeat waveform data.In one embodiment of the invention, be very first time interval with 2s, be that second interval is gathered the heartbeat waveform data with 4ms.
Memory element 32 can be various memorizeies, is used to store by data acquisition unit 31 gather the data of coming.
In one embodiment of the invention, be to save the RAM resource, only the Wave data in the nearest 2s is recorded among the array AD [500] who deposits 500 integers (every 4ms adopts a waveform values, 500 of 2s), shown in form one totally.In this embodiment; Get the data of 5 2s intervals and carry out the calculating of threshold value; The every 2s of program calculates maximum difference, maximum and minima circulation in this 2s interval to the data in the array and is temporary among the structural array food [5] who deposits 5 groups of data, shown in form two.Owing to be that circulation writes, what deposit among the food [5] is the data in the nearest 10s forever.Traditional algorithm need calculate according to the collection value of a period of time when calculated threshold; Need to suppose 10s time calculated threshold; Will deposit the data of 10s, and the present invention only needs among the 10s maximum difference value and maximum waveform values in 5 2s cycles when considering calculated threshold, so only deposit maximum difference value and the maximum waveform values in the 10s; Totally 10 numbers; And be used to 5 minimum waveform values judging that signal has or not, and add the image data in nearest 2s cycle, poke is a little more than 1/5 of traditional algorithm in needing.
In the initial 10s of program running, need not to detect the R ripple; Only maximum difference, maximum and minima in 5 2s intervals are recorded in the structural array; Behind the 10s; The value that every 2s gets in the structural array is calculated C1, C2, three threshold values of G1, and carries out the detection of R ripple with the current data of depositing in the array of heartbeat waveform value of depositing, with leaving among the array q [30] that can deposit 30 integers of detected heart beating number of cycles; What deposit among the q [30] like this is exactly the heart beating number of times in nearest 30 * 2s=60s, only need the summation of the data among the q [30] be heart beating number of times---the heart rate in the 60s.
2482 |
2486 |
2523 |
..................................... |
2485 |
Form one
Sequence number |
Maximum difference |
Maximum |
Minima |
1 |
67 |
2556 |
2475 |
2 |
75 |
2578 |
2456 |
3 |
64 |
2601 |
2468 |
4 |
86 |
2635 |
2486 |
5 |
45 |
2532 |
2485 |
Form two
Computing unit 33 is used for data computing.Said computing unit 33 can calculate each very first time at interval in maximum waveform values and minimum waveform values poor, to judge that signal has or not or power.Said computing unit 33 all right calculated threshold; In one embodiment of the invention; Computing unit 33 reads maximum difference value and the maximum waveform values in nearest 5 intervals from memory element 32; Remove the minimum and maximum value in 5 maximum difference values and 5 the maximum waveform values respectively, get arithmetic average delta0, avgh respectively for remaining 3, according to following formula:
C1=0.4*delta0
C2=5*C1/9
G1=0.4*avgh
Calculate 3 judgment thresholds.
In this embodiment, are 4ms owing to whenever adopt the cycle of heartbeat waveform data, the time that must guarantee to calculate could guarantee when calculating, to be unlikely to lose the waveform values record less than 4ms.Through test, do not lose the possibility of waveform values record computation time about 2.5ms.
First judging unit 341 is used to judge the R ripple.In one embodiment of the invention; Shown in first judging unit 341 read the heartbeat waveform data of nearest 2s from memory element 32, read 3 up-to-date threshold values from computing unit 33, then each heartbeat waveform data relatively successively; When finding a point to satisfy difference greater than C1 and waveform values during greater than G1; Judge that this is the Q point, continue to seek backward and satisfy the point of difference value that this point is the R ripple less than-C2.
After the R ripple, also have a T point,, in one embodiment of the invention, find the R ripple to jump 25 4ms afterwards backward, escape the vein pulse T that occurs subsequently for preventing that with the erroneous judgement of T point be a R ripple.If a successive image data only need add 25 with the subscript value of used storage array AD [500] and get final product.But in another embodiment of the present invention; Have only 500 heartbeat waveform values in the nearest 2s; When the R ripple appears at 25 last 4ms, i.e. position P>475 o'clock, K=0 begins to guarantee skipping of vein pulse if next 2s is from the position; So when the position of last R ripple P>475, guarantee to jump 25 4ms cycles just need begin from K=25-(500-P)=P-475 backward at next 2s.
In one embodiment of the invention, because normal heartbeat waveform is divided into isolating several 2s intervals, the Q point appears at previous 2s interval and the R point appears at a back 2s interval; In order to realize the connection of two 2s intervals, define a state variable status, initial value is 0; Status puts 1 after finding the Q point; Be flag state X, find R point back status to revert to initial value 0, i.e. flag state Y.Even find the Q point at previous 2s interval like this, status 1 has write down this state, when next cycle, directly seeks the point that satisfies less than-C2 and is the R ripple, prevents that next interval from going for the Q point again.Design has realized the connection of adjacent two 2s intervals like this.
Second judging unit 342 is used to judge whether to reach detection time.In one embodiment of the invention; The predetermined detection time is 70s; Reached 70s detection time if the enumerator in said second judging unit 342 shows, this judging unit sends signal designation data collecting unit 31 and stops data collection, and indicates statistic unit 35 to begin to add up heart rate simultaneously; Also be less than 70s detection time if said enumerator shows, then do not send signal.
Statistic unit 35 is used to add up heart rate.Said statistic unit 35 is noted the number of the R ripple that first judging unit 341 is judged, stores in the memory element 32, from memory element 32, reads the information of the R ripple number of said storage at last, carries out the statistics of heart rate.
In one embodiment of the invention, in the preceding 60s that wears,, can't obtain the heart beating number of times of nearest 60s truly owing to deficiency of time 60s.So do inference process, the interval of getting nearest two R ripples is as the foundation of calculating, calculates the R ripple number that should occur in the 60s as heart rate.
The above is merely embodiments of the invention, not in order to restriction the present invention, all any modifications of in spirit of the present invention and principle, being done, is equal to and replaces or improvement etc., all should be included in protection scope of the present invention.