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.
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 GRT_BEGIN_NAMESPACE
36 
39  angle = 0;
40  magnitude = 0;
41  }
42  Float angle;
43  Float 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 VectorFloat &inputVector);
93 
101  virtual bool reset();
102 
109  virtual bool saveModelToFile( std::string filename ) const;
110 
117  virtual bool loadModelFromFile( std::string filename );
118 
126  virtual bool saveModelToFile( std::fstream &file ) const;
127 
135  virtual bool loadModelFromFile( std::fstream &file );
136 
140  bool init(UINT trajectoryLength,UINT numCentroids,UINT featureMode,UINT numHistogramBins,UINT numDimensions,bool useTrajStartAndEndValues,bool useWeightedMagnitudeValues);
141 
148  VectorFloat update(Float x);
149 
156  VectorFloat update(const VectorFloat &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< VectorFloat > 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 GRT_END_NAMESPACE
205 
206 #endif //GRT_MOVEMENT_TRAJECTORY_FEATURES_HEADER
virtual bool computeFeatures(const VectorFloat &inputVector)
virtual bool predict(VectorFloat inputVector)
Definition: MLBase.cpp:112
virtual bool predict_(VectorFloat &inputVector)
Definition: MLBase.cpp:114
virtual bool saveModelToFile(std::string filename) const
virtual bool train(ClassificationData trainingData)
Definition: MLBase.cpp:88
MovementTrajectoryFeatures & operator=(const MovementTrajectoryFeatures &rhs)
virtual bool deepCopyFrom(const FeatureExtraction *featureExtraction)
virtual bool loadModelFromFile(std::string filename)
virtual bool train_(ClassificationData &trainingData)
Definition: MLBase.cpp:90
MovementTrajectoryFeatures(UINT trajectoryLength=100, UINT numCentroids=10, UINT featureMode=CENTROID_VALUE, UINT numHistogramBins=10, UINT numDimensions=1, bool useTrajStartAndEndValues=false, bool useWeightedMagnitudeValues=true)
CircularBuffer< VectorFloat > getTrajectoryData()