vidl_image_list_istream Class Reference

#include <vidl_image_list_istream.h>

Inheritance diagram for vidl_image_list_istream:

vidl_istream List of all members.

Detailed Description

A video input stream from a list of images on disk.

This istream will try to open and validate (but not read image data from) every file in a list of file paths. The paths to valid image files are maintained, but only one image is opened at a time. Keeping a list of open file descriptors (via vil_image_resource_sptr) was found to be problematic. The number of simultaneously open files is limited on many platforms. The paths are tested for validity at the "open" stage rather than the "stream" stage so that we have random access to the frames (i.e. the stream is seekable).

Definition at line 27 of file vidl_image_list_istream.h.


Public Member Functions

 vidl_image_list_istream ()
 Constructor - default.
 vidl_image_list_istream (const vcl_string &glob)
 Constructor - from a file glob string.
 vidl_image_list_istream (const vcl_vector< vcl_string > &paths)
 Constructor - from a vector of file paths.
virtual ~vidl_image_list_istream ()
 Destructor.
virtual bool open (const vcl_string &glob)
 Open a new stream using a file glob (see vul_file_iterator).
virtual bool open (const vcl_vector< vcl_string > &paths)
 Open a new stream using a vector of file paths.
virtual void close ()
 Close the stream.
virtual bool is_open () const
 Return true if the stream is open for reading.
virtual bool is_valid () const
 Return true if the stream is in a valid state.
virtual bool is_seekable () const
 Return true if the stream support seeking.
virtual int num_frames () const
 Return the number of frames if known.
virtual unsigned int frame_number () const
 Return the current frame number.
virtual unsigned int width () const
 Return the width of each frame.
virtual unsigned int height () const
 Return the height of each frame.
virtual vidl_pixel_format format () const
 Return the pixel format.
virtual double frame_rate () const
 Return the frame rate (0.0 if unspecified).
virtual double duration () const
 Return the duration in seconds (0.0 if unknown).
virtual bool advance ()
 Advance to the next frame (but do not open the next image).
virtual vidl_frame_sptr read_frame ()
 Read the next frame from the stream.
virtual vidl_frame_sptr current_frame ()
 Return the current frame in the stream.
vcl_string current_path () const
 Return the path to the current image in the stream.
virtual bool seek_frame (unsigned int frame_number)
 Seek to the given frame number (but do not load the image).
void ref ()
 Increment reference count.
void unref ()
 Decrement reference count.
int ref_count () const
 Number of objects referring to this data.

Private Attributes

vcl_vector< vcl_string > image_paths_
 The vector of images.
unsigned int index_
 The current index.
unsigned int ni_
 The image width.
unsigned int nj_
 The image height.
vidl_pixel_format format_
 The pixel format.
vidl_frame_sptr current_frame_
 The current frame (cached).

Constructor & Destructor Documentation

vidl_image_list_istream::vidl_image_list_istream (  ) 

Constructor - default.

Definition at line 30 of file vidl_image_list_istream.cxx.

vidl_image_list_istream::vidl_image_list_istream ( const vcl_string &  glob  ) 

Constructor - from a file glob string.

Definition at line 39 of file vidl_image_list_istream.cxx.

vidl_image_list_istream::vidl_image_list_istream ( const vcl_vector< vcl_string > &  paths  ) 

Constructor - from a vector of file paths.

virtual vidl_image_list_istream::~vidl_image_list_istream (  )  [inline, virtual]

Destructor.

Definition at line 41 of file vidl_image_list_istream.h.


Member Function Documentation

bool vidl_image_list_istream::open ( const vcl_string &  glob  )  [virtual]

Open a new stream using a file glob (see vul_file_iterator).

Note:
files are loaded in alphanumeric order by path name

Definition at line 53 of file vidl_image_list_istream.cxx.

bool vidl_image_list_istream::open ( const vcl_vector< vcl_string > &  paths  )  [virtual]

Open a new stream using a vector of file paths.

Note:
all files are tested and only valid image files are retained

Definition at line 90 of file vidl_image_list_istream.cxx.

void vidl_image_list_istream::close (  )  [virtual]

Close the stream.

Implements vidl_istream.

Definition at line 120 of file vidl_image_list_istream.cxx.

virtual bool vidl_image_list_istream::is_open (  )  const [inline, virtual]

Return true if the stream is open for reading.

Implements vidl_istream.

Definition at line 57 of file vidl_image_list_istream.h.

