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.
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 
37 class GRT_API WeightedAverageFilter : public PreProcessing {
38 public:
45  WeightedAverageFilter(UINT filterSize = 5,UINT numDimensions = 1);
46 
53 
57  virtual ~WeightedAverageFilter();
58 
65  WeightedAverageFilter& operator=(const WeightedAverageFilter &rhs);
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 save( std::fstream &file ) const;
104 
112  virtual bool load( 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 
152  //Tell the compiler we are using the following functions from the MLBase class to stop hidden virtual function warnings
153  using MLBase::save;
154  using MLBase::load;
155 
156 protected:
157  UINT filterSize;
162 };
163 
164 GRT_END_NAMESPACE
165 
166 #endif //GRT_MOVING_AVERAGE_FILTER_HEADER
167 
virtual bool deepCopyFrom(const PreProcessing *rhs)
Definition: PreProcessing.h:57
UINT inputSampleCounter
A counter to keep track of the number of input samples.
CircularBuffer< VectorFloat > dataBuffer
A buffer to store the previous N values, N = filterSize.
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
VectorFloat getFilteredData() const
VectorFloat weights
Stores the weights for each sample in the buffer, the size of this vector will match the filterSize...