00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef MULTISCALEDETECTOR_H_
00024 #define MULTISCALEDETECTOR_H_
00025
00026 #include <feature/InterestPoint.h>
00027 #include <feature/Detector.h>
00028 #include <utils/Convolution.h>
00029 #include <utils/PeakFinder.h>
00030
00031 #include <vector>
00032
00033 #define MIN_KERNEL_SIZE 3
00034 #define MAX_KERNEL_SIZE 50
00035
00036
00041 enum SmoothingFilterFamily {
00042 GAUSSIAN,
00043 BESSEL
00044 };
00045
00046
00055 class MultiScaleDetector: public Detector {
00056 public:
00066 MultiScaleDetector(const PeakFinder* peak, unsigned int scales = 5, double sigma = 1.6, double step = 1.4, SmoothingFilterFamily filterType = BESSEL);
00067
00068 virtual unsigned int detect(const LaserReading& reading, std::vector<InterestPoint*>& point) const;
00069
00070 virtual unsigned int detect(const LaserReading& reading, std::vector<InterestPoint*>& point,
00071 std::vector< double >& signal,
00072 std::vector< std::vector<double> >& signalSmooth,
00073 std::vector< std::vector<double> >& signalDiff,
00074 std::vector< std::vector<unsigned int> >& indexes) const;
00075
00086 virtual void detect(const std::vector<double>& signal,
00087 std::vector< std::vector<double> >& signalSmooth,
00088 std::vector< std::vector<double> >& signalDiff,
00089 std::vector< std::vector<unsigned int> >& indexes) const;
00090
00092 inline void setFilterType(SmoothingFilterFamily filterType)
00093 {m_filterType = filterType; computeFilterBank(); computeDifferentialBank();}
00094
00096 inline void setScaleNumber(unsigned int scales)
00097 {m_scaleNumber = scales; computeFilterBank(); computeDifferentialBank();}
00098
00100 inline void setBaseSigma(double sigma)
00101 {m_baseSigma = sigma; computeFilterBank(); computeDifferentialBank();}
00102
00104 inline void setSigmaStep(double step)
00105 {m_sigmaStep = step; computeFilterBank(); computeDifferentialBank();}
00106
00108 inline void setPeakFinder(const PeakFinder* peak)
00109 {m_peakFinder = peak;}
00110
00112 inline void setUseMaxRange(bool use)
00113 {m_useMaxRange = use;}
00114
00116 inline SmoothingFilterFamily getFilterType() const
00117 {return m_filterType;}
00118
00120 inline unsigned int getScaleNumber() const
00121 {return m_scaleNumber;}
00122
00124 inline const std::vector<double>& getScales() const
00125 {return m_scales;}
00126
00128 inline double getBaseSigma() const
00129 {return m_baseSigma;}
00130
00132 inline double getSigmaStep() const
00133 {return m_sigmaStep;}
00134
00136 inline const PeakFinder* getPeakFinder() const
00137 {return m_peakFinder;}
00138
00140 inline bool getUseMaxRange()
00141 {return m_useMaxRange;}
00142
00143 protected:
00145 virtual void computeFilterBank();
00146
00148 virtual void computeDifferentialBank() = 0;
00149
00151 virtual void computeSignal(const LaserReading& reading, std::vector<double>& signal, std::vector<unsigned int>& maxRangeMapping) const = 0;
00152
00154 virtual unsigned int computeInterestPoints(const LaserReading& reading, const std::vector<double>& signal, std::vector<InterestPoint*>& point,
00155 std::vector< std::vector<unsigned int> >& indexes, std::vector<unsigned int>& maxRangeMapping) const = 0;
00156
00157 const PeakFinder* m_peakFinder;
00158 unsigned int m_scaleNumber;
00159 double m_baseSigma;
00160 double m_sigmaStep;
00161 bool m_useMaxRange;
00162 SmoothingFilterFamily m_filterType;
00163 std::vector< std::vector<double> > m_filterBank;
00164 std::vector< std::vector<double> > m_differentialBank;
00165 std::vector<double> m_scales;
00166 };
00167
00168 #endif