00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef PEAKDETECTION_H
00020 #define PEAKDETECTION_H
00021
00022 #include "Typedefs.h"
00023 #include "Debug.h"
00024
00025 #include <limits>
00026
00055 class PeakDetection {
00056 public:
00063 enum SortMethod {
00064 NONE = 0 ,
00065 BYMAGNITUDE = 1 ,
00066 BYPOSITION = 2
00067 };
00068
00069 protected:
00070
00071 int _peakCount;
00072 int _minimumPeakWidth;
00073 int _candidateCount;
00074 Real _minimumPeakContrast;
00075
00076 SortMethod _sortMethod;
00077
00078
00079 MatrixXR _magnitudes;
00080
00081 public:
00085 PeakDetection(int peakCount = 1024 / 3, SortMethod sort = BYMAGNITUDE, int minimumPeakWidth = 3, int candidateCount = -1, Real minimumPeakContrast = 0);
00086
00090 ~PeakDetection();
00091
00092 void reset();
00093 void setup();
00094
00115 void process(const MatrixXR& frames,
00116 MatrixXR* peakPositions, MatrixXR* peakMagnitudes);
00117
00123 int peakCount() const;
00124
00129 void setPeakCount( int count, bool callSetup = true );
00130
00136 int minimumPeakWidth() const;
00137
00141 void setMinimumPeakWidth( int width, bool callSetup = true );
00142
00151 int candidateCount() const;
00152
00159 void setCandidateCount( int count, bool callSetup = true );
00160
00169 Real minimumPeakContrast() const;
00170
00177 void setMinimumPeakContrast( Real contrast, bool callSetup = true );
00178
00184 SortMethod sortMethod() const;
00185
00189 void setSortMethod( SortMethod method, bool callSetup = true );
00190 };
00191
00192 #endif