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.
PeakDetection.h
Go to the documentation of this file.
1 
9 #ifndef GRT_PEAK_DETECTION_HEADER
10 #define GRT_PEAK_DETECTION_HEADER
11 
12 #include "CircularBuffer.h"
13 #include "../PreProcessingModules/DoubleMovingAverageFilter.h"
14 #include "../PreProcessingModules/DeadZone.h"
15 
16 GRT_BEGIN_NAMESPACE
17 
18 struct PeakInfo{
19  unsigned int peakType;
20  unsigned int peakIndex;
21  Float peakValue;
22  PeakInfo(unsigned int peakType = 0,unsigned int peakIndex = 0,Float peakValue = 0){
23  this->peakType = peakType;
24  this->peakIndex = peakIndex;
25  this->peakValue = peakValue;
26  }
27 };
28 typedef struct PeakInfo PeakInfo;
29 
30 #define DEFAULT_GLOBAL_MAXIMA_VALUE -1.0e+99
31 #define DEFAULT_GLOBAL_MINIMA_VALUE 1.0e+99
32 
33 class GRT_API PeakDetection{
34 public:
35  PeakDetection(const UINT lowPassFilterSize = 5,const UINT searchWindowSize = 5);
36 
37  ~PeakDetection();
38 
39  PeakDetection(const PeakDetection &rhs);
40 
41  PeakDetection& operator=(const PeakDetection &rhs);
42 
43  bool setSearchWindowSize(const UINT searchWindowSize);
44 
45  bool update( const Float x );
46 
47  bool reset();
48 
49 //protected:
50 
51  bool enableSearch;
52  bool peakDetected;
53  unsigned int inputTimeoutCounter;
54  unsigned int inputTimeoutLimit;
55  unsigned int maximaCounter;
56  unsigned int minimaCounter;
57  unsigned int lowPassFilterSize;
58  unsigned int searchWindowSize;
59  unsigned int searchHistorySize;
60  Float deadZoneThreshold;
61  DoubleMovingAverageFilter lowPassFilter;
62  DeadZone deadZoneFilter;
63  CircularBuffer< Float > filteredDataBuffer;
64  CircularBuffer< Float > firstDerivBuffer;
65  CircularBuffer< Float > secondDerivBuffer;
66  CircularBuffer< unsigned int > peakTypesBuffer;
67  Vector< PeakInfo > peakInfo;
68  PeakInfo globalMaximaPeakInfo;
69  PeakInfo globalMinimaPeakInfo;
70 
71  enum PeakTypes{NO_PEAK_FOUND=0,LOCAL_MAXIMA_FOUND,LOCAL_MINIMA_FOUND,GLOBAL_MAXIMA_FOUND,GLOBAL_MINIMA_FOUND};
72 
73 };
74 
75 GRT_END_NAMESPACE
76 
77 #endif //GRT_PEAK_DETECTION_HEADER
The DeadZone class sets any values in the input signal that fall within the dead-zone region to zero...
Definition: DeadZone.h:38
The class implements a Float moving average filter.