00001 #ifndef FACETSMAP_AMERSMAP_HPP
00002 #define FACETSMAP_AMERSMAP_HPP
00003
00004 #include "facetsmap/facetsanalyser.hpp"
00005 #include "facetsmap/Amer.hpp"
00006
00007 namespace jafar {
00008 namespace facetsmap {
00009 class FacetsGroupBase;
00010 class FacetsTracker;
00011 class Amer;
00012 typedef std::vector<Amer*> vAmers;
00013 class AmersMap : public FacetsAnalyser {
00014 struct AmerCandidat {
00015 AmerCandidat(Amer* a, vpFacets m, double s) : amer(a), matches(m), score(s) {}
00016 Amer* amer;
00017 vpFacets matches;
00018 double score;
00019 };
00020 public:
00021 AmersMap( const FacetsParams* params, const jafar::camera::StereoBench& stereoBench);
00022 public:
00023 virtual void processImage(jblas::mat44& robotpos, jblas::mat44& robotmovement, const boost::numeric::ublas::bounded_matrix<double,4,4>& leftToRight, const jafar::image::Image& imgl, const jafar::image::Image& imgr, const jafar::camera::StereoBench& stereoBench, int time, bool updateFacet, std::map<int, jblas::vec > predictions);
00024 private:
00028 vFacets createFacetListForAmer(double x, double y, vFacets facets);
00035 AmerCandidat* findAmerMatch(const jblas::mat44& robotpos, Facet* match, vFacets& candidats, int time);
00036 public:
00037 #ifdef HAVE_OPENGL
00038 void displayAmersMap();
00039 void initTextures() {
00040 FacetsContainer::initTextures();
00041 }
00042 void displayFacetsContainer(bool displayNormal = true, int time = -1 )
00043 {
00044 FacetsContainer::displayFacetsContainer(displayNormal, time);
00045 }
00046 #endif
00047 inline vAmers::const_iterator beginAmers() const { return m_amers.begin(); }
00048 inline vAmers::iterator beginAmers() { return m_amers.begin(); }
00049 inline vAmers::const_iterator endAmers() const { return m_amers.end(); }
00050 inline vAmers::iterator endAmers() { return m_amers.end(); }
00051 void setAmerPosition(int id, jblas::vec_range const&);
00052 public:
00053 inline const std::vector<int>& suppressedAmers() const
00054 { return m_suppressedAmers; }
00055 inline const std::vector<AmerObservation>& newObservations() const
00056 { return m_newObservations; };
00057 inline const std::vector<AmerObservation>& observations() const
00058 { return m_observations; };
00059 private:
00060 vAmers m_amers;
00061 int m_lastAmerId;
00062 std::vector<int> m_suppressedAmers;
00063 std::vector<AmerObservation> m_newObservations, m_observations;
00064 vFacets m_facetsSeenLastTime;
00065 FacetsTracker* m_facetsTracker;
00066 int m_countAmersSeen;
00067 };
00068 }
00069 }
00070
00071 #endif