GestureRecognitionToolkit  Version: 1.0 Revision: 04-03-15
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
ZeroCrossingCounter.h
Go to the documentation of this file.
1 
41 #ifndef GRT_ZERO_CROSSING_COUNTER_HEADER
42 #define GRT_ZERO_CROSSING_COUNTER_HEADER
43 
44 #include "../../CoreModules/FeatureExtraction.h"
45 #include "../../PreProcessingModules/Derivative.h"
46 #include "../../PreProcessingModules/DeadZone.h"
47 
48 namespace GRT{
49 
51 public:
61  ZeroCrossingCounter(UINT searchWindowSize = 20,double deadZoneThreshold = 0.01,UINT numDimensions = 1,UINT featureMode = INDEPENDANT_FEATURE_MODE);
62 
69 
73  virtual ~ZeroCrossingCounter();
74 
82 
91  virtual bool deepCopyFrom(const FeatureExtraction *featureExtraction);
92 
101  virtual bool computeFeatures(const VectorDouble &inputVector);
102 
110  virtual bool reset();
111 
118  virtual bool saveModelToFile(string filename) const;
119 
126  virtual bool loadModelFromFile(string filename);
127 
135  virtual bool saveModelToFile(fstream &file) const;
136 
144  virtual bool loadModelFromFile(fstream &file);
145 
157  bool init(UINT searchWindowSize,double deadZoneThreshold,UINT numDimensions,UINT featureMode);
158 
165  VectorDouble update(double x);
166 
173  VectorDouble update(const VectorDouble &x);
174 
182  bool setSearchWindowSize(UINT searchWindowSize);
183 
191  bool setDeadZoneThreshold(UINT deadZoneThreshold);
192 
200  bool setFeatureMode(UINT featureMode);
201 
207  UINT getSearchWindowSize(){ if( initialized ){ return searchWindowSize; } return 0; }
208 
215  UINT getNumFeatures(){ return TOTAL_NUM_ZERO_CROSSING_FEATURES; }
216 
222  UINT getFeatureMode(){ return featureMode; }
223 
229  double getDeadZoneThreshold(){ if( initialized ){ return deadZoneThreshold; } return 0; }
230 
238 
239  //Tell the compiler we are using the following functions from the MLBase class to stop hidden virtual function warnings
242  using MLBase::train;
243  using MLBase::train_;
244  using MLBase::predict;
245  using MLBase::predict_;
246 
247 protected:
249  UINT featureMode;
254 
256 
257 public:
258  enum ZeroCrossingFeatureIDs{NUM_ZERO_CROSSINGS_COUNTED=0,ZERO_CROSSING_MAGNITUDE,TOTAL_NUM_ZERO_CROSSING_FEATURES};
259  enum FeatureModes{INDEPENDANT_FEATURE_MODE=0,COMBINED_FEATURE_MODE};
260 };
261 
262 }//End of namespace GRT
263 
264 #endif //GRT_ZERO_CROSSING_COUNTER_HEADER
virtual bool saveModelToFile(string filename) const
VectorDouble update(double x)
Definition: AdaBoost.cpp:25
virtual bool saveModelToFile(fstream &file) const
virtual bool computeFeatures(const VectorDouble &inputVector)
virtual bool loadModelFromFile(string filename)
virtual bool train(ClassificationData trainingData)
Definition: MLBase.cpp:80
virtual bool loadModelFromFile(fstream &file)
double deadZoneThreshold
The threshold value used for the dead zone filter.
CircularBuffer< VectorDouble > dataBuffer
A buffer used to store the previous derivative data.
bool setSearchWindowSize(UINT searchWindowSize)
virtual bool predict(VectorDouble inputVector)
Definition: MLBase.cpp:104
virtual bool predict_(VectorDouble &inputVector)
Definition: MLBase.cpp:106
bool setFeatureMode(UINT featureMode)
virtual bool deepCopyFrom(const FeatureExtraction *featureExtraction)
bool setDeadZoneThreshold(UINT deadZoneThreshold)
DeadZone deadZone
Used to remove small amounts of noise from the data.
ZeroCrossingCounter & operator=(const ZeroCrossingCounter &rhs)
ZeroCrossingCounter(UINT searchWindowSize=20, double deadZoneThreshold=0.01, UINT numDimensions=1, UINT featureMode=INDEPENDANT_FEATURE_MODE)
Derivative derivative
Used to compute the derivative of the input signal.
CircularBuffer< VectorDouble > getDataBuffer()
UINT featureMode
The featureMode controls how the features are added to the feature vector.
UINT searchWindowSize
The size of the search window, i.e. the amount of previous data stored and searched.
virtual bool train_(ClassificationData &trainingData)
Definition: MLBase.cpp:82