Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

strk_info_tracker.h

Go to the documentation of this file.
00001 // This is brl/bseg/strk/strk_info_tracker.h
00002 #ifndef strk_info_tracker_h_
00003 #define strk_info_tracker_h_
00004 //---------------------------------------------------------------------
00005 //:
00006 // \file
00007 // \brief a processor for tracking a face_2d based on intensity matching
00008 //
00009 //  The info_tracker operates by randomly generating a set of hypotheses in the
00010 //  vicinity of the previous best n matches. These new hypotheses are tested,
00011 //  (for now by normalized cross-correlation) and ranked to select the best
00012 //  matches for the next iteration.  The current algorithm assumes an
00013 //  equiform transform between frames.
00014 //
00015 // \author
00016 //  J.L. Mundy - August 20, 2003
00017 //
00018 // \verbatim
00019 //  Modifications
00020 //   Restructured to use tracking face - Oct 30, 2003
00021 //   Add Parzen window smoothing - Jan 15, 2004
00022 //   Add Background model - Mar 21, 2004
00023 //   Second Background Attempt - Sept, 2004
00024 //   Add Histogram Feature Capture  - Nov, 2004
00025 // \endverbatim
00026 //
00027 //-------------------------------------------------------------------------
00028 #include <vcl_vector.h>
00029 #include <vil1/vil1_image.h>
00030 #include <vil1/vil1_memory_image_of.h>
00031 #include <vtol/vtol_face_2d_sptr.h>
00032 #include <vtol/vtol_topology_object_sptr.h>
00033 #include <strk/strk_tracking_face_2d_sptr.h>
00034 #include <strk/strk_info_tracker_params.h>
00035 
00036 class strk_info_tracker : public strk_info_tracker_params
00037 {
00038  public:
00039   //Constructors/destructor
00040   strk_info_tracker(strk_info_tracker_params& tp);
00041 
00042   ~strk_info_tracker();
00043   //Accessors
00044   void set_image_0(vil1_image& image);
00045   void set_image_i(vil1_image& image);
00046   void set_initial_model(vtol_face_2d_sptr const& face);
00047   void set_capture_face(vtol_face_2d_sptr const& face, bool first_frame=false);
00048 #if 0
00049   void set_background(vtol_face_2d_sptr const& face);
00050   vtol_face_2d_sptr current_background();
00051 #endif // 0
00052   vtol_face_2d_sptr get_best_sample();
00053   void get_samples(vcl_vector<vtol_face_2d_sptr> & samples);
00054   strk_tracking_face_2d_sptr tf(int i){return current_samples_[i];}
00055   void get_best_face_points(vcl_vector<vtol_topology_object_sptr>& points);
00056   bool get_background_faces(vcl_vector<vtol_face_2d_sptr>& faces);
00057   strk_tracking_face_2d_sptr initial_tf(){return initial_tf_;}
00058   strk_tracking_face_2d_sptr capture_tf(){return capture_tf_;}
00059   vcl_vector<float> histograms();
00060   vcl_vector<float> capture_histograms(bool first_frame = false);
00061   //Utility Methods
00062   bool init();
00063   bool construct_background_faces(vtol_face_2d_sptr const& current_model,
00064                                   bool first_frame = false);
00065   void generate_samples();
00066   void cull_samples();
00067   void track();
00068   void clear();
00069   //: Evalutate the information at the initial region
00070   void evaluate_info();
00071  protected:
00072   //:random choice to refresh the intensity data of a sample
00073   bool refresh_sample();
00074   //: Generate a new tracking face
00075   strk_tracking_face_2d_sptr
00076   generate_randomly_positioned_sample(strk_tracking_face_2d_sptr const& seed);
00077   //: Generate a new tracking face with refreshed data
00078   strk_tracking_face_2d_sptr
00079   clone_and_refresh_data(strk_tracking_face_2d_sptr const& sample);
00080   //: Extract the marginal histograms from the current tracking face
00081   vcl_vector<float> 
00082     extract_histograms(strk_tracking_face_2d_sptr const& tf,
00083                        bool first_frame=false);
00084 #if 0
00085   //: Construct a multiply connected background face
00086   bool construct_background_face(vtol_face_2d_sptr& face);
00087   void refine_best_sample();
00088 #endif // 0
00089   //members
00090   vil1_memory_image_of<float> image_0_;  //frame 0 intensity
00091   vil1_memory_image_of<float> image_i_;  //frame i intensity
00092   vil1_memory_image_of<float> hue_0_;  //hue of image_0
00093   vil1_memory_image_of<float> sat_0_;  //saturation of image_0
00094   vil1_memory_image_of<float> hue_i_;  //hue of image i
00095   vil1_memory_image_of<float> sat_i_;  //saturation of image_i
00096   vil1_memory_image_of<float> Ix_0_;  //x derivative of image_0 intensity
00097   vil1_memory_image_of<float> Iy_0_;  //y derivative of image_0 intensity
00098   vil1_memory_image_of<float> Ix_i_;  //x derivative of image_i intensity
00099   vil1_memory_image_of<float> Iy_i_;  //y derivative of image_i intensity
00100   vtol_face_2d_sptr initial_model_;   //initial model region
00101   vtol_face_2d_sptr capture_face_;  //pre-stored track face for feature capture
00102   strk_tracking_face_2d_sptr initial_tf_; //initial tracking face
00103   strk_tracking_face_2d_sptr capture_tf_; //feature capture tracking face
00104 #if 0
00105   vtol_face_2d_sptr orig_background_face_; //!< includes model pixels
00106   vtol_face_2d_sptr background_face_;//!< multiply connected
00107 #endif // 0
00108   vcl_vector<strk_tracking_face_2d_sptr> current_samples_;
00109   vcl_vector<strk_tracking_face_2d_sptr> hypothesized_samples_;
00110   vcl_vector<strk_tracking_face_2d_sptr> track_history_;
00111   vcl_vector<strk_tracking_face_2d_sptr> background_faces_;
00112 };
00113 
00114 #endif // strk_info_tracker_h_

Generated on Thu Jan 10 14:53:19 2008 for contrib/brl/bseg/strk by  doxygen 1.4.4