00001 // vsrl_manager.cxx 00002 // 00003 // This program was written to test the Dense Matching software 00004 // 00005 // G.W. Brooksby 00006 // 02/13/03 00007 00008 #ifndef vsrl_manager_h_ 00009 #define vsrl_manager_h_ 00010 00011 #include <vil1/vil1_image.h> 00012 #include <vil1/vil1_memory_image_of.h> 00013 #include <vgui/vgui_image_tableau_sptr.h> 00014 #include <vgui/vgui_wrapper_tableau.h> 00015 #include <vgui/vgui_grid_tableau.h> 00016 #include <vgui/vgui_easy2D_tableau.h> 00017 #include <vgui/vgui_soview2D.h> 00018 #include <vsrl/vsrl_parameters.h> 00019 #include <vdgl/vdgl_digital_region.h> 00020 #include <vtol/vtol_intensity_face_sptr.h> 00021 #include <vgl/vgl_vector_2d.h> 00022 #include <vgl/vgl_point_2d.h> 00023 #include <vgel/vgel_kl_params.h> 00024 00025 #include "vsrl_point_picker.h" 00026 00027 class vsrl_manager : public vgui_wrapper_tableau 00028 { 00029 public: 00030 ~vsrl_manager(); 00031 static vsrl_manager *instance(); 00032 void quit(); 00033 void load_left_image(); 00034 void load_right_image(); 00035 void load_disparity_image(); 00036 void save_disparity_image(); 00037 void load_params_file(); 00038 void init(); 00039 void point_pick(); 00040 void clear_all(); 00041 virtual bool handle(vgui_event const &); 00042 bool validate_point(vgl_point_2d<float> const& pt); 00043 int get_disparity(vgl_point_2d<float> const& pt); 00044 bool put_points(); 00045 bool put_lines(); 00046 bool do_dense_matching(); 00047 void find_regions(); 00048 void draw_regions(vcl_vector<vtol_intensity_face_sptr>& regions, bool verts); 00049 void set_params(); 00050 void set_kl_params(vgel_kl_params* kl_params); 00051 void draw_north_arrow(); 00052 void test_left_func(); 00053 void test_right_func(); 00054 void find_shadows(vcl_vector<vtol_intensity_face_sptr>& faces); 00055 void find_shadows(vcl_vector<vdgl_digital_region*> regions); 00056 vgui_soview2D_lineseg* draw_vector_at(vgl_vector_2d<float>* vec, float x, float y, float theta); 00057 vil1_image scale_image(vil1_memory_image_of<unsigned char> img); 00058 vil1_image scale_image(vil1_memory_image_of<double> img); 00059 vil1_image show_gradient_mag(vil1_image* im_in); 00060 vil1_image show_gradient_dir(vil1_memory_image_of<double> im_in); 00061 vil1_memory_image_of<double> make_3d(); 00062 vcl_vector<vdgl_digital_region*> run_jseg(vil1_image image_in); 00063 void show_jseg_boundaries(vil1_memory_image_of<unsigned char>* jseg_out, vgui_easy2D_tableau_sptr tab); 00064 float* show_correlations(int x, int y); 00065 inline vil1_image get_left_image() const {return imgL_;} 00066 inline vil1_image get_right_image() const {return imgR_;} 00067 inline vil1_image get_disparity_image() const {return disp_img_;} 00068 void raw_correlation(); 00069 vil1_image* make_jseg_image(vil1_memory_image_of<unsigned char>* jseg_out); 00070 void boundary_matching(); 00071 void region_disparity(); 00072 void corner_method(); 00073 void occlusion_map(); 00074 00075 private: 00076 vsrl_manager(); // default constructor is private: only one instance allowed 00077 vil1_image imgL_; 00078 vil1_image imgR_; 00079 vil1_image disp_img_; 00080 vsrl_parameters* params_; 00081 vgui_grid_tableau_sptr grid_; 00082 vgui_image_tableau_sptr itabL_; 00083 vgui_image_tableau_sptr itabR_; 00084 vgui_image_tableau_sptr dimg_tab_; 00085 vgui_easy2D_tableau_sptr e2d0_; 00086 vgui_easy2D_tableau_sptr e2d1_; 00087 vgui_easy2D_tableau_sptr e2d2_; 00088 vsrl_point_picker_sptr vpicker0_; 00089 vsrl_point_picker_sptr vpicker1_; 00090 vsrl_point_picker_sptr vpicker2_; 00091 vgl_vector_2d<float> north_; // North heading expressed as a vector 00092 vgl_vector_2d<float> sun_az_; // sun angle expressed as a vector 00093 vgl_vector_2d<float> sun_el_; // sun elevation expressed as a vector 00094 static vsrl_manager *instance_; 00095 int disparity_bias_; 00096 float shadow_mean_; 00097 bool shadows_only_; 00098 vcl_vector<float>* shadow_metric_; // vector to hold shadow saliency measure 00099 }; 00100 00101 #endif // vsrl_manager_h_
1.5.1