00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef SHAPECONTEXT_H_
00024 #define SHAPECONTEXT_H_
00025
00026 #include <feature/Descriptor.h>
00027 #include <feature/InterestPoint.h>
00028 #include <sensors/LaserReading.h>
00029 #include <utils/HistogramDistances.h>
00030 #include <vector>
00031
00041 class ShapeContext: public Descriptor{
00042 public:
00043 virtual Descriptor* clone() const;
00044
00050 virtual double distance(const Descriptor* descriptor) const;
00051
00053 inline const std::vector< std::vector< double > >& getHistogram() const
00054 {return m_histogram;}
00055
00057 inline std::vector< std::vector< double > >& getHistogram()
00058 {return m_histogram;}
00059
00061 inline const HistogramDistance<double>* getDistanceFunction() const
00062 {return m_distanceFunction;}
00063
00065 inline void setDistanceFunction(const HistogramDistance<double>* distanceFunction)
00066 {m_distanceFunction = distanceFunction;}
00067
00068 protected:
00069 const HistogramDistance<double> *m_distanceFunction;
00070 std::vector< std::vector< double > > m_histogram;
00071 };
00072
00082 class ShapeContextGenerator: public DescriptorGenerator {
00083 public:
00091 ShapeContextGenerator(double minRho, double maxRho, unsigned int binRho, unsigned int binPhi);
00092
00102 ShapeContextGenerator(const std::vector<double>& rhoEdges, const std::vector<double>& phiEdges);
00103
00104 virtual Descriptor* describe(const InterestPoint& point, const LaserReading& reading);
00105
00106 virtual Descriptor* describe(const OrientedPoint2D& point, const LaserReading& reading);
00107
00114 void setEdges(double minRho, double maxRho, unsigned int binRho, unsigned int binPhi);
00115
00117 inline double getMinRho() const
00118 {return m_rhoEdges.front();}
00119
00121 inline double getMaxRho() const
00122 {return m_rhoEdges.back();}
00123
00125 inline unsigned int getBinRho() const
00126 {return m_rhoEdges.size() - 1;}
00127
00129 inline unsigned int getBinPhi() const
00130 {return m_phiEdges.size() - 1;}
00131
00133 inline const std::vector<double>& getRhoEdges() const
00134 {return m_rhoEdges;}
00135
00137 inline const std::vector<double>& getPhiEdges() const
00138 {return m_phiEdges;}
00139
00148 inline void setEdges(const std::vector<double>& rhoEdges, const std::vector<double>& phiEdges)
00149 {m_rhoEdges = rhoEdges; m_phiEdges = phiEdges;}
00150
00152 inline const HistogramDistance<double>* getDistanceFunction() const
00153 {return m_distanceFunction;}
00154
00156 inline void setDistanceFunction(const HistogramDistance<double>* distanceFunction)
00157 {m_distanceFunction = distanceFunction;}
00158
00159 protected:
00160 std::vector<double> m_rhoEdges;
00161 std::vector<double> m_phiEdges;
00162 const HistogramDistance<double> *m_distanceFunction;
00163 };
00164
00165 #endif