contrib/brl/vvid/vvid_live_stereo_manager.h
Go to the documentation of this file.
00001 // This is brl/vvid/vvid_live_stereo_manager.h
00002 #ifndef vvid_live_stereo_manager_h_
00003 #define vvid_live_stereo_manager_h_
00004 //--------------------------------------------------------------------------------
00005 //:
00006 // \file
00007 // \brief the live_video_manager for playing video sequences
00008 // \author
00009 //   J.L. Mundy
00010 //
00011 // \verbatim
00012 //  Modifications:
00013 //   J.L. Mundy Apr 14, 2002    Initial version.
00014 // \endverbatim
00015 //--------------------------------------------------------------------------------
00016 #include <vcl_vector.h>
00017 #include <vil1/vil1_memory_image_of.h>
00018 #include <vgui/vgui_grid_tableau.h>
00019 #include <vgui/vgui_image_tableau_sptr.h>
00020 #include <vgui/vgui_viewer2D_tableau_sptr.h>
00021 #include <vgui/vgui_window.h>
00022 #include <vvid/cmu_1394_camera.h>
00023 #include <vpro/vpro_video_process_sptr.h>
00024 #include <vvid/vvid_live_video_tableau.h>
00025 
00026 //: A manager for displaying live video frames and processing on the frames.
00027 //  The cameras are assumed to be wrapped in the live_video_frame
00028 //  class. At startup the number of cameras is determined. A reduced resolution
00029 //  image of each camera is shown in an array at the right of the display. The
00030 //  top is camera 0 the bottom is camera N-1. The left pane is used to display
00031 //  results of processing on the set of cameras.
00032 class vvid_live_stereo_manager : public vgui_grid_tableau
00033 {
00034  public:
00035   vvid_live_stereo_manager();
00036  ~vvid_live_stereo_manager();
00037   static vvid_live_stereo_manager *instance();
00038 
00039   //: properties of the video frames
00040   unsigned get_height() const { return height_; }
00041   unsigned get_width() const { return width_; }
00042 
00043   //: properties of the camera setup
00044   int get_N_views() const { return N_views_; }
00045 
00046   //: control live video actions
00047   void set_camera_params();
00048   void setup_views();
00049   void start_live_video();
00050   void stop_live_video();
00051   void quit();
00052   //: access to the current frames
00053   bool get_current_rgb_image(int view_no, int pix_sample_interval,
00054                              vil1_memory_image_of<vil1_rgb<unsigned char> >& im);
00055 
00056   bool get_current_mono_image(int view_no, int pix_sample_interval,
00057                               vil1_memory_image_of<unsigned char>& im);
00058 
00059   //: control of the process result window
00060   void set_process_rgb_image(vil1_memory_image_of< vil1_rgb<unsigned char> >& im);
00061   void set_process_mono_image(vil1_memory_image_of<unsigned char>& im);
00062 
00063   //: access to the window
00064   vgui_window* get_window(){return win_;}
00065   void set_window(vgui_window* win){win_=win;}
00066 
00067   //: the virtual handle function
00068   virtual bool handle(const vgui_event&);
00069 
00070  private:
00071   //utility functions
00072   void run_frames();
00073   //flags
00074   bool init_successful_;
00075   bool live_capture_;
00076   int N_views_;
00077   unsigned width_;
00078   unsigned height_;
00079   vgui_window* win_;
00080 
00081   vgui_image_tableau_sptr it_;
00082   vgui_viewer2D_tableau_sptr v2D_;
00083   vcl_vector<vvid_live_video_tableau_sptr> vframes_;
00084   cmu_1394_camera_params cp_;
00085   vil1_memory_image_of< vil1_rgb<unsigned char> > process_rgb_;
00086   vil1_memory_image_of<unsigned char> process_mono_;
00087   vpro_video_process_sptr video_process_;
00088   static vvid_live_stereo_manager *instance_;
00089 };
00090 
00091 #endif // vvid_live_stereo_manager_h_