如何使用加速度计计算步数 [英] How to Count the Number of Steps Using the Accelerometer

查看:30
本文介绍了如何使用加速度计计算步数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何使用加速度计计算步数.实际上我计算加速度并使用此代码计算步数

i want to know how to calculate steps taken using the Accelerometer. Actually i calculate acceleration and use this code to count step

length = sqrt(x * x + y * y + z * z);
if(length>=2){
   stepcount+=1;
}

其中长度使用acceleration.x、acceleration.y、acceleration.z计算加速度但是我在启动应用程序时的主要问题是 stepcount 给出了正确的步长值,但随着时间的推移它的值不正确.请帮助我

where length calculate acceleration using acceleration.x, acceleration.y,acceleration.z But my main problem at starting the application the stepcount gives correct step value but as time pass its value is not correct.Plz help me

推荐答案

基本上,您将突然加速超过某个值作为某人正在结束或开始步骤的标志.

Basically you're using sudden acceleration over a certain value as a sign that someone is ending or starting a step.

首先,您必须确保对加速度计的采样频率足够高,不会错过任何一步.然后,您必须确保您正确地猜测了您的阈值应该是多少.

First, you have to make sure you end up sampling the accelerometer frequently enough not to miss a step. Then you're going to have to make sure that you are guessing correctly about what your threshold should be.

这将需要大量的反复试验.

This is going to require a lot of trial and error.

我的建议是绘制出长度随时间变化的图表,看看您是否可以提出一个通常正确的良好阈值.

What I would recommend is graphing out what the length is over time and seeing if you can come up with a good threshold value that's usually correct.

但是,无论如何,它永远不会真正准确.我认为真正准确测量步数的唯一方法是在鞋子中安装脚跟传感器.

But, regardless, it's never really going to be accurate. I think the only way to really measure steps accurately is with a heel sensor in the shoe.

这篇关于如何使用加速度计计算步数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