![]() |
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.
|
Public Member Functions | |
| ThresholdCrossingDetector (UINT analysisMode=RAW_DATA_ANALYSIS_MODE, UINT thresholdCrossingMode=UPPER_THRESHOLD_CROSSING, UINT detectionTimeoutMode=TIMEOUT_COUNTER, Float lowerThreshold=-1, Float upperThreshold=1, Float hysteresisThreshold=0, UINT searchWindowSize=20, UINT searchTimeoutDuration=1000, UINT offsetFilterSize=10) | |
| ~ThresholdCrossingDetector () | |
| ThresholdCrossingDetector (const ThresholdCrossingDetector &rhs) | |
| ThresholdCrossingDetector & | operator= (const ThresholdCrossingDetector &rhs) |
| bool | update (const Float x) |
| bool | reset () |
| bool | triggerSearchTimeout () |
| bool | getThresholdCrossingDetected () const |
| bool | getEnableSearch () const |
| UINT | getAnalysisMode () const |
| UINT | getThresholdCrossingMode () const |
| UINT | getSearchWindowSize () const |
| UINT | getOffsetFilterSize () const |
| UINT | getSearchWindowIndex () const |
| UINT | getSearchTimeoutCounter () |
| UINT | getSearchTimeoutDuration () const |
| Float | getAnalysisValue () const |
| Float | getUpperThreshold () const |
| Float | getLowerThreshold () const |
| Float | getHysteresisThreshold () const |
| bool | setEnableSearch (const bool enableSearch) |
| bool | setAnalysisMode (const UINT analysisMode) |
| bool | setThresholdCrossingMode (const UINT thresholdCrossingMode) |
| bool | setSearchWindowSize (const UINT searchWindowSize) |
| bool | setOffsetFilterSize (const UINT offsetFilterSize) |
| bool | setSearchTimeoutDuration (const UINT searchTimeoutDuration) |
| bool | setDetectionTimeoutMode (const UINT detectionTimeoutMode) |
| bool | setLowerThreshold (const Float lowerThreshold) |
| bool | setUpperThreshold (const Float upperThreshold) |
| bool | setHysteresisThreshold (const Float hysteresisThreshold) |
Protected Attributes | |
| Float | analysisValue |
| Float | lowerThreshold |
| Float | upperThreshold |
| Float | hysteresisThreshold |
| bool | enableSearch |
| bool | thresholdCrossingDetected |
| unsigned int | analysisMode |
| unsigned int | thresholdCrossingMode |
| unsigned int | detectionTimeoutMode |
| unsigned int | searchTimeoutDuration |
| unsigned int | searchWindowSize |
| unsigned int | searchWindowIndex |
| unsigned int | offsetFilterSize |
| unsigned int | currentSearchState |
| Timer | searchTimeoutCounter |
| MovingAverageFilter | movingAverageFilter |
| Derivative | derivative |
Definition at line 38 of file ThresholdCrossingDetector.h.
| GRT_BEGIN_NAMESPACE ThresholdCrossingDetector::ThresholdCrossingDetector | ( | UINT | analysisMode = RAW_DATA_ANALYSIS_MODE, |
| UINT | thresholdCrossingMode = UPPER_THRESHOLD_CROSSING, |
||
| UINT | detectionTimeoutMode = TIMEOUT_COUNTER, |
||
| Float | lowerThreshold = -1, |
||
| Float | upperThreshold = 1, |
||
| Float | hysteresisThreshold = 0, |
||
| UINT | searchWindowSize = 20, |
||
| UINT | searchTimeoutDuration = 1000, |
||
| UINT | offsetFilterSize = 10 |
||
| ) |
Default Constructor.
| analysisMode | sets the algorithm used to detect threshold crossings, this should be one of the AnalysisMode enums |
| thresholdCrossingMode | sets the threshold crossing mode, this should be one of the ThresholdCrossingModes enums |
| lowerThreshold | sets the lower threshold level |
| upperThreshold | sets the upper threshold level |
| searchWindowSize | sets the size of the search window used to detect UPPER_THEN_LOWER_THRESHOLD_CROSSING or LOWER_THEN_UPPER_THRESHOLD_CROSSING |
| searchTimeoutDuration | sets the duration (in samples) that the threshold detector will ignore any new threshold crossings after detecting a valid threshold crossing |
| offsetFilterSize | sets the size of the moving average filter used to offset the input value (if the analysisMode is set to MOVING_OFFSET_ANALYSIS_MODE) |
Definition at line 25 of file ThresholdCrossingDetector.cpp.
| ThresholdCrossingDetector::~ThresholdCrossingDetector | ( | ) |
Default Destructor.
Definition at line 65 of file ThresholdCrossingDetector.cpp.
| ThresholdCrossingDetector::ThresholdCrossingDetector | ( | const ThresholdCrossingDetector & | rhs | ) |
Copy Constructor. Copies the data from the rhs instance to this instance.
| const | ThresholdCrossingDetector &rhs: the right hand instance from which the data will be copied to this instance |
Definition at line 46 of file ThresholdCrossingDetector.cpp.
| UINT ThresholdCrossingDetector::getAnalysisMode | ( | ) | const |
Definition at line 282 of file ThresholdCrossingDetector.cpp.
| Float ThresholdCrossingDetector::getAnalysisValue | ( | ) | const |
Definition at line 310 of file ThresholdCrossingDetector.cpp.
| bool ThresholdCrossingDetector::getEnableSearch | ( | ) | const |
Definition at line 278 of file ThresholdCrossingDetector.cpp.
| Float ThresholdCrossingDetector::getHysteresisThreshold | ( | ) | const |
Definition at line 322 of file ThresholdCrossingDetector.cpp.
| Float ThresholdCrossingDetector::getLowerThreshold | ( | ) | const |
Definition at line 318 of file ThresholdCrossingDetector.cpp.
| UINT ThresholdCrossingDetector::getOffsetFilterSize | ( | ) | const |
Definition at line 294 of file ThresholdCrossingDetector.cpp.
| UINT ThresholdCrossingDetector::getSearchTimeoutCounter | ( | ) |
Definition at line 302 of file ThresholdCrossingDetector.cpp.
| UINT ThresholdCrossingDetector::getSearchTimeoutDuration | ( | ) | const |
Definition at line 306 of file ThresholdCrossingDetector.cpp.
| UINT ThresholdCrossingDetector::getSearchWindowIndex | ( | ) | const |
Definition at line 298 of file ThresholdCrossingDetector.cpp.
| UINT ThresholdCrossingDetector::getSearchWindowSize | ( | ) | const |
Definition at line 290 of file ThresholdCrossingDetector.cpp.
| bool ThresholdCrossingDetector::getThresholdCrossingDetected | ( | ) | const |
This function returns true if a threshold crossing was detected during the last update.
Definition at line 274 of file ThresholdCrossingDetector.cpp.
| UINT ThresholdCrossingDetector::getThresholdCrossingMode | ( | ) | const |
Definition at line 286 of file ThresholdCrossingDetector.cpp.
| Float ThresholdCrossingDetector::getUpperThreshold | ( | ) | const |
Definition at line 314 of file ThresholdCrossingDetector.cpp.
| ThresholdCrossingDetector & ThresholdCrossingDetector::operator= | ( | const ThresholdCrossingDetector & | rhs | ) |
Equals Operator. Copies the data from the rhs instance to this instance.
| rhs | the right hand instance from which the data will be copied to this instance |
Definition at line 69 of file ThresholdCrossingDetector.cpp.
| bool ThresholdCrossingDetector::reset | ( | ) |
This function resets the threshold crossing detector.
Definition at line 248 of file ThresholdCrossingDetector.cpp.
| bool ThresholdCrossingDetector::setAnalysisMode | ( | const UINT | analysisMode | ) |
Sets the anlysis mode used to detect threshold crossings. This should be one of the AnalysisModes enums.
| const | UINT analysisMode: the new analysisMode |
Definition at line 331 of file ThresholdCrossingDetector.cpp.
| bool ThresholdCrossingDetector::setDetectionTimeoutMode | ( | const UINT | detectionTimeoutMode | ) |
Sets the detectionTimeoutMode, this controls how the detection algorithm triggers detection timeouts after a threshold crossing has been detected. If the detectionTimeoutMode is TIMEOUT_COUNTER then the detection algorithm will wait for until the searchTimeoutDuration before searching for the next threshold crossing. Alternatively, if the detectionTimeoutMode is HYSTERESIS_THRESHOLD then the detection algorithm will wait for the analysis signal to pass the hysteresisThreshold (regardless of the time this takes) before searching for a new threshold crossing.
| const | UINT searchTimeoutDuration: the new searchTimeoutDuration |
Definition at line 341 of file ThresholdCrossingDetector.cpp.
| bool ThresholdCrossingDetector::setEnableSearch | ( | const bool | enableSearch | ) |
Sets if the algorithm can perform the threshold crossing search. If enableSearch is set to false, then the algorithm will never search for a threshold crossing.
| const | bool enableSearch: the new enableSearch mode |
Definition at line 326 of file ThresholdCrossingDetector.cpp.
| bool ThresholdCrossingDetector::setHysteresisThreshold | ( | const Float | hysteresisThreshold | ) |
Sets the hysteresisThreshold value, this threshold is used to debounce triggers if the detectionTimeoutMode is set to HYSTERESIS_THRESHOLD.
| hysteresisThreshold | the new hysteresisThreshold |
Definition at line 371 of file ThresholdCrossingDetector.cpp.
| bool ThresholdCrossingDetector::setLowerThreshold | ( | const Float | lowerThreshold | ) |
Sets the lowerThreshold value, this lower threshold that must be crossed to trigger a LOWER_THRESHOLD_CROSSING.
| lowerThreshold | the new lowerThreshold |
Definition at line 361 of file ThresholdCrossingDetector.cpp.
| bool ThresholdCrossingDetector::setOffsetFilterSize | ( | const UINT | offsetFilterSize | ) |
Sets the size of the moving average filter used to offset the input data. This is only used if the analysisMode is MOVING_OFFSET_ANALYSIS_MODE.
| const | UINT offsetFilterSize: the new offsetFilterSize |
Definition at line 351 of file ThresholdCrossingDetector.cpp.
| bool ThresholdCrossingDetector::setSearchTimeoutDuration | ( | const UINT | searchTimeoutDuration | ) |
Sets the searchTimeoutDuration, this is the time (in milliseconds) that will be ignored after a threshold crossing has been detected.
| const | UINT searchTimeoutDuration: the new searchTimeoutDuration in milliseconds |
Definition at line 356 of file ThresholdCrossingDetector.cpp.
| bool ThresholdCrossingDetector::setSearchWindowSize | ( | const UINT | searchWindowSize | ) |
Sets the searchWindowSize. This is the number of samples the algorithm will search for a second threshold crossing after the first threshold crossing has been found (in the UPPER_THEN_LOWER_THRESHOLD_CROSSING or LOWER_THEN_UPPER_THRESHOLD_CROSSING modes).
| const | UINT searchWindowSize: the new searchWindowSize |
Definition at line 346 of file ThresholdCrossingDetector.cpp.
| bool ThresholdCrossingDetector::setThresholdCrossingMode | ( | const UINT | thresholdCrossingMode | ) |
Sets the threshold crossing mode used to detect threshold crossings. This should be one of the ThresholdCrossingModes enums.
| const | UINT thresholdCrossingMode: the new thresholdCrossingMode |
Definition at line 336 of file ThresholdCrossingDetector.cpp.
| bool ThresholdCrossingDetector::setUpperThreshold | ( | const Float | upperThreshold | ) |
Sets the upperThreshold value, this upper threshold that must be crossed to trigger a UPPER_THRESHOLD_CROSSING.
| upperThreshold | the new upperThreshold |
Definition at line 366 of file ThresholdCrossingDetector.cpp.
| bool ThresholdCrossingDetector::triggerSearchTimeout | ( | ) |
This function triggers a search timeout (i.e. the algorithm will stop searching for the next N samples, where N = searchTimeoutDuration).
Definition at line 268 of file ThresholdCrossingDetector.cpp.
| bool ThresholdCrossingDetector::update | ( | const Float | x | ) |
This is the main update interface, you should call this every time you get a new sample from your sensor.
| x | the new value that will be pushed through the threshold crossing algorithm |
Definition at line 91 of file ThresholdCrossingDetector.cpp.