过滤加速度计数据噪声 [英] Filtering accelerometer data noise
问题描述
如何过滤Android中加速度计数据的噪声?我想为我的样本数据创建一个高通滤波器,以便我可以消除低频分量并专注于高频分量.我已经读过卡尔曼滤波器可能是最好的候选者,但是我如何在我的应用程序中集成或使用这个方法,它主要是用 Android Java 编写的?或者可以首先完成吗?还是通过Android NDK?这是否有可能实时完成?
任何想法将不胜感激.谢谢!
Apple 的 SDK 中的示例实际上以更简单的方式实现了过滤,即使用斜坡:
<前>//斜坡速度 - 使用这个值直到满意const float kFilteringFactor = 0.1f;//最后的结果存储 - 在这个函数之外保留定义,例如.在包装对象中浮动加速度[3];//acceleration.x,.y,.z 是来自传感器的输入//result.x,.y,.z 是过滤后的结果//高通滤波器消除重力加速度[0] = 加速度.x * kFilteringFactor + 加速度[0] * (1.0f - kFilteringFactor);加速度[1] = 加速度.y * kFilteringFactor + 加速度[1] * (1.0f - kFilteringFactor);加速度[2] = 加速度.z * kFilteringFactor + 加速度[2] * (1.0f - kFilteringFactor);结果.x = 加速度.x - 加速度[0];结果.y = 加速度.y - 加速度[1];结果.z = 加速度.z - 加速度[2];How do I filter noise of the accelerometer data in Android? I would like to create a high-pass filter for my sample data so that I could eliminate low frequency components and focus on the high frequency components. I have read that Kalman filter might be the best candidate for this, but how do I integrate or use this method in my application which will mostly written in Android Java? or can it be done in the first place? or through Android NDK? Is there by any chance that this can be done in real-time?
Any idea will be much appreciated. Thank you!
The samples from Apple's SDK actually implement the filtering in an even simpler way which is by using ramping:
//ramp-speed - play with this value until satisfied const float kFilteringFactor = 0.1f; //last result storage - keep definition outside of this function, eg. in wrapping object float accel[3]; //acceleration.x,.y,.z is the input from the sensor //result.x,.y,.z is the filtered result //high-pass filter to eliminate gravity accel[0] = acceleration.x * kFilteringFactor + accel[0] * (1.0f - kFilteringFactor); accel[1] = acceleration.y * kFilteringFactor + accel[1] * (1.0f - kFilteringFactor); accel[2] = acceleration.z * kFilteringFactor + accel[2] * (1.0f - kFilteringFactor); result.x = acceleration.x - accel[0]; result.y = acceleration.y - accel[1]; result.z = acceleration.z - accel[2];
这篇关于过滤加速度计数据噪声的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!