00001 /******************************************************************************* 00002 * SimpleHoughClusterer.h 00003 * 00004 * (C) 2007 AG Aktives Sehen <agas@uni-koblenz.de> 00005 * Universitaet Koblenz-Landau 00006 * 00007 * Additional information: 00008 * $Id: $ 00009 *******************************************************************************/ 00010 00011 #ifndef SimpleHoughClusterer_H 00012 #define SimpleHoughClusterer_H 00013 00014 #include <vector> 00015 #include <deque> 00016 #include <sstream> 00017 #include <list> 00018 00019 #include "../KeyPointExtraction/KeyPoint.h" 00020 #include "../KeyPointExtraction/KeyPointMatch.h" 00021 00022 #include "Workers/Math/Math.h" 00023 #include "Workers/Math/Box2D.h" 00024 00030 class SimpleHoughClusterer 00031 { 00032 public: 00033 00036 SimpleHoughClusterer( std::vector< KeyPoint >* keyPoints1, std::vector< KeyPoint >* keyPoints2, std::list< KeyPointMatch >& matches ); 00037 00039 ~SimpleHoughClusterer(); 00040 00044 void eliminateByOrientation( ); 00045 00049 void eliminateByScale( ); 00050 00054 void eliminateByPosition( float maxDistance ); 00055 00057 std::list< KeyPointMatch > getMatches() { return m_Matches; } 00058 00059 std::string getLog(); 00060 00061 private: 00062 00063 //detect maxima & return a map of which bins need to be deleted 00064 std::vector<bool> computeDeleteMap( std::vector<double> hist, int numBins, int windowSize ); 00065 00066 void eraseMatches( std::list<unsigned>& indices ); 00067 00068 float getMeanTurnAngle() const; 00069 float getMeanScaleQuotient() const; 00070 00071 void getCenters ( Point2D& centerA, Point2D& centerB ); 00072 00073 inline int deg( float rad ) { return int( rad/Math::Pi*180.0 ); } 00074 00075 //scenePoints 00076 std::vector< KeyPoint >* m_KeyPoints1; 00078 std::vector< KeyPoint >* m_KeyPoints2; 00079 00080 std::list< KeyPointMatch > m_Matches; 00081 00082 std::ostringstream m_Log; 00083 00084 }; 00085 00086 #endif