上传者: weimouer
|
上传时间: 2021-08-27 16:44:26
|
文件大小: 335KB
|
文件类型: DLL
ButterWorth巴特沃斯滤波64B位 C++库,支持高通、低通、带通、带阻滤波。需要32位库请私信。
提供C#调用方法:
public static class ButterFilter
{
[DllImport("V_Filter.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public extern static void DeleteFilter(IntPtr filter);
[DllImport("V_Filter.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public extern static double FilterProcess(IntPtr filter, double data);
[DllImport("V_Filter.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public extern static IntPtr CreateHighPass(double sampleRate, double order, double cutoffFrequency);
[DllImport("V_Filter.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public extern static IntPtr CreateLowPass(double sampleRate, double order, double cutoffFrequency);
[DllImport("V_Filter.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public extern static IntPtr CreateBandPass(double sampleRate, double order, double centerFrequency, double bandWidth);
[DllImport("V_Filter.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public extern static IntPtr CreateBandStop(double sampleRate, double order, double centerFrequency, double bandWidth);
}
初始化滤波器:
lowpassFilter= ButterFilter.CreateLowPass(sampleRate, order, endFreq);
highpassFilter= ButterFilter.CreateHighPass(sampleRate, order, endFreq);
bandstopFilter= ButterFilter.CreateBandStop(sampleRate, order,beginFreq, endFreq - beginFreq);
bandPassFilter= ButterFilter.CreateBandPass(sampleRate, order,beginFreq, endFreq - beginFreq);
数据滤波:
value = ButterFilter.FilterProcess(highpassFilter, value);