A kind of step-recording method based on triaxial accelerometer and device
Technical field
The invention belongs to wearable device technical field, particularly relate to a kind of step-recording method based on triaxial accelerometer and device.
Background technology
Wearable device be can directly be through with it, or be incorporated into the portable set on clothing or other accessories.Meanwhile, wearable device generally uses triaxial accelerometer as counting equipment, completes step function.The triaxial accelerometer of wearable device can in forward direction, side direction, and the acceleration of vertical three orientation measurement human motions.Wherein, with reference to the sample figure that figure 1, Fig. 1 is three axle acceleration curves that hand-held wearable device walking obtains, with reference to figure 2, Fig. 2 is the sample figure of three axle acceleration curves that the running of hand-held wearable device obtains, and three axle acceleration curves comprise the accelerating curve of x-axis, y-axis, z-axis.
But the existing step of the step-recording method meter based on triaxial accelerometer algorithm, counts on the step number that wearer advances exactly three curves that cannot export from the triaxial accelerometer of wearable device.Its reason is in wearable device, the installation position of triaxial accelerometer is equipped with a variety of available selection, therefore identify that also there is a variety of selection in three directions of triaxial accelerometer, therefore in three directions, the possibility of the principal direction of wrong identification triaxial accelerometer also can be very large, when the principal direction of wrong identification triaxial accelerometer, the meter step number of the mistake that can draw, consume the time of the step number that statistics wearer advances, reduce the efficiency of the step number that statistics wearer advances, and reduce the accuracy rate of the step number that statistics wearer advances.
Summary of the invention
The object of the embodiment of the present invention is to provide a kind of step-recording method based on triaxial accelerometer, be intended to the existing step-recording method meter based on triaxial accelerometer step algorithm, three curves that cannot export from the triaxial accelerometer of wearable device, count on the problem of the step number that wearer advances exactly.
The embodiment of the present invention is achieved in that a kind of step-recording method based on triaxial accelerometer, comprising:
Obtain the accelerating curve of the x-axis of generation in real time in triaxial accelerometer, y-axis, z-axis, in the accelerating curve of x-axis, y-axis, z-axis, obtain accelerating curve the strongest regular axle, using the direction at axle place the strongest for regularity as principal direction, using the accelerating curve of the accelerating curve of axle the strongest for regularity as principal direction;
Adopt Predetermined filter, filtering is carried out to the accelerating curve of principal direction;
On the accelerating curve of described principal direction, choose undressed crest, when undressed crest appears at beyond processed crest preset time threshold, and the accekeration of undressed crest is when being greater than the acceleration rate threshold preset, statistics step number is added one, or, on the accelerating curve of described principal direction, choose undressed crest, when undressed crest appears at beyond processed crest preset time threshold, and the accekeration of undressed crest is when being less than default value with the difference of acceleration rate threshold preset, statistics step number is added one.
Another object of the embodiment of the present invention is to provide a kind of step count set based on triaxial accelerometer, comprising:
Accelerating curve acquisition module, for to obtain in triaxial accelerometer generate in real time x-axis, y-axis, z-axis accelerating curve, in the accelerating curve of x-axis, y-axis, z-axis, obtain accelerating curve the strongest regular axle, using the direction at axle place the strongest for regularity as principal direction, using the accelerating curve of the accelerating curve of axle the strongest for regularity as principal direction;
Filtration module, for adopting Predetermined filter, carries out filtering to the accelerating curve of principal direction;
Statistics step number module, for the accelerating curve in described principal direction, choose undressed crest, when undressed crest appears at beyond processed crest preset time threshold, and the accekeration of undressed crest is when being greater than the acceleration rate threshold preset, statistics step number is added one, or, on the accelerating curve of described principal direction, choose undressed crest, when undressed crest appears at beyond processed crest preset time threshold, and the accekeration of undressed crest is when being less than default value with the difference of acceleration rate threshold preset, statistics step number is added one.
In embodiments of the present invention, owing to obtaining accelerating curve the strongest regular axle, using the direction at axle place the strongest for regularity as principal direction, using the accelerating curve of the accelerating curve of axle the strongest for regularity as principal direction, on the accelerating curve of described principal direction, choose undressed crest, therefore the existing step-recording method meter based on triaxial accelerometer step algorithm is solved, the problem of the step number that wearer advances is counted on exactly three curves that cannot export from the triaxial accelerometer of wearable device, therefore the time counting on the step number that wearer advances can both be saved, also the accuracy of the step number that statistics wearer advances can be improved.
Accompanying drawing explanation
Fig. 1 is the sample figure of three axle acceleration curves that hand-held wearable device walking obtains;
Fig. 2 is the sample figure of three axle acceleration curves that the running of hand-held wearable device obtains;
Fig. 3 is the realization flow figure of a kind of step-recording method based on triaxial accelerometer that the embodiment of the present invention provides;
Fig. 4 is the realization flow figure of the step-recording method step S301 based on triaxial accelerometer that the embodiment of the present invention provides;
Fig. 5 is the implementing procedure figure presetting acceleration rate threshold that the embodiment of the present invention provides;
Fig. 6 is the implementing procedure figure of the renewal acceleration rate threshold that the embodiment of the present invention provides;
Fig. 7 is the structured flowchart of a kind of step count set based on triaxial accelerometer that the embodiment of the present invention provides.
Embodiment
In order to make object of the present invention, technical scheme and advantage clearly understand, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein only in order to explain the present invention, be not intended to limit the present invention.
embodiment one
With reference to the realization flow figure that figure 3, Fig. 3 is a kind of step-recording method based on triaxial accelerometer that the embodiment of the present invention provides, details are as follows:
In step S301, obtain the accelerating curve of the x-axis of generation in real time in triaxial accelerometer, y-axis, z-axis, in the accelerating curve of x-axis, y-axis, z-axis, obtain accelerating curve the strongest regular axle, using the direction at axle place the strongest for regularity as principal direction, using the accelerating curve of the accelerating curve of axle the strongest for regularity as principal direction;
Wherein, accelerating curve the strongest regular axle represents the axle that the periodicity of accelerating curve is the strongest.
In step s 302, adopt Predetermined filter, filtering is carried out to the accelerating curve of principal direction;
Wherein, the centre frequency of Predetermined filter and bandwidth can, for user is from establishing, also can be system default.
In step S303, on the accelerating curve of described principal direction, choose undressed crest, when undressed crest appears at beyond processed crest preset time threshold, and the accekeration of undressed crest is when being greater than the acceleration rate threshold preset, statistics step number is added one, or, on the accelerating curve of described principal direction, choose undressed crest, when undressed crest appears at beyond processed crest preset time threshold, and the accekeration of undressed crest is when being less than default value with the difference of acceleration rate threshold preset, statistics step number is added one.Wherein, preset time threshold is set based on experience value.Wherein, preset time threshold comprises walking preset time threshold and running time threshold.Arrange preset time threshold according to being: generally can not be slower than when people walks every two second one step, step p.s. five can not be exceeded during running.By above-mentioned foundation, preferably, walking preset time threshold is 0.5 second, and running time threshold is 0.2 second.
Wherein, in real time to generate in triaxial accelerometer x-axis, y-axis, z-axis the thread of accelerating curve detect, when the accelerating curve stopping generation x-axis, y-axis, z-axis being detected in triaxial accelerometer, stop statistics step number, and to the screen of triaxial accelerometer place equipment or voice device, export the step number of statistics, with the step number making the screen display of triaxial accelerometer place equipment add up, or the voice device of triaxial accelerometer place equipment plays the step number of statistics.
In embodiments of the present invention, owing to obtaining accelerating curve the strongest regular axle, using the direction at axle place the strongest for regularity as principal direction, using the accelerating curve of the accelerating curve of axle the strongest for regularity as principal direction, on the accelerating curve of described principal direction, choose undressed crest, therefore the existing step-recording method meter based on triaxial accelerometer step algorithm is solved, the problem of the step number that wearer advances is counted on exactly three curves that cannot export from the triaxial accelerometer of wearable device, therefore the time counting on the step number that wearer advances can both be saved, also the accuracy of the step number that statistics wearer advances can be improved.
embodiment two
With reference to the realization flow figure that figure 4, Fig. 4 is the step-recording method step S301 based on triaxial accelerometer that the embodiment of the present invention provides, details are as follows:
In step S401, obtain the accelerating curve of the x-axis of generation in real time in triaxial accelerometer, y-axis, z-axis, respectively in the accelerating curve of described x-axis, y-axis, z-axis, choose the crest of predetermined number;
Predetermined number can, for user is from establishing, also can be system default.
In step S402, in the crest of the predetermined number chosen, obtain every two ripple peak-to-peak time intervals, generate the standard deviation of the difference in every two ripple peak-to-peak time intervals, as the first parameter set describing accelerating curve regularity, described first parameter set comprises the first parameter of described x-axis, y-axis, z-axis;
In step S403, in the crest of the predetermined number chosen, according to the sampling interval preset, continuous three ripple peak-to-peak two ends accelerating curves are sampled, generate discrete point accekeration, and obtain the described discrete point accekeration of interval Preset Time, generate the standard deviation of the difference of the described discrete point accekeration of every two interval Preset Times, as the second parameter set of the accelerating curve regularity of this axle of description, described second parameter set comprises the second parameter of described x-axis, y-axis, z-axis;
In step s 404, according to described first parameter set, described second parameter set and the detection principal direction model that presets, generate detected parameters collection, described detected parameters collection comprises the detected parameters of described x-axis, y-axis, z-axis;
In step S405, according to detected parameters collection, accelerating curve the strongest regular axle is obtained, using the direction at axle place the strongest for regularity as principal direction, using the accelerating curve of the accelerating curve of axle the strongest for regularity as principal direction in x-axis, y-axis, z-axis.
In embodiments of the present invention, because input data are the accekeration that triaxial accelerometer exports in real time, all triaxial accelerometer MEMS (micro electro mechanical system) (MicroelectroMechanicalSystems can be adapted to, MEMS), therefore there is good portability, therefore in any one triaxial accelerometer MEMS system, accelerating curve the strongest regular axle can be obtained, follow-up can using the direction at axle place the strongest for regularity as principal direction, using the accelerating curve of the accelerating curve of axle the strongest for regularity as principal direction.
Embodiment three
The embodiment of the present invention essentially describes the implementing procedure set up and detect principal direction model, and details are as follows:
Set up and detect principal direction model;
Wherein,
represent scale-up factor, i represents sequence number, and i span is that 1 to 3, α i represents i-th the first parameter in the first parameter set, α
1, α
2, α
3represent the first parameter of x-axis, y-axis, z-axis respectively, θ i represents i-th the second parameter in the second parameter set, θ
1, θ
2, θ
3represent the second parameter of x-axis, y-axis, z-axis respectively, Δ i represents detected parameters collection i-th detected parameters, Δ
1, Δ
2, Δ
3represent the detected parameters of x-axis, y-axis, z-axis respectively.
In embodiments of the present invention, detect principal direction model by setting up, be convenient to follow-up can using the accelerating curve of the accelerating curve of axle the strongest for regularity as principal direction, and then on the accelerating curve of principal direction, choose undressed crest, complete step number statistics.
embodiment four
Be the implementing procedure figure presetting acceleration rate threshold that the embodiment of the present invention provides with reference to figure 5, Fig. 5, details are as follows:
In step S501, in the accelerating curve of principal direction, extract the accekeration of the crest of predetermined number;
In step S502, choose the intermediate value of the accekeration of the crest of predetermined number as acceleration rate threshold.
Wherein, extract the accekeration of the crest of predetermined number, be specially:
According in the accelerating curve of principal direction, according to the sequencing that crest generates, extract the crest of predetermined number.
Alternatively, as another embodiment of the embodiment of the present invention, preset acceleration rate threshold and also can choose the mean value of the accekeration of the crest of predetermined number as acceleration rate threshold.
In embodiments of the present invention, because acceleration rate threshold is setting up according on the basis on the accelerating curve of principal direction, therefore acceleration rate threshold has higher accuracy.
embodiment five
With reference to the implementing procedure figure that figure 6, Fig. 6 is the renewal acceleration rate threshold that the embodiment of the present invention provides, details are as follows:
In step s 601, in real time the accekeration of processed crest and described acceleration rate threshold are subtracted each other, generate acceleration difference;
Wherein, according to the rise time of the accekeration of processed crest, according to the priority of rise time, the accekeration of processed crest is sorted, the accekeration of the processed crest that extraction rise time from the existing time is nearest.
In real time the accekeration of the processed crest nearest extraction rise time from the existing time and described acceleration rate threshold are subtracted each other, generate acceleration difference.
In step S602, judge whether the absolute value of described acceleration difference is greater than default judgment threshold, then the accekeration of described processed crest is added with described acceleration rate threshold, generate additive value, and described acceleration rate threshold is updated to the half of described additive value, otherwise be left intact.
Wherein, judgment threshold represents with parameter C, and can generate parameter C according to following formula, details are as follows:
Wherein, X
maxfor in the crest of sampling, maximum accekeration, X
minfor in the crest of sampling, minimum accekeration.
Wherein, described acceleration rate threshold is updated to the half of described additive value, concrete implementing procedure is as follows:
A
tfor original acceleration rate threshold, A
t+1for the acceleration rate threshold upgraded, B represents the accekeration of the processed crest that rise time from the existing time is nearest.
Wherein, judge whether the absolute value of described acceleration difference is greater than default judgment threshold C, namely represents, in waveform, no matter B is at A
ttop or below, work as A
twith the distance between B is when being greater than judgment threshold C, just needs to upgrade acceleration rate threshold, obtain the acceleration rate threshold A upgraded
t+1.
In embodiments of the present invention, can make quick response to the accelerating curve of input, the change according to wearer's mode of motion adjusts acceleration rate threshold in real time, thus ensure that the accuracy of counting; Secondly, the input data of algorithm of the present invention are the accekeration that triaxial accelerometer exports in real time, are adapted to all triaxial accelerometer MEMS systems, have good portability.
embodiment six
The present embodiment essentially describes the present invention in the treatment scheme for people's accelerating curve when walking, and for ease of illustrating, for Fig. 1 and Fig. 3, details are as follows:
(1) regularity of x-axis, y-axis, z-axis is calculated.First, get front 10 peaks of axle, calculate the standard deviation of the difference in the time interval between any two as first parameter evaluating this axial period.Secondly, respectively analog to digital conversion is carried out to the two ends curve between three peaks, sampling frequency can be default, also can for user be from establishing, sampling frequency includes but not limited to 2400Hz, 4800Hz, 9600Hz, 22100Hz, 44200Hz, 48000Hz, calculates the standard deviation of corresponding position (relative time is equal) discrete point numerical value position difference as the second parameter evaluating this axial period.
(2) principal direction is calculated.Detecting principal direction model by adopting, comparing x-axis, y-axis, z-axis, the people when walking regularity of acceleration in x-axis direction is comparatively strong, therefore gets the principal direction of x-axis as counting.
(3) filtering.Get the accelerating curve of x-axis, use S filter to carry out filtering to it, remove clutter to the impact of algorithm.
(4) acceleration rate threshold is calculated.Get the accekeration of front 10 crests, calculate acceleration rate threshold and be about 0.85g.
(5) count.Get undressed crest on curve, if this crest appears at beyond processed crest 0.2 second, and its value is greater than acceleration rate threshold, then add up step number and add one.
(6) acceleration rate threshold is upgraded.If the crest value processed in (4) step and the difference of acceleration rate threshold are greater than acceleration rate threshold itself, then degree of will speed up threshold value is updated to the half of crest value and acceleration rate threshold sum, otherwise is left intact.
(7) repeat step (4) to step (5), obtaining statistics step number is 15 steps.
embodiment seven
The present embodiment essentially describes the present invention in the treatment scheme for people's accelerating curve when walking, is convenient to illustrate, for Fig. 2 and Fig. 4, details are as follows:
(1) regularity of x-axis, y-axis, z-axis is calculated.First, get front 10 peaks of axle, calculate the standard deviation of the difference in the time interval between any two as first parameter evaluating this axial period.Secondly, respectively analog to digital conversion is carried out to the two ends curve between three peaks, sampling frequency can be default, also can for user be from establishing, sampling frequency includes but not limited to 2400Hz, 4800Hz, 9600Hz, 22100Hz, 44200Hz, 48000Hz, calculates the standard deviation of corresponding position (relative time is equal) discrete point numerical value position difference as the second parameter evaluating this axial period.
(2) principal direction is calculated.By compare get the strongest regular y-axis place direction as the principal direction of counting.
(3) filtering.Get the accelerating curve of y-axis, use S filter to carry out filtering to it, remove clutter to the impact of algorithm.
(4) acceleration rate threshold is calculated.Using the accekeration of front 10 crests as sampling value, calculate acceleration rate threshold and be about 0.72g.
(5) count.Get undressed crest on curve, if this crest appears at beyond processed crest 0.2 second, and the difference that its value is greater than acceleration rate threshold or it and acceleration rate threshold is less than 0.1g, then add up step number and add one.
(6) acceleration rate threshold is upgraded.If the crest value processed in (4) step and the difference of acceleration rate threshold are greater than acceleration rate threshold itself, then degree of will speed up threshold value be updated to crest value and acceleration rate threshold and half, otherwise to be left intact.
(7) repeat step (4)-step (5), obtaining statistics step number is 25 steps.
embodiment eight
Fig. 7 is the structured flowchart of a kind of step count set based on triaxial accelerometer that the embodiment of the present invention provides, and this device can run on terminal.For convenience of explanation, illustrate only part related to the present embodiment.
With reference to Fig. 7, based on the step count set of triaxial accelerometer, should comprise:
Accelerating curve acquisition module 71, for to obtain in triaxial accelerometer generate in real time x-axis, y-axis, z-axis accelerating curve, in the accelerating curve of x-axis, y-axis, z-axis, obtain accelerating curve the strongest regular axle, using the direction at axle place the strongest for regularity as principal direction, using the accelerating curve of the accelerating curve of axle the strongest for regularity as principal direction;
Filtration module 72, for adopting Predetermined filter, carries out filtering to the accelerating curve of principal direction;
Statistics step number module 73, for the accelerating curve in described principal direction, choose undressed crest, when undressed crest appears at beyond processed crest preset time threshold, and the accekeration of undressed crest is when being greater than the acceleration rate threshold preset, statistics step number is added one, or, on the accelerating curve of described principal direction, choose undressed crest, when undressed crest appears at beyond processed crest preset time threshold, and the accekeration of undressed crest is when being less than default value with the difference of acceleration rate threshold preset, statistics step number is added one.
The first embodiment of the present embodiment, based in the step count set of triaxial accelerometer, described accelerating curve acquisition module, comprising:
Crest chooses unit, for obtain in triaxial accelerometer generate in real time x-axis, y-axis, z-axis accelerating curve, respectively in the accelerating curve of described x-axis, y-axis, z-axis, choose the crest of predetermined number;
First parameter set generation unit, for in the crest of the predetermined number chosen, obtain every two ripple peak-to-peak time intervals, generate the standard deviation of the difference in every two ripple peak-to-peak time intervals, as the first parameter set describing accelerating curve regularity, described first parameter set comprises the first parameter of described x-axis, y-axis, z-axis;
Second parameter set generation unit, for in the crest of the predetermined number chosen, according to the sampling interval preset, continuous three ripple peak-to-peak two ends accelerating curves are sampled, generate discrete point accekeration, and obtain the described discrete point accekeration of interval Preset Time, generate the standard deviation of the difference of the described discrete point accekeration of every two interval Preset Times, as the second parameter set of the accelerating curve regularity of this axle of description, described second parameter set comprises the second parameter of described x-axis, y-axis, z-axis;
Detected parameters collection detecting unit, for according to described first parameter set, described second parameter set and the detection principal direction model that presets, generate detected parameters collection, described detected parameters collection comprises the detected parameters of described x-axis, y-axis, z-axis;
Accelerating curve acquiring unit, for according to detected parameters collection, accelerating curve the strongest regular axle is obtained, using the direction at axle place the strongest for regularity as principal direction, using the accelerating curve of the accelerating curve of axle the strongest for regularity as principal direction in x-axis, y-axis, z-axis.
The second embodiment of the present embodiment, based on the step count set of triaxial accelerometer, also should comprise:
Setting up module, detecting principal direction model for setting up;
Wherein,
represent scale-up factor, i represents sequence number, and i span is that 1 to 3, α i represents i-th the first parameter in the first parameter set, α
1, α
2, α
3represent the first parameter of x-axis, y-axis, z-axis respectively, θ i represents i-th the second parameter in the second parameter set, θ
1, θ
2, θ
3represent the second parameter of x-axis, y-axis, z-axis respectively, Δ i represents detected parameters collection i-th detected parameters, Δ
1, Δ
2, Δ
3represent the detected parameters of x-axis, y-axis, z-axis respectively.
The third embodiment of the present embodiment, based on the step count set of triaxial accelerometer, also should comprise:
Accekeration extraction module, in the accelerating curve of principal direction, extracts the accekeration of the crest of predetermined number;
Acceleration rate threshold generation module, for the accekeration according to predetermined number and extraction, extracts the intermediate value of the accekeration of the crest of predetermined number as acceleration rate threshold.
The 4th kind of embodiment of the present embodiment, based on the step count set of triaxial accelerometer, also should comprise:
Acceleration difference generation module, subtracts each other the accekeration of processed crest and described acceleration rate threshold for real-time, generates acceleration difference;
Acceleration rate threshold update module, for judging whether the absolute value of described acceleration difference is greater than default judgment threshold, then the accekeration of described processed crest is added with described acceleration rate threshold, generate additive value, and described acceleration rate threshold is updated to the half of described additive value, otherwise be left intact.
The device that the embodiment of the present invention provides can be applied in the embodiment of the method for aforementioned correspondence, and details, see the description of above-described embodiment, do not repeat them here.
Through the above description of the embodiments, those skilled in the art can be well understood to the mode that the present invention can add required common hardware by software and realizes.Described program can be stored in read/write memory medium, described storage medium, as random access memory, flash memory, ROM (read-only memory), programmable read only memory, electrically erasable programmable storer, register etc.This storage medium is positioned at storer, and processor reads the information in storer, performs the method described in each embodiment of the present invention in conjunction with its hardware.
The above; be only the specific embodiment of the present invention, but protection scope of the present invention is not limited thereto, is anyly familiar with those skilled in the art in the technical scope that the present invention discloses; the change that can expect easily or replacement, all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection domain of claim.