00001 #ifndef bmvv_f_manager_h_
00002 #define bmvv_f_manager_h_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include <vcl_vector.h>
00017 #include <vil/vil_image_resource.h>
00018 #include <vsol/vsol_line_2d_sptr.h>
00019 #include <vsol/vsol_conic_2d_sptr.h>
00020 #include <vsol/vsol_polyline_2d_sptr.h>
00021 #include <vtol/vtol_edge_2d_sptr.h>
00022 #include <vsol/vsol_point_2d_sptr.h>
00023 #include <vtol/vtol_intensity_face_sptr.h>
00024 #include <vtol/vtol_face_2d_sptr.h>
00025 #include <vgui/vgui_wrapper_tableau.h>
00026 #include <vgui/vgui_style.h>
00027 #include <vgui/vgui_style_sptr.h>
00028 #include <vgui/vgui_grid_tableau_sptr.h>
00029 #include <vgui/vgui_range_map_params_sptr.h>
00030 #include <bgui/bgui_picker_tableau_sptr.h>
00031 #include <bgui/bgui_vtol2D_tableau_sptr.h>
00032 #include <bgui/bgui_image_tableau_sptr.h>
00033 #include <bgui/bgui_bargraph_clipon_tableau_sptr.h>
00034 #include <bgui/bgui_graph_tableau_sptr.h>
00035 #include <bgui/bgui_graph_tableau.h>
00036 #include <brct/brct_corr_sptr.h>
00037 #include <vpgl/vpgl_fundamental_matrix.h>
00038 #include <vpgl/vpgl_proj_camera.h>
00039 class vgui_window;
00040
00041 class bmvv_f_manager : public vgui_wrapper_tableau
00042 {
00043 public:
00044 bmvv_f_manager();
00045 ~bmvv_f_manager();
00046 static bmvv_f_manager *instance();
00047 void quit();
00048 void load_image();
00049 void save_image();
00050
00051
00052 void set_range_params();
00053 void intensity_profile();
00054 void intensity_histogram();
00055
00056
00057 void clear_display();
00058 void clear_all();
00059 void init();
00060 #if 0
00061 void remove_image();
00062 void convert_to_grey();
00063 #endif
00064
00065 void load_image_and_cam();
00066 void read_corrs();
00067 void save_corrs();
00068 void load_world();
00069 void save_world();
00070 void display_corrs();
00071 void read_f_matrix();
00072 void save_f_matrix();
00073 void display_left_epi_lines();
00074 void display_right_epi_lines();
00075 void display_picked_epi_line();
00076 void create_correspondence();
00077 void pick_correspondence();
00078 void compute_f_matrix();
00079 void reconstruct_world();
00080 void project_world();
00081
00082 vgui_window* get_window(){return win_;}
00083 void set_window(vgui_window* win){win_=win;}
00084
00085 protected:
00086 void draw_edges(vcl_vector<vtol_edge_2d_sptr>& edges, bool verts=false);
00087 void draw_lines(vcl_vector<vsol_line_2d_sptr> const & line_segs,
00088 const vgui_style_sptr& style = NULL);
00089
00090 void draw_conics(vcl_vector<vsol_conic_2d_sptr> const & conic_segs,
00091 const vgui_style_sptr& style = NULL);
00092
00093 void draw_polylines(vcl_vector<vsol_polyline_2d_sptr> const & polys,
00094 vgui_style_sptr style=(vgui_style*)0);
00095 void draw_regions(vcl_vector<vtol_intensity_face_sptr>& regions,
00096 bool verts=false);
00097 void draw_points(vcl_vector<vsol_point_2d_sptr> const & points,
00098 const vgui_style_sptr& style);
00099
00100 void set_selected_grid_image(vil_image_resource_sptr const& image,
00101 vgui_range_map_params_sptr const& rmps =0);
00102
00103 void add_image_at(vil_image_resource_sptr const& image,
00104 const unsigned col, const unsigned row,
00105 vgui_range_map_params_sptr const& rmps = 0);
00106
00107 void add_image(vil_image_resource_sptr const& image,
00108 vgui_range_map_params_sptr const& rmps =0);
00109
00110 vil_image_resource_sptr selected_image();
00111 vil_image_resource_sptr image_at(const unsigned col, const unsigned row);
00112 bool
00113 set_image_at(const unsigned col, const unsigned row, vil_image_resource_sptr const& image);
00114 bgui_image_tableau_sptr selected_image_tab();
00115 bgui_vtol2D_tableau_sptr vtol2D_tab_at(const unsigned col,const unsigned row);
00116 bgui_vtol2D_tableau_sptr selected_vtol2D_tab();
00117 bgui_picker_tableau_sptr selected_picker_tab();
00118 vtol_face_2d_sptr face_at(const int col, const int row);
00119 vgui_range_map_params_sptr range_params(vil_image_resource_sptr const& image);
00120 brct_corr_sptr get_selected_corr();
00121 bool point_lists(vcl_vector<vgl_point_2d<double> >& lpts,
00122 vcl_vector<vgl_point_2d<double> >& rpts);
00123
00124 private:
00125
00126 bool first_;
00127 vgui_window* win_;
00128 vgui_grid_tableau_sptr grid_;
00129 vtol_face_2d_sptr foreground_face_;
00130 vtol_face_2d_sptr background_face_;
00131 bgui_bargraph_clipon_tableau_sptr bargraph_;
00132 vcl_vector<brct_corr_sptr> corrs_;
00133 vpgl_fundamental_matrix<double> fm_;
00134 vcl_map<int, int> corr_map_;
00135 vcl_vector<vgl_point_3d<double> > world_;
00136 vcl_vector<bgui_vtol2D_tableau_sptr> vtabs_;
00137 vcl_map<int, vpgl_proj_camera<double>*> cam_map_;
00138 static bmvv_f_manager *instance_;
00139 };
00140
00141 #endif // bmvv_f_manager_h_