UIAcceleration过滤 [英] UIAcceleration filtering

查看:168
本文介绍了UIAcceleration过滤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Apple指南中找到了下面的代码:

I found the following piece of code in apple guidelines:

- (void)accelerometer:(UIAccelerometer*)accelerometer didAccelerate:(UIAcceleration*)acceleration
{
    //Use a basic low-pass filter to only keep the gravity in the accelerometer values
    accel[0] = acceleration.x * kFilteringFactor + accel[0] * (1.0 - kFilteringFactor);
    accel[1] = acceleration.y * kFilteringFactor + accel[1] * (1.0 - kFilteringFactor);
    accel[2] = acceleration.z * kFilteringFactor + accel[2] * (1.0 - kFilteringFactor);
}

究竟做了什么?这个低通滤波器是什么?
为什么我必须申请?

What does it exactly do? What is this low-pass filter? Why do I have to apply it?

提前谢谢。

推荐答案

你需要做什么取决于你需要的价值,但基本的想法是减少手部运动等造成的振动的影响。如果你把原始加速度值作为重力矢量处理,你会得到很多抖动。

What you need to do depends on what you need the value for, but the basic idea is to reduce the effect of vibrations from hand movements and such. If you take the raw acceleration values and treat them as a gravity vector, you’ll get a lot of jitter.

这篇关于UIAcceleration过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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