00001 //-*-c++-*- 00002 // This is brl/bseg/strk/strk_info_model_tracker.h 00003 #ifndef strk_info_model_tracker_h_ 00004 #define strk_info_model_tracker_h_ 00005 //--------------------------------------------------------------------- 00006 //: 00007 // \file 00008 // \brief a processor for tracking an articulated model 00009 // 00010 // The info_model_tracker operates by randomly generating a 00011 // set of hypotheses in the vicinity of the previous best n matches. 00012 // These new hypotheses are tested,using mutual information on intensity 00013 // and optionally gradient direction. Each sample represents a different 00014 // configuration of the strk_art_art_info_model. 00015 // 00016 // \author 00017 // J.L. Mundy - November 05, 2003 00018 // 00019 // \verbatim 00020 // Modifications 00021 // <none> 00022 // \endverbatim 00023 // 00024 //------------------------------------------------------------------------- 00025 #include <vcl_vector.h> 00026 #include <vil1/vil1_image.h> 00027 #include <vil1/vil1_memory_image_of.h> 00028 #include <vtol/vtol_face_2d_sptr.h> 00029 #include <vtol/vtol_intensity_face_sptr.h> 00030 #include <strk/strk_tracking_face_2d_sptr.h> 00031 #include <strk/strk_art_info_model_sptr.h> 00032 #include <strk/strk_info_model_tracker_params.h> 00033 00034 class strk_info_model_tracker : public strk_info_model_tracker_params 00035 { 00036 public: 00037 //Constructors/destructor 00038 strk_info_model_tracker(strk_info_model_tracker_params& tp); 00039 00040 ~strk_info_model_tracker(); 00041 //Accessors 00042 void set_image_0(vil1_image& image); 00043 void set_image_i(vil1_image& image); 00044 void set_initial_model(vcl_vector<vtol_face_2d_sptr> const & faces) 00045 {initial_model_ = faces;} 00046 strk_art_info_model_sptr get_best_sample(); 00047 void get_samples(vcl_vector<strk_art_info_model_sptr> & samples); 00048 strk_art_info_model_sptr tf(int i){return current_samples_[i];} 00049 //Utility Methods 00050 void init(); 00051 void generate_samples(); 00052 void cull_samples(); 00053 void track(); 00054 void clear(); 00055 00056 protected: 00057 //protected methods 00058 00059 //: fill the pixels in the input face from the input image 00060 void fill_face(vtol_intensity_face_sptr const& face, 00061 vil1_memory_image_of<float> const& image); 00062 00063 //: set the gradient values in the model face 00064 void set_gradient(strk_art_info_model_sptr tf, 00065 vil1_memory_image_of<float> const& Ix, 00066 vil1_memory_image_of<float> const& Iy); 00067 00068 //: Generate a random sample 00069 strk_art_info_model_sptr 00070 generate_model(strk_art_info_model_sptr const& seed); 00071 00072 double compute_intensity_mutual_information(strk_art_info_model_sptr tf); 00073 double compute_gradient_mutual_information(strk_art_info_model_sptr tf); 00074 00075 //members 00076 vil1_memory_image_of<float> image_0_; //frame 0 00077 vil1_memory_image_of<float> image_i_; //frame i 00078 vil1_memory_image_of<float> Ix_0_; //x derivative of image_0 00079 vil1_memory_image_of<float> Iy_0_; //y derivative of image_0 00080 vil1_memory_image_of<float> Ix_i_; //x derivative of image_i 00081 vil1_memory_image_of<float> Iy_i_; //y derivative of image_i 00082 00083 vcl_vector<vtol_face_2d_sptr> initial_model_; 00084 vcl_vector<strk_art_info_model_sptr> current_samples_; 00085 vcl_vector<strk_art_info_model_sptr> hypothesized_samples_; 00086 double model_intensity_entropy_; 00087 double model_gradient_dir_entropy_; 00088 }; 00089 00090 #endif // strk_info_model_tracker_h_
1.4.4