$search
00001 00009 #ifndef DISTRIBUTION_H 00010 #define DISTRIBUTION_H 00011 00012 #include <blort/Tracker/Particle.h> 00013 #include <blort/TomGine/tgQuaternion.h> 00014 #include <blort/TomGine/tgMathlib.h> 00015 #include <blort/Tracker/Resources.h> 00016 #include <blort/Tracker/Timer.h> 00017 #include <blort/Tracker/headers.h> // stdio.h, stdlib.h, algorithm, gl.h, vector 00018 #include <blort/TomGine/tgVector3.h> 00019 00020 namespace Tracking{ 00021 00023 typedef std::vector<Particle> ParticleList; 00024 00026 class Distribution 00027 { 00028 public: 00029 00030 ParticleList m_particlelist; 00031 std::vector<unsigned int> queryMatches; 00032 std::vector<unsigned int> queryEdges; 00033 Particle m_meanParticle; 00034 00035 int v_max; 00036 float w_sum; 00037 float w_max; 00038 float c_max; 00039 float c_mean; 00040 float c_min; 00041 TomGine::tgVector3 m_cam_view; 00042 00043 // Functions 00044 00046 void updateQueries(); 00047 void drawParticlesEdges(TrackerModel& model, Shader* shadeCompare, bool showparticles=false); 00048 void drawParticlesTextured(TrackerModel& model, Shader* shadeCompare, bool showparticles=false); 00049 void calcLikelihood(int convergence=5); 00050 00052 void calcMean(); 00053 00054 public: 00055 Distribution(); 00056 ~Distribution(); 00057 00059 Particle getMean(){ return m_meanParticle; } 00060 00062 float getMeanC(){ return m_meanParticle.c; } 00063 00065 Particle getParticle(int id){ return (m_particlelist[id]); } 00066 00068 double getVarianceC(); 00069 00071 double getVariancePt(); 00072 00074 void normalizeW(); 00075 00077 float getMaxW(){ return w_max; } 00078 00080 float getMaxC(){ return c_max; } 00081 00083 float getMinC(){ return c_min; } 00084 00086 float getW(int id){ return m_particlelist[id].w; } 00087 00089 float getC(int id){ return m_particlelist[id].c; } 00090 00092 int size(){ return m_particlelist.size(); } 00093 00095 void copy(ParticleList &list){ list = m_particlelist; } 00096 00098 void copyParticle(Particle& p, unsigned int id){ if(id<=m_particlelist.size()) p = m_particlelist[id]; } 00099 00101 void clear(){ m_particlelist.clear(); } 00102 00104 void push_back(Particle p){ m_particlelist.push_back(p); } 00105 00110 float confidenceFunction(const float &m, const float &e); 00111 00120 void updateLikelihood(TrackerModel& model, Shader* shadeCompare, bool textured, int convergence=5, bool showparticles=false); 00121 00122 void updateLikelihood(TrackerModel& model, Shader* shadeCompare, TomGine::tgCamera* cam, Texture* tex_edge, int res=256); 00123 00124 }; 00125 00126 } // namespace Tracking 00127 00128 00129 #endif