virtual bool vidl_image_list_istream::is_valid (  )  const [inline, virtual]

Return true if the stream is in a valid state.

Implements vidl_istream.

Definition at line 60 of file vidl_image_list_istream.h.

virtual bool vidl_image_list_istream::is_seekable (  )  const [inline, virtual]

Return true if the stream support seeking.

Implements vidl_istream.

Definition at line 64 of file vidl_image_list_istream.h.

virtual int vidl_image_list_istream::num_frames (  )  const [inline, virtual]

Return the number of frames if known.

returns -1 for non-seekable streams

Implements vidl_istream.

Definition at line 68 of file vidl_image_list_istream.h.

virtual unsigned int vidl_image_list_istream::frame_number (  )  const [inline, virtual]

Return the current frame number.

Implements vidl_istream.

Definition at line 71 of file vidl_image_list_istream.h.

virtual unsigned int vidl_image_list_istream::width (  )  const [inline, virtual]

Return the width of each frame.

Implements vidl_istream.

Definition at line 74 of file vidl_image_list_istream.h.

virtual unsigned int vidl_image_list_istream::height (  )  const [inline, virtual]

Return the height of each frame.

Implements vidl_istream.

Definition at line 77 of file vidl_image_list_istream.h.

virtual vidl_pixel_format vidl_image_list_istream::format (  )  const [inline, virtual]

Return the pixel format.

Implements vidl_istream.

Definition at line 80 of file vidl_image_list_istream.h.

virtual double vidl_image_list_istream::frame_rate (  )  const [inline, virtual]

Return the frame rate (0.0 if unspecified).

Implements vidl_istream.

Definition at line 83 of file vidl_image_list_istream.h.

virtual double vidl_image_list_istream::duration (  )  const [inline, virtual]

Return the duration in seconds (0.0 if unknown).

Implements vidl_istream.

Definition at line 86 of file vidl_image_list_istream.h.

bool vidl_image_list_istream::advance (  )  [virtual]

Advance to the next frame (but do not open the next image).

Implements vidl_istream.

Definition at line 134 of file vidl_image_list_istream.cxx.

vidl_frame_sptr vidl_image_list_istream::read_frame (  )  [virtual]

Read the next frame from the stream.

Implements vidl_istream.

Definition at line 146 of file vidl_image_list_istream.cxx.

vidl_frame_sptr vidl_image_list_istream::current_frame (  )  [virtual]

Return the current frame in the stream.

Implements vidl_istream.

Definition at line 155 of file vidl_image_list_istream.cxx.

vcl_string vidl_image_list_istream::current_path (  )  const

Return the path to the current image in the stream.

Definition at line 170 of file vidl_image_list_istream.cxx.

bool vidl_image_list_istream::seek_frame ( unsigned int  frame_number  )  [virtual]

Seek to the given frame number (but do not load the image).

Returns:
true if successful

Implements vidl_istream.

Definition at line 183 of file vidl_image_list_istream.cxx.

void vidl_istream::ref (  )  [inline, inherited]

Increment reference count.

Definition at line 87 of file vidl_istream.h.

void vidl_istream::unref (  )  [inline, inherited]

Decrement reference count.

Definition at line 90 of file vidl_istream.h.

int vidl_istream::ref_count (  )  const [inline, inherited]

Number of objects referring to this data.

Definition at line 93 of file vidl_istream.h.


Member Data Documentation

vcl_vector<vcl_string> vidl_image_list_istream::image_paths_ [private]

The vector of images.

Definition at line 106 of file vidl_image_list_istream.h.

unsigned int vidl_image_list_istream::index_ [private]

The current index.

Definition at line 109 of file vidl_image_list_istream.h.

unsigned int vidl_image_list_istream::ni_ [private]

The image width.

Definition at line 112 of file vidl_image_list_istream.h.

unsigned int vidl_image_list_istream::nj_ [private]

The image height.

Definition at line 114 of file vidl_image_list_istream.h.

vidl_pixel_format vidl_image_list_istream::format_ [private]

The pixel format.

Definition at line 116 of file vidl_image_list_istream.h.

vidl_frame_sptr vidl_image_list_istream::current_frame_ [private]

The current frame (cached).

Definition at line 119 of file vidl_image_list_istream.h.


The documentation for this class was generated from the following files:
Generated on Mon Mar 8 05:10:36 2010 for core/vidl by  doxygen 1.5.1