GestureRecognitionToolkit  Version: 0.2.5
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:
49  enum FeatureModes{CENTROID_VALUE=0,NORMALIZED_CENTROID_VALUE,CENTROID_DERIVATIVE,CENTROID_ANGLE_2D};
50 
54  MovementTrajectoryFeatures(const UINT trajectoryLength=100,const UINT numCentroids=10,const UINT featureMode=CENTROID_VALUE,const UINT numHistogramBins=10,const UINT numDimensions = 1,const bool useTrajStartAndEndValues = false,const bool useWeightedMagnitudeValues = true);
55 
62 
66  virtual ~MovementTrajectoryFeatures();
67 
75 
84  virtual bool deepCopyFrom(const FeatureExtraction *featureExtraction);
85 
94  virtual bool computeFeatures(const VectorFloat &inputVector);
95 
103  virtual bool reset();
104 
112  virtual bool save( std::fstream &file ) const;
113 
121  virtual bool load( std::fstream &file );
122 
126  bool init(const UINT trajectoryLength,const UINT numCentroids,const UINT featureMode,const UINT numHistogramBins,const UINT numDimensions,const bool useTrajStartAndEndValues,const bool useWeightedMagnitudeValues);
127 
134  VectorFloat update(const Float x);
135 
142  VectorFloat update(const VectorFloat &x);
143 
150  CircularBuffer< VectorFloat > getTrajectoryData() const;
151 
158  MatrixDouble getCentroids() const;
159 
165  UINT getFeatureMode() const;
166 
167  //Tell the compiler we are using the following functions from the MLBase class to stop hidden virtual function warnings
168  using MLBase::save;
169  using MLBase::load;
170  using MLBase::train;
171  using MLBase::train_;
172  using MLBase::predict;
173  using MLBase::predict_;
174 
180  static std::string getId();
181 
182 protected:
183 
184  UINT trajectoryLength;
185  UINT numCentroids;
186  UINT featureMode;
187  UINT numHistogramBins;
188  bool useTrajStartAndEndValues;
189  bool useWeightedMagnitudeValues;
190  CircularBuffer< VectorFloat > trajectoryDataBuffer;
191  MatrixDouble centroids;
192 
193 private:
195  static std::string id;
196 };
197 
198 GRT_END_NAMESPACE
199 
200 #endif //GRT_MOVEMENT_TRAJECTORY_FEATURES_HEADER
201 
virtual bool predict(VectorFloat inputVector)
Definition: MLBase.cpp:135
virtual bool predict_(VectorFloat &inputVector)
Definition: MLBase.cpp:137
virtual bool train(ClassificationData trainingData)
Definition: MLBase.cpp:107
virtual bool save(const std::string &filename) const
Definition: MLBase.cpp:167
virtual bool train_(ClassificationData &trainingData)
Definition: MLBase.cpp:109
virtual bool load(const std::string &filename)
Definition: MLBase.cpp:190