contrib/brl/vvid/vvid_live_video_manager.h
Go to the documentation of this file.
00001 // This is brl/vvid/vvid_live_video_manager.h
00002 #ifndef vvid_live_video_manager_h_
00003 #define vvid_live_video_manager_h_
00004 //
00005 //-----------------------------------------------------------------------------
00006 //:
00007 // \file
00008 // \brief A manager for displaying a live video sequence and live segmentation and processing overlays
00009 // \author
00010 //   J.L. Mundy
00011 //
00012 // \verbatim
00013 //  Modifications:
00014 //   J.L. Mundy January 09, 2002    Initial version.
00015 // \endverbatim
00016 //-----------------------------------------------------------------------------
00017 
00018 #include <vil1/vil1_memory_image_of.h>
00019 #include <vgui/vgui_wrapper_tableau.h>
00020 #include <bgui/bgui_vtol2D_tableau_sptr.h>
00021 #include <vvid/cmu_1394_camera.h>
00022 #include <vpro/vpro_video_process_sptr.h>
00023 #include <vvid/vvid_live_video_tableau.h>
00024 #include <bgui/bgui_histogram_tableau_sptr.h>
00025 
00026 class vgui_window;
00027 
00028 class vvid_live_video_manager : public vgui_wrapper_tableau
00029 {
00030  public:
00031   vvid_live_video_manager();
00032  ~vvid_live_video_manager();
00033   static vvid_live_video_manager *instance();
00034 
00035   //:post construction actions
00036   void init();
00037 
00038   //: properties of the video frames
00039   unsigned get_height() const { return height_; }
00040   unsigned get_width() const { return width_; }
00041 
00042   //: control video parameters
00043   void set_camera_params();
00044 
00045   //: change edge detection parameters
00046   void set_detection_params();
00047 
00048   //: no process
00049   void no_op();
00050 
00051   //: control video collection
00052   void start_live_video();
00053   void stop_live_video();
00054 
00055   //: show/hide histograms
00056   void toggle_histogram();
00057 
00058   //: capture and save a video sequence (old approach)
00059   void capture_sequence();
00060 
00061   //: new capture approach
00062   void init_capture();
00063   void stop_capture();
00064 
00065   //: quit the application
00066   void quit();
00067 
00068   //: access to the current frames
00069   bool get_current_rgb_image(unsigned camera_index,
00070                              int pix_sample_interval,
00071                              vil1_memory_image_of< vil1_rgb<unsigned char> >& im);
00072 
00073   bool get_current_mono_image(unsigned camera_index,
00074                               int pix_sample_interval,
00075                               vil1_memory_image_of<unsigned char>& im);
00076 
00077   //: control of the process result window
00078   void set_process_rgb_image(vil1_memory_image_of< vil1_rgb<unsigned char> >& im);
00079   void set_process_mono_image(vil1_memory_image_of<unsigned char>& im);
00080 
00081   //: access to the window
00082   vgui_window* get_window(){return win_;}
00083   void set_window(vgui_window* win){win_=win;}
00084 
00085   //: the virtual handle function
00086   virtual bool handle(const vgui_event&);
00087  protected:
00088   void display_topology();
00089   void display_image();
00090  private:
00091   //utility functions
00092   void run_frames();
00093   //flags
00094   bool init_successful_;
00095   bool edges_;
00096   bool histogram_;
00097   int sample_;
00098   unsigned width_;
00099   unsigned height_;
00100   unsigned num_cameras_;
00101   double min_msec_per_frame_;
00102   vgui_window* win_;
00103   vcl_vector <bgui_vtol2D_tableau_sptr> vt2Ds_;
00104   vcl_vector <vvid_live_video_tableau_sptr> vtabs_;
00105   vcl_vector <bgui_histogram_tableau_sptr> htabs_;
00106   cmu_1394_camera_params cp_;
00107   vil1_memory_image_of< vil1_rgb<unsigned char> > process_rgb_;
00108   vil1_memory_image_of<unsigned char> process_mono_;
00109   vpro_video_process_sptr video_process_;
00110   static vvid_live_video_manager *instance_;
00111 };
00112 
00113 #endif // vvid_live_video_manager_h_