Go to the documentation of this file.00001
00002 #ifndef vvid_live_video_tableau_h_
00003 #define vvid_live_video_tableau_h_
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include <vgui/vgui_image_tableau_sptr.h>
00017 #include <vgui/vgui_image_tableau.h>
00018 #include <vvid/vvid_live_video_tableau.h>
00019 #include <vvid/cmu_1394_camera.h>
00020
00021 #include "vvid_live_video_tableau_sptr.h"
00022
00023 class vvid_live_video_tableau : public vgui_image_tableau
00024 {
00025 public:
00026 typedef vgui_image_tableau base;
00027 vvid_live_video_tableau();
00028
00029 vvid_live_video_tableau(int node, int pixel_sample_interval,
00030 const cmu_1394_camera_params& cp);
00031 ~vvid_live_video_tableau();
00032 vcl_string type_name() const;
00033
00034
00035 void set_camera_params(const cmu_1394_camera_params& cp);
00036 cmu_1394_camera_params get_camera_params() { return (cmu_1394_camera_params)cam_; }
00037 bool video_capabilities(int format, int mode, int frame_rate) const { return cam_.m_videoFlags[format][mode][frame_rate]; }
00038
00039 int get_current() const { return cam_.get_current(); }
00040 void set_current(int current) { cam_.set_current(current); }
00041 vcl_string current_capability_desc() const { return cam_.current_capability_desc(); }
00042 vcl_vector<vcl_string> get_capability_descriptions() const { return cam_.get_capability_descriptions(); }
00043
00044
00045 bool attach_live_video();
00046 bool start_live_video();
00047 void update_frame();
00048 void stop_live_video();
00049
00050
00051 void start_capture(vcl_string const & video_file_name) { cam_.start_capture(video_file_name); }
00052 bool stop_capture() { return cam_.stop_capture(); }
00053
00054 bool get_video_live() const { return live_; }
00055
00056
00057 void set_pixel_sample_interval(int pix_sample_itvl) { pixel_sample_interval_=pix_sample_itvl; }
00058
00059 void get_camera_rgb_image(vil1_memory_image_of< vil1_rgb<unsigned char> >& im,
00060 int pix_sample_interval = 1);
00061 void get_camera_mono_image(vil1_memory_image_of<unsigned char>& im,
00062 int pix_sample_interval = 1);
00063
00064
00065 vil1_memory_image_of< vil1_rgb<unsigned char> > get_rgb_frame() { return rgb_frame_; }
00066 vil1_memory_image_of<unsigned char> get_mono_frame() { return mono_frame_; }
00067
00068
00069
00070
00071
00072 vil1_memory_image_of< vil1_rgb<unsigned char> > get_current_rgb_image(int pix_sample_interval);
00073
00074
00075 bool get_current_rgb_image(int pix_sample_interval,
00076 vil1_memory_image_of< vil1_rgb<unsigned char> >& im);
00077
00078 vil1_memory_image_of<unsigned char> get_current_mono_image(int pix_sample_interval);
00079
00080 bool get_current_mono_image(int pix_sample_interval,
00081 vil1_memory_image_of<unsigned char>& im);
00082
00083 protected:
00084
00085 bool handle(vgui_event const &e);
00086
00087 private:
00088
00089 bool live_;
00090
00091 int node_;
00092 cmu_1394_camera cam_;
00093 int pixel_sample_interval_;
00094 vil1_memory_image_of< vil1_rgb<unsigned char> > rgb_frame_;
00095 vil1_memory_image_of< unsigned char > mono_frame_;
00096 };
00097
00098 struct vvid_live_video_tableau_new : public vvid_live_video_tableau_sptr
00099 {
00100 public:
00101 vvid_live_video_tableau_new() :
00102 vvid_live_video_tableau_sptr(new vvid_live_video_tableau()) {}
00103
00104 vvid_live_video_tableau_new(int node, int pixel_sample_interval,
00105 const cmu_1394_camera_params& cp) :
00106 vvid_live_video_tableau_sptr(new vvid_live_video_tableau(node,
00107 pixel_sample_interval,
00108 cp))
00109 {}
00110
00111 operator vgui_image_tableau_sptr () const { vgui_image_tableau_sptr tt; tt.vertical_cast(*this); return tt; }
00112 };
00113
00114 #endif // vvid_live_video_tableau_h_