Public Member Functions | Private Attributes
vidl_image_list_istream Class Reference

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

#include <vidl_image_list_istream.h>

Inheritance diagram for vidl_image_list_istream:
Inheritance graph
[legend]

List of all members.

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).

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.


Constructor & Destructor Documentation

vidl_image_list_istream::vidl_image_list_istream ( )

Constructor - default.

Constructor.

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.

Constructor.

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.

Constructor.

Definition at line 50 of file vidl_image_list_istream.cxx.

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::advance ( void  ) [virtual]

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

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

Implements vidl_istream.

Definition at line 144 of file vidl_image_list_istream.cxx.

void vidl_image_list_istream::close ( void  ) [virtual]

Close the stream.

Implements vidl_istream.

Definition at line 130 of file vidl_image_list_istream.cxx.

vidl_frame_sptr vidl_image_list_istream::current_frame ( void  ) [virtual]

Return the current frame in the stream.

Implements vidl_istream.

Definition at line 165 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 180 of file vidl_image_list_istream.cxx.

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.

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 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 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 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 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_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 bool vidl_image_list_istream::is_valid ( void  ) 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 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.

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 63 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 100 of file vidl_image_list_istream.cxx.

vidl_frame_sptr vidl_image_list_istream::read_frame ( void  ) [virtual]

Read the next frame from the stream.

Implements vidl_istream.

Definition at line 156 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.

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

Number of objects referring to this data.

Definition at line 93 of file vidl_istream.h.

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

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

Returns:
true if successful

Implements vidl_istream.

Definition at line 193 of file vidl_image_list_istream.cxx.

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

Decrement reference count.

Definition at line 90 of file vidl_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.


Member Data Documentation

The current frame (cached).

Definition at line 119 of file vidl_image_list_istream.h.

The pixel format.

Definition at line 116 of file vidl_image_list_istream.h.

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.


The documentation for this class was generated from the following files: