00001 #ifndef mvl2_video_from_sequence_h_ 00002 #define mvl2_video_from_sequence_h_ 00003 //: 00004 // \file 00005 // \brief A class to get video input from file 00006 // \author Franck Bettinger 00007 00008 #include <vcl_string.h> 00009 #include <vil/vil_image_view.h> 00010 #include <mvl2/mvl2_video_reader.h> 00011 00012 //: A class to get video input from avi file 00013 class mvl2_video_from_sequence: public mvl2_video_reader 00014 { 00015 public: 00016 00017 //: Dflt ctor 00018 mvl2_video_from_sequence(); 00019 00020 //: Destructor 00021 virtual ~mvl2_video_from_sequence(); 00022 00023 //: Initialize the file (format can by Grey, RGB, or more complex) 00024 virtual bool initialize( int width, int height, 00025 vcl_string format, vcl_string file_name); 00026 00027 //: Tidy up 00028 virtual void uninitialize(); 00029 00030 //: Set the size of image captured 00031 virtual void set_capture_size(int width,int height); 00032 00033 //: Return width of image (in pixels) 00034 virtual int get_width() const; 00035 00036 //: Return height of image (in pixels) 00037 virtual int get_height() const; 00038 00039 //: Return the frame rate in frames per second 00040 virtual double get_frame_rate() const; 00041 00042 //: Set the frame rate in frames per second 00043 virtual void set_frame_rate(double frame_rate); 00044 00045 //: Move frame counter on to next frame 00046 virtual int next_frame(); 00047 00048 //: Reset frame counter to zero 00049 virtual void reset_frame(); 00050 00051 //: Put frame data into the given image 00052 virtual bool get_frame(vil_image_view<vxl_byte>& image); 00053 00054 //: Name of the class 00055 virtual vcl_string is_a() const; 00056 00057 //: Create a copy on the heap and return base class pointer 00058 virtual mvl2_video_reader* clone() const; 00059 00060 //: Move frame counter on to given frame if relevant 00061 virtual int seek(int frame_number); 00062 00063 //: Returns the number of frames available from the beginning of the stream or -1 if unknown 00064 virtual int length(); 00065 00066 private: 00067 00068 int no_digits_; 00069 vcl_string file_stem_; 00070 int offset_; 00071 bool use_seq_file_; 00072 vcl_vector<vcl_string> list_files_; 00073 }; 00074 00075 #endif // mvl2_video_from_sequence_h_