00001 #ifndef _FACETS_ANALYSER_HPP_
00002 #define _FACETS_ANALYSER_HPP_
00003
00004 #include <vector>
00005
00006
00007 #include "image/Image.hpp"
00008 #include "camera/cameraPinhole.hpp"
00009 #include "gfm/InterestFeature.hpp"
00010 #include "jmath/jblas.hpp"
00011
00012 #include "facetsmap/facetscontainer.hpp"
00013
00014 namespace jafar {
00015 namespace gfm {
00016 class Engine;
00017 }
00018 namespace facetsmap {
00019 class FacetsParams;
00020 class FacetsDetector;
00021 struct ProcessStats {
00022 ProcessStats() : count_good(0), count_bad(0), count_see_again(0), reasons(10), reasonNotGood(0), count_facet_rematch(0)
00023 {
00024 reasons[0] = 0;reasons[1] = 0;reasons[2] = 0;reasons[3] = 0;reasons[4] = 0;
00025 }
00026 void dump();
00027 int count_good;
00028 int count_bad;
00029 int count_see_again;
00030 std::vector<int> reasons;
00031 int reasonNotGood;
00032 int count_facet_rematch;
00033 };
00034 class FacetsAnalyser : public FacetsContainer {
00035
00036 public:
00037 FacetsAnalyser(const FacetsParams* params );
00038 virtual ~FacetsAnalyser() {};
00039 public:
00047 virtual void processImage(jblas::mat44& robotpos, jblas::mat44& robotmovement,
00048 const boost::numeric::ublas::bounded_matrix<double,4,4>& leftToRight,
00049 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) =0;
00053 void dumpProcessStats();
00054 protected:
00060 vFacets analyseImage(const jafar::image::Image& imgl, const jafar::image::Image& imgr, const camera::StereoBench& stereoBench, int time, bool updateFacet);
00066 Facet * findRecentFacetContaining( jblas::vec3 v );
00067 inline void insertFacet(uint id, Facet* f, bool lookneigh = false)
00068 {
00069 FacetsContainer::insertFacet(id, f, lookneigh);
00070 m_recentFacets.push_back(f);
00071 }
00072 inline const FacetsParams* params() { return m_params; };
00073 private:
00074 const FacetsParams* m_params;
00075 std::vector<ProcessStats> m_processStats;
00076 vFacets m_recentFacets;
00077 gfm::Engine* m_matchingEngine;
00078 FacetsDetector* m_facetsDetector;
00079 };
00080
00081 };
00082 };
00083
00084
00085 #endif