GestureRecognitionToolkit  Version: 0.1.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 
39 public:
46  MovingAverageFilter(UINT filterSize = 5,UINT numDimensions = 1);
47 
54 
58  virtual ~MovingAverageFilter();
59 
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 saveModelToFile(std::string filename) const;
105 
113  virtual bool saveModelToFile(std::fstream &file) const;
114 
122  virtual bool loadModelFromFile(std::string filename);
123 
131  virtual bool loadModelFromFile(std::fstream &file);
132 
140  bool init(UINT filterSize,UINT numDimensions);
141 
148  Float filter(const Float x);
149 
156  VectorFloat filter(const VectorFloat &x);
157 
163  UINT getFilterSize() const { return filterSize; }
164 
170  VectorFloat getFilteredData() const { return processedData; }
171 
172 protected:
173  UINT filterSize;
176 
178 };
179 
180 GRT_END_NAMESPACE
181 
182 #endif //GRT_MOVING_AVERAGE_FILTER_HEADER
virtual bool process(const VectorFloat &inputVector)
CircularBuffer< VectorFloat > dataBuffer
A buffer to store the previous N values, N = filterSize.
virtual bool deepCopyFrom(const PreProcessing *preProcessing)
virtual bool loadModelFromFile(std::string filename)
VectorFloat getFilteredData() const
Float filter(const Float x)
virtual bool saveModelToFile(std::string filename) const
UINT filterSize
The size of the filter.
MovingAverageFilter(UINT filterSize=5, UINT numDimensions=1)
MovingAverageFilter & operator=(const MovingAverageFilter &rhs)
UINT inputSampleCounter
A counter to keep track of the number of input samples.