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.
|
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 26 of file ThresholdCrossingDetector.cpp.
ThresholdCrossingDetector::~ThresholdCrossingDetector | ( | ) |
Default Destructor.
Definition at line 66 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 47 of file ThresholdCrossingDetector.cpp.
UINT ThresholdCrossingDetector::getAnalysisMode | ( | ) | const |
Definition at line 283 of file ThresholdCrossingDetector.cpp.
Float ThresholdCrossingDetector::getAnalysisValue | ( | ) | const |
Definition at line 311 of file ThresholdCrossingDetector.cpp.
bool ThresholdCrossingDetector::getEnableSearch | ( | ) | const |
Definition at line 279 of file ThresholdCrossingDetector.cpp.
Float ThresholdCrossingDetector::getHysteresisThreshold | ( | ) | const |
Definition at line 323 of file ThresholdCrossingDetector.cpp.
Float ThresholdCrossingDetector::getLowerThreshold | ( | ) | const |
Definition at line 319 of file ThresholdCrossingDetector.cpp.
UINT ThresholdCrossingDetector::getOffsetFilterSize | ( | ) | const |
Definition at line 295 of file ThresholdCrossingDetector.cpp.
UINT ThresholdCrossingDetector::getSearchTimeoutCounter | ( | ) |
Definition at line 303 of file ThresholdCrossingDetector.cpp.
UINT ThresholdCrossingDetector::getSearchTimeoutDuration | ( | ) | const |
Definition at line 307 of file ThresholdCrossingDetector.cpp.
UINT ThresholdCrossingDetector::getSearchWindowIndex | ( | ) | const |
Definition at line 299 of file ThresholdCrossingDetector.cpp.
UINT ThresholdCrossingDetector::getSearchWindowSize | ( | ) | const |
Definition at line 291 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 275 of file ThresholdCrossingDetector.cpp.
UINT ThresholdCrossingDetector::getThresholdCrossingMode | ( | ) | const |
Definition at line 287 of file ThresholdCrossingDetector.cpp.
Float ThresholdCrossingDetector::getUpperThreshold | ( | ) | const |
Definition at line 315 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 70 of file ThresholdCrossingDetector.cpp.
bool ThresholdCrossingDetector::reset | ( | ) |
This function resets the threshold crossing detector.
Definition at line 249 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 332 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 342 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 327 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 372 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 362 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 352 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 357 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 347 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 337 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 367 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 269 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 92 of file ThresholdCrossingDetector.cpp.