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 "Workers/KeyPointExtraction/KeyPoint.h" 00020 #include "Workers/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 00055 void eliminateByPosition( float maxDistance ); 00056 00058 std::list< KeyPointMatch > getMatches() { return m_Matches; } 00059 00060 std::string getLog(); 00061 00062 private: 00063 00064 //detect maxima & return a map of which bins need to be deleted 00065 std::vector<bool> computeDeleteMap( std::vector<double> hist, int numBins, int windowSize ); 00066 00067 void eraseMatches( std::list<unsigned>& indices ); 00068 00069 float getMeanTurnAngle() const; 00070 float getMeanScaleQuotient() const; 00071 00072 void getCenters ( Point2D& centerA, Point2D& centerB ); 00073 00074 inline int deg( float rad ) { return int( rad/Math::Pi*180.0 ); } 00075 00076 //scenePoints 00077 std::vector< KeyPoint >* m_KeyPoints1; 00079 std::vector< KeyPoint >* m_KeyPoints2; 00080 00081 std::list< KeyPointMatch > m_Matches; 00082 00083 std::ostringstream m_Log; 00084 00085 }; 00086 00087 #endif