00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef BETAGRID_H_
00024 #define BETAGRID_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
00042 class BetaGrid: public Descriptor{
00043 public:
00044 virtual Descriptor* clone() const;
00045
00051 virtual double distance(const Descriptor* descriptor) const;
00052
00054 inline const std::vector< std::vector< double > >& getHistogram() const
00055 {return m_histogram;}
00056
00058 inline std::vector< std::vector< double > >& getHistogram()
00059 {return m_histogram;}
00060
00062 inline const std::vector< std::vector< double > >& getVariance() const
00063 {return m_variance;}
00064
00066 inline std::vector< std::vector< double > >& getVariance()
00067 {return m_variance;}
00068
00070 inline const std::vector< std::vector< double > >& getHit() const
00071 {return m_hit;}
00072
00074 inline std::vector< std::vector< double > >& getHit()
00075 {return m_hit;}
00076
00078 inline const std::vector< std::vector< double > >& getMiss() const
00079 {return m_miss;}
00080
00082 inline std::vector< std::vector< double > >& getMiss()
00083 {return m_miss;}
00084
00086 inline const HistogramDistance<double>* getDistanceFunction() const
00087 {return m_distanceFunction;}
00088
00090 inline void setDistanceFunction(const HistogramDistance<double>* distanceFunction)
00091 {m_distanceFunction = distanceFunction;}
00092
00093 protected:
00094 const HistogramDistance<double> *m_distanceFunction;
00095 std::vector< std::vector< double > > m_histogram;
00096 std::vector< std::vector< double > > m_variance;
00097 std::vector< std::vector< double > > m_hit;
00098 std::vector< std::vector< double > > m_miss;
00099 };
00100
00101
00111 class BetaGridGenerator: public DescriptorGenerator {
00112 public:
00120 BetaGridGenerator(double minRho, double maxRho, unsigned int binRho, unsigned int binPhi);
00121
00131 BetaGridGenerator(const std::vector<double>& rhoEdges, const std::vector<double>& phiEdges);
00132
00133 virtual Descriptor* describe(const InterestPoint& point, const LaserReading& reading);
00134
00135 virtual Descriptor* describe(const OrientedPoint2D& point, const LaserReading& reading);
00136
00143 void setEdges(double minRho, double maxRho, unsigned int binRho, unsigned int binPhi);
00144
00146 inline double getMinRho() const
00147 {return m_rhoEdges.front();}
00148
00150 inline double getMaxRho() const
00151 {return m_rhoEdges.back();}
00152
00154 inline unsigned int getBinRho() const
00155 {return m_rhoEdges.size() - 1;}
00156
00158 inline unsigned int getBinPhi() const
00159 {return m_phiEdges.size() - 1;}
00160
00162 inline const std::vector<double>& getRhoEdges() const
00163 {return m_rhoEdges;}
00164
00166 inline const std::vector<double>& getPhiEdges() const
00167 {return m_phiEdges;}
00168
00177 inline void setEdges(const std::vector<double>& rhoEdges, const std::vector<double>& phiEdges)
00178 {m_rhoEdges = rhoEdges; m_phiEdges = phiEdges;}
00179
00181 inline const HistogramDistance<double>* getDistanceFunction() const
00182 {return m_distanceFunction;}
00183
00185 inline void setDistanceFunction(const HistogramDistance<double>* distanceFunction)
00186 {m_distanceFunction = distanceFunction;}
00187
00188 protected:
00190 bool intersectSegment2Segment(const Point2D& segment1Start, const Point2D& segment1End, const Point2D& segment2Start, const Point2D& segment2End);
00191
00193 int intersectSegment2Arc(const Point2D& segmentStart, const Point2D& segmentEnd, const Point2D& arcStart, const Point2D& arcEnd, const Point2D& arcCenter);
00194
00195 std::vector<double> m_rhoEdges;
00196 std::vector<double> m_phiEdges;
00197 const HistogramDistance<double> *m_distanceFunction;
00198 };
00199
00200 #endif