00001 #ifndef vsrl_epipolar_dp_setup_h 00002 #define vsrl_epipolar_dp_setup_h 00003 //: 00004 // \file 00005 // this class will take a vsrl_image_correlation class 00006 // and a given y value to define which raster is to be used. 00007 // it will then create the dynamic program which will determine 00008 // the optimal assignments between the two images 00009 00010 #include <vcl_vector.h> 00011 #include <vnl/vnl_vector.h> 00012 class vsrl_intensity_token; 00013 class vsrl_image_correlation; 00014 00015 class vsrl_raster_dp_setup 00016 { 00017 public: 00018 // constructor 00019 vsrl_raster_dp_setup(int raster_line, vsrl_image_correlation *image_correlation); 00020 // destructor 00021 ~vsrl_raster_dp_setup() { clear_token_list(tok_list1); clear_token_list(tok_list2); } 00022 00023 // accessors 00024 00025 //: get the raster line that this dynamic program is processing 00026 int get_raster_line() { return raster_line_; } 00027 //: get the assignment of pixel x 00028 int get_assignment(int x); 00029 //: the width of image1 00030 int get_image1_width(); 00031 //: the width of image2 00032 int get_image2_width(); 00033 00034 // set the search range for the dynamic program 00035 00036 void set_search_range(int range) { search_range_=range; } 00037 00038 // set the inner null cost for the dynamic program 00039 00040 void set_inner_cost(double ic) { inner_cost_=ic; } 00041 // set the outer null cost for the dynamic program 00042 00043 void set_outer_cost(double oc) { outer_cost_=oc; } 00044 00045 // set the prior raster 00046 void set_prior_raster(vsrl_raster_dp_setup *pr) { prior_raster_=pr; } 00047 00048 // set the cost of deviating from the bias 00049 00050 void set_bias_cost(double bias_cost) { bias_cost_=bias_cost; } 00051 00052 // perform the dynamic program 00053 00054 double execute(); 00055 double execute(vnl_vector<int> curr_row); 00056 00057 private: 00058 00059 //: the image correlation mechanism 00060 vsrl_image_correlation *image_correlation_; 00061 00062 //: the raster line to be processed 00063 int raster_line_; 00064 00065 // the token lists 00066 vcl_vector<vsrl_intensity_token*> tok_list1; 00067 vcl_vector<vsrl_intensity_token*> tok_list2; 00068 00069 void create_token_list(int width, 00070 vsrl_image_correlation *image_correlation, 00071 vcl_vector<vsrl_intensity_token*> &tok_list, 00072 double step=1); 00073 00074 // clear token list; 00075 void clear_token_list(vcl_vector<vsrl_intensity_token*> &tok_list); 00076 00077 //: the search range used 00078 int search_range_; 00079 00080 //: the bias cost 00081 double bias_cost_; 00082 00083 //: the inner cost 00084 double inner_cost_; 00085 //: the outer cost 00086 double outer_cost_; 00087 //: the prior raster 00088 vsrl_raster_dp_setup *prior_raster_; 00089 00090 // a method that uses the prior_raster to bias the next raster 00091 void set_token_biases(); 00092 }; 00093 00094 #endif
1.4.4