问题描述
我试图在Java中实现一个低通滤波器。我的要求非常简单,我必须消除特定频率(单一维度)以外的信号。看起来像巴特沃斯过滤器将适合我的需要。现在重要的是CPU时间应尽可能低。过滤器将会有近一百万个样本需要处理,而且我们的用户不喜欢等待太久。是否有任何现成的Butterworth滤波器具有最佳的滤波算法。
问候,
Chaitannya
我有一个页面描述了一个非常简单的,非常低CPU的低通滤波器,也能够独立于帧率。我使用它来平滑用户输入和经常绘制帧率。
在简而言之,在你的更新循环中:
$ b
//如果你有一个固定的帧速率$ b $如果你有一个不同的帧速率
smoothedValue + = timeSinceLastUpdate *(newValue - smoothedValue)/ smoothing
smoothedValue + =(newValue - smoothedValue)/ smoothing
code $
$ b $ 平滑
1的值
不会导致平滑,而较高的值会使结果越来越平滑。
页面有几个用JavaScript编写的函数,但是公式是语言不可知的。
I am trying to implement a low pass filter in Java. My requirement is very simple,I have to eliminate signals beyond a particular frequency (Single dimension). Looks like Butterworth filter would suit my need.
Now the important thing is that CPU time should be as low as possible. There would be close to a million sample the filter would have to process and our users don't like waiting too long. Are there any readymade implementation of Butterworth filters which has optimal algorithms for filtering.
Regards,
Chaitannya
解决方案 I have a page describing a very simple, very low-CPU low-pass filter that is also able to be framerate-independent. I use it for smoothing out user input and also for graphing frame rates often.
http://phrogz.net/js/framerate-independent-low-pass-filter.html
In short, in your update loop:
// If you have a fixed frame rate
smoothedValue += (newValue - smoothedValue) / smoothing
// If you have a varying frame rate
smoothedValue += timeSinceLastUpdate * (newValue - smoothedValue) / smoothing
A smoothing
value of 1
causes no smoothing to occur, while higher values increasingly smooth out the result.
The page has a couple of functions written in JavaScript, but the formula is language agnostic.
这篇关于如何使用java实现低通滤波器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!