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.
WeightedAverageFilter.h
Go to the documentation of this file.
1 
30 #ifndef GRT_WEIGHTED_AVERAGE_FILTER_HEADER
31 #define GRT_WEIGHTED_AVERAGE_FILTER_HEADER
32 
33 #include "../CoreModules/PreProcessing.h"
34 
35 GRT_BEGIN_NAMESPACE
36 
38 public:
45  WeightedAverageFilter(UINT filterSize = 5,UINT numDimensions = 1);
46 
53 
57  virtual ~WeightedAverageFilter();
58 
66 
75  virtual bool deepCopyFrom(const PreProcessing *preProcessing);
76 
85  virtual bool process(const VectorFloat &inputVector);
86 
94  virtual bool reset();
95 
103  virtual bool saveModelToFile( std::fstream &file ) const;
104 
112  virtual bool loadModelFromFile( std::fstream &file );
113 
121  bool init(UINT filterSize,UINT numDimensions);
122 
129  Float filter(const Float x);
130 
137  VectorFloat filter(const VectorFloat &x);
138 
144  UINT getFilterSize() const { return filterSize; }
145 
150  VectorFloat getFilteredData() const { return processedData; }
151 
154 
155 protected:
156  UINT filterSize;
161 };
162 
163 GRT_END_NAMESPACE
164 
165 #endif //GRT_MOVING_AVERAGE_FILTER_HEADER
UINT inputSampleCounter
A counter to keep track of the number of input samples.
WeightedAverageFilter & operator=(const WeightedAverageFilter &rhs)
virtual bool loadModelFromFile(std::fstream &file)
CircularBuffer< VectorFloat > dataBuffer
A buffer to store the previous N values, N = filterSize.
virtual bool deepCopyFrom(const PreProcessing *preProcessing)
WeightedAverageFilter(UINT filterSize=5, UINT numDimensions=1)
virtual bool loadModelFromFile(std::string filename)
virtual bool process(const VectorFloat &inputVector)
UINT filterSize
The size of the filter.
virtual bool saveModelToFile(std::fstream &file) const
virtual bool saveModelToFile(std::string filename) const
Float filter(const Float x)
VectorFloat getFilteredData() const
VectorFloat weights
Stores the weights for each sample in the buffer, the size of this vector will match the filterSize...