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.
MovingAverageFilter.h
Go to the documentation of this file.
1 
31 #ifndef GRT_MOVING_AVERAGE_FILTER_HEADER
32 #define GRT_MOVING_AVERAGE_FILTER_HEADER
33 
34 #include "../CoreModules/PreProcessing.h"
35 
36 GRT_BEGIN_NAMESPACE
37 
38 class GRT_API MovingAverageFilter : public PreProcessing {
39 public:
46  MovingAverageFilter(UINT filterSize = 5,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(UINT filterSize,UINT numDimensions);
123 
130  Float filter(const Float x);
131 
138  VectorFloat filter(const VectorFloat &x);
139 
145  UINT getFilterSize() const { return filterSize; }
146 
152  VectorFloat getFilteredData() const { return processedData; }
153 
154  //Tell the compiler we are using the following functions from the MLBase class to stop hidden virtual function warnings
155  using MLBase::save;
156  using MLBase::load;
157 
158 protected:
159  UINT filterSize;
162 
164 };
165 
166 GRT_END_NAMESPACE
167 
168 #endif //GRT_MOVING_AVERAGE_FILTER_HEADER
169 
virtual bool deepCopyFrom(const PreProcessing *rhs)
Definition: PreProcessing.h:57
CircularBuffer< VectorFloat > dataBuffer
A buffer to store the previous N values, N = filterSize.
VectorFloat getFilteredData() const
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
UINT filterSize
The size of the filter.
virtual bool process(const VectorFloat &inputVector)
Definition: PreProcessing.h:73
UINT inputSampleCounter
A counter to keep track of the number of input samples.