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.
MedianFilter.h
Go to the documentation of this file.
1 
31 #ifndef GRT_MEDIAN_FILTER_HEADER
32 #define GRT_MEDIAN_FILTER_HEADER
33 
34 #include "../CoreModules/PreProcessing.h"
35 
36 GRT_BEGIN_NAMESPACE
37 
38 class MedianFilter : public PreProcessing {
39 public:
46  MedianFilter(UINT filterSize = 5,UINT numDimensions = 1);
47 
53  MedianFilter(const MedianFilter &rhs);
54 
58  virtual ~MedianFilter();
59 
66  MedianFilter& operator=(const MedianFilter &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 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 
181 
182 protected:
183  UINT filterSize;
186 
187  static RegisterPreProcessingModule< MedianFilter > registerModule;
188 };
189 
190 GRT_END_NAMESPACE
191 
192 #endif //GRT_MEDIAN_FILTER_HEADER
Vector< VectorFloat > getDataBuffer() const
VectorFloat getFilteredData() const
Definition: MedianFilter.h:170
MedianFilter & operator=(const MedianFilter &rhs)
virtual bool reset()
virtual bool process(const VectorFloat &inputVector)
Float filter(const Float x)
CircularBuffer< VectorFloat > dataBuffer
A buffer to store the previous N values, N = filterSize.
Definition: MedianFilter.h:185
UINT filterSize
The size of the filter.
Definition: MedianFilter.h:183
virtual ~MedianFilter()
UINT inputSampleCounter
A counter to keep track of the number of input samples.
Definition: MedianFilter.h:184
virtual bool saveModelToFile(std::string filename) const
UINT getFilterSize() const
Definition: MedianFilter.h:163
MedianFilter(UINT filterSize=5, UINT numDimensions=1)
virtual bool deepCopyFrom(const PreProcessing *preProcessing)
virtual bool loadModelFromFile(std::string filename)