$search
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 // Resources 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 // Functions 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(ModelEntry *modelEntry); 00067 virtual bool track(int id); 00068 00069 virtual void textureFromImage(bool use_num_pixels=true); 00070 00071 virtual void textureFromImage(int id, const TomGine::tgPose &pose, bool use_num_pixels=true); 00072 00073 virtual void untextureModels(); 00074 00075 virtual void drawResult(float linewidth=2.0f); 00076 00077 virtual void drawModelEntry(ModelEntry* modelEntry, float linewidth=1.0f); 00078 00079 virtual void drawTrackerModel(int id, const TomGine::tgPose &p, float linewidth=1.0f); 00080 00081 virtual void evaluatePDF( int id, 00082 float x_min, float y_min, 00083 float x_max, float y_max, 00084 int res, 00085 const char* meshfile, const char* xfile); 00086 00087 00088 virtual std::vector<float> getPDFxy( ModelEntry* modelEntry, 00089 float x_min, float y_min, 00090 float x_max, float y_max, 00091 int res); 00092 00093 virtual void savePDF( std::vector<float> vPDFMap, 00094 float x_min, float y_min, 00095 float x_max, float y_max, 00096 unsigned res, 00097 const char* meshfile, const char* xfile); 00098 00099 cv::Mat getModelTexture(); 00100 00101 }; 00102 00103 } // namespace Tracking 00104 00105 #endif