GestureRecognitionToolkit  Version: 0.2.5
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
MovingAverageFilter.h
Go to the documentation of this file.
1 
28 #ifndef GRT_MOVING_AVERAGE_FILTER_HEADER
29 #define GRT_MOVING_AVERAGE_FILTER_HEADER
30 
31 #include "../CoreModules/PreProcessing.h"
32 
33 GRT_BEGIN_NAMESPACE
34 
38 class GRT_API MovingAverageFilter : public PreProcessing {
39 public:
46  MovingAverageFilter(const UINT filterSize = 5,const UINT numDimensions = 1);
47 
54 
58  virtual ~MovingAverageFilter();
59 
66  MovingAverageFilter& operator=(const MovingAverageFilter &rhs);
67 
76  virtual bool deepCopyFrom(const PreProcessing *preProcessing);
77 
86  virtual bool process(const VectorFloat &inputVector);
87 
95  virtual bool reset();
96 
104  virtual bool save(std::fstream &file) const;
105 
113  virtual bool load(std::fstream &file);
114 
122  bool init(const UINT filterSize,const UINT numDimensions);
123 
130  Float filter(const Float x);
131 
138  VectorFloat filter(const VectorFloat &x);
139 
145  UINT getFilterSize() const;
146 
152  VectorFloat getFilteredData() const;
153 
159  static std::string getId();
160 
161  //Tell the compiler we are using the following functions from the MLBase class to stop hidden virtual function warnings
162  using MLBase::save;
163  using MLBase::load;
164 
165 protected:
166  UINT filterSize;
169 
170 private:
171  static const std::string id;
173 };
174 
175 GRT_END_NAMESPACE
176 
177 #endif //GRT_MOVING_AVERAGE_FILTER_HEADER
178 
std::string getId() const
Definition: GRTBase.cpp:85
virtual bool deepCopyFrom(const PreProcessing *rhs)
Definition: PreProcessing.h:58
The MovingAverageFilter implements a low pass moving average filter.
CircularBuffer< VectorFloat > dataBuffer
A buffer to store the previous N values, N = filterSize.
virtual bool save(const std::string &filename) const
Definition: MLBase.cpp:167
virtual bool reset() override
UINT filterSize
The size of the filter.
virtual bool process(const VectorFloat &inputVector)
Definition: PreProcessing.h:74
UINT inputSampleCounter
A counter to keep track of the number of input samples.
virtual bool load(const std::string &filename)
Definition: MLBase.cpp:190