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.
MovementTrajectoryFeatures.h
Go to the documentation of this file.
1 
29 #ifndef GRT_MOVEMENT_TRAJECTORY_FEATURES_HEADER
30 #define GRT_MOVEMENT_TRAJECTORY_FEATURES_HEADER
31 
32 #include "../../CoreModules/FeatureExtraction.h"
33 #include "../../Util/Util.h"
34 
35 namespace GRT{
36 
39  angle = 0;
40  magnitude = 0;
41  }
42  double angle;
43  double magnitude;
44 };
45 typedef struct AngleMagnitude AngleMagnitude;
46 
48 public:
52  MovementTrajectoryFeatures(UINT trajectoryLength=100,UINT numCentroids=10,UINT featureMode=CENTROID_VALUE,UINT numHistogramBins=10,UINT numDimensions = 1,bool useTrajStartAndEndValues = false,bool useWeightedMagnitudeValues = true);
53 
60 
65 
73 
82  virtual bool deepCopyFrom(const FeatureExtraction *featureExtraction);
83 
92  virtual bool computeFeatures(const VectorDouble &inputVector);
93 
101  virtual bool reset();
102 
109  virtual bool saveModelToFile(string filename) const;
110 
117  virtual bool loadModelFromFile(string filename);
118 
126  virtual bool saveModelToFile(fstream &file) const;
127 
135  virtual bool loadModelFromFile(fstream &file);
136 
140  bool init(UINT trajectoryLength,UINT numCentroids,UINT featureMode,UINT numHistogramBins,UINT numDimensions,bool useTrajStartAndEndValues,bool useWeightedMagnitudeValues);
141 
148  VectorDouble update(double x);
149 
156  VectorDouble update(const VectorDouble &x);
157 
165 
173 
179  UINT getFeatureMode();
180 
181  //Tell the compiler we are using the following functions from the MLBase class to stop hidden virtual function warnings
182  using MLBase::train;
183  using MLBase::train_;
184  using MLBase::predict;
185  using MLBase::predict_;
186 
187 protected:
188 
189  UINT trajectoryLength;
190  UINT numCentroids;
191  UINT featureMode;
192  UINT numHistogramBins;
193  bool useTrajStartAndEndValues;
194  bool useWeightedMagnitudeValues;
195  CircularBuffer< VectorDouble > trajectoryDataBuffer;
196  MatrixDouble centroids;
197 
199 
200 public:
201  enum FeatureModes{CENTROID_VALUE=0,NORMALIZED_CENTROID_VALUE,CENTROID_DERIVATIVE,CENTROID_ANGLE_2D};
202 };
203 
204 }//End of namespace GRT
205 
206 #endif //GRT_MOVEMENT_TRAJECTORY_FEATURES_HEADER
MovementTrajectoryFeatures & operator=(const MovementTrajectoryFeatures &rhs)
Definition: AdaBoost.cpp:25
virtual bool train(ClassificationData trainingData)
Definition: MLBase.cpp:80
virtual bool saveModelToFile(string filename) const
virtual bool predict(VectorDouble inputVector)
Definition: MLBase.cpp:104
MovementTrajectoryFeatures(UINT trajectoryLength=100, UINT numCentroids=10, UINT featureMode=CENTROID_VALUE, UINT numHistogramBins=10, UINT numDimensions=1, bool useTrajStartAndEndValues=false, bool useWeightedMagnitudeValues=true)
virtual bool predict_(VectorDouble &inputVector)
Definition: MLBase.cpp:106
virtual bool deepCopyFrom(const FeatureExtraction *featureExtraction)
CircularBuffer< VectorDouble > getTrajectoryData()
virtual bool loadModelFromFile(string filename)
virtual bool computeFeatures(const VectorDouble &inputVector)
virtual bool train_(ClassificationData &trainingData)
Definition: MLBase.cpp:82