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.
MovementDetector.h
Go to the documentation of this file.
1 
31 #ifndef GRT_MOVEMENT_DETECTOR_HEADER
32 #define GRT_MOVEMENT_DETECTOR_HEADER
33 
34 #include "../../CoreModules/MLBase.h"
35 
36 GRT_BEGIN_NAMESPACE
37 
38 class GRT_API MovementDetector : public MLBase{
39  public:
40  MovementDetector( const UINT numDimensions = 1, const Float upperThreshold = 1, const Float lowerThreshold = 0.9, const Float gamma = 0.95, const UINT searchTimeout = 0);
41 
42  virtual ~MovementDetector();
43 
44  virtual bool predict_( VectorFloat &input );
45 
52  virtual bool clear();
53 
60  virtual bool reset();
61 
69  virtual bool save( std::fstream &file ) const;
70 
78  virtual bool load( std::fstream &file );
79 
80  Float getUpperThreshold() const;
81 
82  Float getLowerThreshold() const;
83 
84  Float getMovementIndex() const;
85 
86  Float getGamma() const;
87 
88  bool getMovementDetected() const;
89 
90  bool getNoMovementDetect() const;
91 
92  UINT getState() const;
93 
94  UINT getSearchTimeout() const;
95 
96  bool setUpperThreshold(const Float upperThreshold);
97 
98  bool setLowerThreshold(const Float lowerThreshold);
99 
100  bool setGamma(const Float gamma);
101 
102  bool setSearchTimeout(const UINT searchTimeout);
103 
104  //Tell the compiler we are using the base class train method to stop hidden virtual function warnings
105  using MLBase::saveModelToFile;
106  using MLBase::loadModelFromFile;
107 
108  protected:
109 
110  UINT state;
111  UINT searchTimeout;
112  Float upperThreshold;
113  Float lowerThreshold;
114  Float movementIndex;
115  Float gamma;
116  bool firstSample;
117  bool movementDetected;
118  bool noMovementDetected;
119  Timer searchTimer;
120  VectorFloat lastSample;
121 
122  public:
123  enum SearchStates{SEARCHING_FOR_MOVEMENT=0,SEARCHING_FOR_NO_MOVEMENT,SEARCH_TIMEOUT};
124 
125 };
126 
127 GRT_END_NAMESPACE
128 
129 #endif //GRT_MOVEMENT_DETECTOR_HEADER
Definition: Timer.h:43
virtual bool predict_(VectorFloat &inputVector)
Definition: MLBase.cpp:137
virtual bool reset()
Definition: MLBase.cpp:147
virtual bool save(const std::string &filename) const
Definition: MLBase.cpp:167
virtual bool clear()
Definition: MLBase.cpp:149
virtual bool load(const std::string &filename)
Definition: MLBase.cpp:190
This is the main base class that all GRT machine learning algorithms should inherit from...
Definition: MLBase.h:72