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