GestureRecognitionToolkit  Version: 0.2.0
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
FIRFilter.h
Go to the documentation of this file.
1 
29 #ifndef GRT_FIR_FILTER_HEADER
30 #define GRT_FIR_FILTER_HEADER
31 
32 #include "../CoreModules/PreProcessing.h"
33 
34 GRT_BEGIN_NAMESPACE
35 
36 class GRT_API FIRFilter : public PreProcessing{
37 public:
38  enum FilterTypes{LPF=0, HPF, BPF};
39 
53  FIRFilter(const UINT filterType = LPF,const UINT numTaps = 50,const Float sampleRate = 100,const Float cutoffFrequency = 10,const Float gain = 1,const UINT numDimensions = 1);
54 
60  FIRFilter(const FIRFilter &rhs);
61 
65  virtual ~FIRFilter();
66 
73  FIRFilter& operator=(const FIRFilter &rhs);
74 
83  virtual bool deepCopyFrom(const PreProcessing *preProcessing);
84 
93  virtual bool process(const VectorFloat &inputVector);
94 
102  virtual bool reset();
103 
110  virtual bool clear();
111 
119  virtual bool save( std::fstream &file ) const;
120 
128  virtual bool load( std::fstream &file );
129 
135  bool buildFilter();
136 
143  Float filter(const Float x);
144 
151  VectorFloat filter(const VectorFloat &x);
152 
158  UINT getFilterType() const;
159 
165  UINT getNumTaps() const;
166 
172  Float getSampleRate() const;
173 
179  Float getCutoffFrequency() const;
180 
186  Float getCutoffFrequencyLower() const;
187 
193  Float getCutoffFrequencyUpper() const;
194 
200  Float getGain() const;
201 
207  Vector< VectorFloat > getInputBuffer() const;
208 
214  VectorFloat getFilterCoefficents() const;
215 
222  bool setFilterType(const UINT filterType);
223 
232  bool setNumTaps(const UINT numTaps);
233 
240  bool setSampleRate(const Float sampleRate);
241 
249  bool setCutoffFrequency(const Float cutoffFrequency);
250 
259  bool setCutoffFrequency(const Float cutoffFrequencyLower,const Float cutoffFrequencyUpper);
260 
267  bool setGain(const Float gain);
268 
269  //Tell the compiler we are using the following functions from the MLBase class to stop hidden virtual function warnings
270  using MLBase::save;
271  using MLBase::load;
272 
273 protected:
274  UINT filterType;
275  UINT numTaps;
276  Float sampleRate;
277  Float cutoffFrequency;
278  Float cutoffFrequencyLower;
279  Float cutoffFrequencyUpper;
280  Float gain;
282  VectorFloat z;
283 
284  static RegisterPreProcessingModule< FIRFilter > registerModule;
285 };
286 
287 GRT_END_NAMESPACE
288 
289 #endif //GRT_FIR_FILTER_HEADER
virtual bool deepCopyFrom(const PreProcessing *rhs)
Definition: PreProcessing.h:57
virtual bool save(const std::string filename) const
Definition: MLBase.cpp:143
virtual bool reset()
virtual bool load(const std::string filename)
Definition: MLBase.cpp:167
virtual bool process(const VectorFloat &inputVector)
Definition: PreProcessing.h:73
virtual bool clear()