core/vidl_vil1/vidl_vil1_clip.h

Go to the documentation of this file.
00001 #ifndef vidl_vil1_clip_h
00002 #define vidl_vil1_clip_h
00003 //:
00004 // \file
00005 // \author Nicolas Dano, september 1999
00006 //
00007 // \verbatim
00008 //  Modifications
00009 //   June 2000 Julien ESTEVE          Ported from TargetJr
00010 //   10/4/2001 Ian Scott (Manchester) Converted perceps header to doxygen
00011 //   10/9/2004 Peter Vanroose  Inlined all 1-line methods in class decl
00012 // \endverbatim
00013 
00014 #include <vbl/vbl_ref_count.h>
00015 #include <vidl_vil1/vidl_vil1_clip_sptr.h>
00016 #include <vidl_vil1/vidl_vil1_frame_sptr.h>
00017 #include <vidl_vil1/vidl_vil1_codec_sptr.h>
00018 #include <vil1/vil1_image.h>
00019 
00020 #include <vcl_vector.h>
00021 #include <vcl_list.h>
00022 
00023 //: Sequence of frames, element of a movie
00024 //   A clip is a set of frames, it is part of a Movie.
00025 //   It has the notion of starting frame, ending frame
00026 //   and increment, so that when we iterate through the
00027 //   sequence, it will iterate only through the frames
00028 //   of interest.
00029 //
00030 //   See also vidl_vil1_frame and vidl_vil1_movie.
00031 
00032 class vidl_vil1_clip : public vbl_ref_count
00033 {
00034   // PUBLIC INTERFACE
00035  public:
00036 
00037   // Constructors
00038   vidl_vil1_clip(vidl_vil1_codec_sptr codec,
00039                  int start = 0,
00040                  int end = 0,
00041                  int increment = 1);
00042 
00043   vidl_vil1_clip(vcl_list<vil1_image> &images,
00044                  int start = 0,
00045                  int end = 0,
00046                  int increment = 1);
00047 
00048   vidl_vil1_clip(vcl_vector<vil1_image> &images,
00049                  int start = 0,
00050                  int end = 0,
00051                  int increment = 1);
00052 
00053   // Copy constructor.
00054   vidl_vil1_clip(vidl_vil1_clip const& x)
00055     : vbl_ref_count(), frames_(x.frames_),
00056       startframe_(x.startframe_), endframe_(x.endframe_),
00057       increment_(x.increment_), frame_rate_(x.frame_rate_), coder_(x.coder_) {}
00058 
00059   // Destructor
00060   ~vidl_vil1_clip() {}
00061 
00062   // Data Access
00063   vidl_vil1_frame_sptr get_frame(int n);
00064 
00065   //: Return the number of frames
00066   int length() const { return (endframe_-startframe_)/increment_ + 1; }
00067 
00068   // Get the size in pixels
00069   int width() const;
00070   int height() const;
00071 
00072   //: Return the codec.
00073   vidl_vil1_codec_sptr get_codec() { return coder_; }
00074 
00075  protected:
00076   void init(int start, int end, int increment);
00077 
00078   // Data Members
00079   vcl_vector<vidl_vil1_frame_sptr> frames_; //!< Where are the frames stored
00080   int startframe_;               //!< The clip begins at startframe_
00081   int endframe_;                 //!< The clip ends at startframe_
00082   int increment_;                //!< The clip uses 1 frame every "increment_"
00083   double frame_rate_;            //!< 1 frame every ?? secs
00084   vidl_vil1_codec_sptr coder_;   //!< video codec used for storage
00085 };
00086 
00087 #endif // vidl_vil1_clip_h

Generated on Tue Dec 2 05:09:13 2008 for core/vidl_vil1 by  doxygen 1.5.1