Go to the documentation of this file.00001
00009 #ifndef _TEXTURE_TRACKER_H_
00010 #define _TEXTURE_TRACKER_H_
00011
00012 #include <blort/Tracker/Tracker.h>
00013 #include <opencv2/core/core.hpp>
00014
00015 namespace Tracking{
00016
00018 class TextureTracker : public Tracker
00019 {
00020 private:
00021
00022
00023 Shader* m_shadeTexEdgeTest;
00024 Shader* m_shadeTexColorTest;
00025 Shader* m_shadeConfidenceMM;
00026 Shader* m_shadeCompare;
00027 Texture* m_tex_model;
00028 std::vector<Texture*> m_tex_model_ip;
00029 Texture* m_tex_frame_cmp;
00030 Texture* m_tex_model_cmp;
00031
00032
00033
00034 void model_processing(ModelEntry* modelEntry);
00035
00036 void particle_filtering(ModelEntry* modelEntry);
00037
00038 public:
00039 TextureTracker();
00040 ~TextureTracker();
00041
00042 virtual void setKernelSize(int val){
00043 params.kernel_size = val;
00044 m_shadeCompare->bind();
00045 m_shadeCompare->setUniform("kernelsize", params.kernel_size);
00046 m_shadeCompare->unbind();
00047 }
00048
00049 virtual void setEdgeShader(){
00050 m_shadeCompare = m_shadeTexEdgeTest;
00051 }
00052 virtual void setColorShader(){
00053 m_shadeCompare = m_shadeTexColorTest;
00054 }
00055
00056 virtual bool initInternal();
00057
00058 virtual float evaluateParticle(ModelEntry* modelEntry);
00059 virtual float evaluateParticle(ModelEntry* modelEntry, Shader* shader);
00060
00061 virtual void image_processing(unsigned char* image, GLenum format=GL_BGR);
00062 virtual void image_processing(unsigned char* image, const TomGine::tgModel &m, const TomGine::tgPose &p, GLenum format=GL_BGR);
00063 virtual void image_processing(unsigned char* image, int model_id, const TomGine::tgPose &p, GLenum format=GL_BGR);
00064
00065 virtual bool track();
00066 bool track(const std::vector<bool> & tracking_objects);
00067 bool track(ModelEntry *modelEntry);
00068 virtual bool track(int id);
00069
00070 virtual void textureFromImage(bool use_num_pixels=true);
00071
00072 virtual void textureFromImage(int id, const TomGine::tgPose &pose, bool use_num_pixels=true);
00073
00074 virtual void untextureModels();
00075
00076 virtual void drawResult(float linewidth=2.0f);
00077
00078 void drawResult(int id, float linewidth);
00079
00080 virtual void drawModelEntry(ModelEntry* modelEntry, float linewidth=1.0f);
00081
00082 virtual void drawTrackerModel(int id, const TomGine::tgPose &p, float linewidth=1.0f);
00083
00084 virtual void evaluatePDF( int id,
00085 float x_min, float y_min,
00086 float x_max, float y_max,
00087 int res,
00088 const char* meshfile, const char* xfile);
00089
00090
00091 virtual std::vector<float> getPDFxy( ModelEntry* modelEntry,
00092 float x_min, float y_min,
00093 float x_max, float y_max,
00094 int res);
00095
00096 virtual void savePDF( std::vector<float> vPDFMap,
00097 float x_min, float y_min,
00098 float x_max, float y_max,
00099 unsigned res,
00100 const char* meshfile, const char* xfile);
00101
00102 cv::Mat getModelTexture();
00103
00104 };
00105
00106 }
00107
00108 #endif