FrameOstream Class Reference

Abstract interface class representing a destination for Image frames. More...

#include <Transport/FrameOstream.H>

Inheritance diagram for FrameOstream:
Inheritance graph
[legend]
Collaboration diagram for FrameOstream:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 FrameOstream (OptionManager &mgr, const std::string &descrName, const std::string &tagName)
 Constructor.
virtual ~FrameOstream ()
 Virtual destructor.
virtual void setConfigInfo (const std::string &cfg)
 Configure the FrameOstream object in a type-dependent manner.
virtual bool setFrameNumber (int n)
 Advise the FrameOstream object of the current frame number.
virtual void writeFrame (const GenericFrame &frame, const std::string &shortname, const FrameInfo &auxinfo=defaultInfo)=0
 Write a frame to the output destination.
void writeRGB (const Image< PixRGB< byte > > &image, const std::string &shortname, const FrameInfo &auxinfo=defaultInfo)
 Write a frame to the output destination.
void writeGray (const Image< byte > &image, const std::string &shortname, const FrameInfo &auxinfo=defaultInfo)
 Write a frame to the output destination.
void writeFloat (const Image< float > &image, const int flags, const std::string &shortname, const FrameInfo &auxinfo=defaultInfo)
 Write a frame to the output destination.
void writeRgbLayout (const Layout< PixRGB< byte > > &layout, const std::string &shortname, const FrameInfo &auxinfo=defaultInfo)
 Write an image layout to the output destination.
void writeGrayLayout (const Layout< byte > &layout, const std::string &shortname, const FrameInfo &auxinfo=defaultInfo)
 Write an image layout to the output destination.
virtual bool isVoid () const
 Check if we have no output destinations (e.g., user gave --out=none).
virtual void closeStream (const std::string &shortname)=0
 Close off the underlying destination corresponding to shortname.

Static Public Attributes

static const FrameInfo defaultInfo
 Default FrameInfo object.

Detailed Description

Abstract interface class representing a destination for Image frames.

Concrete classes might implement this interface so that the real final destination is either a series of bitmap files (e.g. RasterOutputSeries), or an mpeg-encoded movie stream (OutputMPEGStream), or an on-screen window (ImageDisplayStream), or a composite of destinations (OutputFrameSeries).

See also FrameIstream for the analogous input interface.

Definition at line 60 of file FrameOstream.H.


Constructor & Destructor Documentation

FrameOstream::FrameOstream ( OptionManager mgr,
const std::string descrName,
const std::string tagName 
)

Constructor.

Definition at line 50 of file FrameOstream.C.

FrameOstream::~FrameOstream (  )  [virtual]

Virtual destructor.

Definition at line 57 of file FrameOstream.C.


Member Function Documentation

virtual void FrameOstream::closeStream ( const std::string shortname  )  [pure virtual]

Close off the underlying destination corresponding to shortname.

The semantics of this operation are subclass-dependent, but the intention is for subclasses to follow these guidelines when implementing closeStream():

  • if the FrameOstream subclass deals with files, then the file corresponding to shortname should be closed, or if the FrameOstream deals with onscreen windows, then the corresponding window should be closed
  • calling closeStream() for a particular shortname should not prevent a stream later being reopened for that shortname if writeFrame() is later called again with that shortname.
  • calling closeStream() with a shortname for which there is no associated destination, or for a shortname which has already been closed, should not be an error but should just be silently ignored

Implemented in DiskDataStream, ImageDisplayStream, QtDisplayStream, QtDisplayStream, SDLdisplayStream, OutputFrameSeries, NullOutputStream, FrameOfilt, HashOutputSeries, InfoOutputSeries, LowLevelEncoderMap, RasterOutputSeries, and StatsOutputSeries.

bool FrameOstream::isVoid (  )  const [virtual]

Check if we have no output destinations (e.g., user gave --out=none).

Clients can test isVoid() before they generate potentially expensive output images. This is just a performance optimization -- even if isVoid() is true, it's still safe to call writeRGB(), writeGray(), etc., but those calls will do nothing, and so any time spent computing the image will have been wasted.

The default implementation returns false; subclasses need override only if they want to (sometimes) return true.

Reimplemented in ImageDisplayStream, QtDisplayStream, QtDisplayStream, SDLdisplayStream, OutputFrameSeries, and FrameOfilt.

Definition at line 109 of file FrameOstream.C.

void FrameOstream::setConfigInfo ( const std::string cfg  )  [virtual]

Configure the FrameOstream object in a type-dependent manner.

The string is expected to be some piece of user input (e.g. from the command-line) specifying key information for the FrameOstream (e.g., the filename stem for a RasterOutputSeries).

The default implementation does nothing; derived classes can override if they need to receive such user input.

Reimplemented in DiskDataStream, OutputHttpStream, MgzJOutputStream, MgzOutputStream, OutputMPEGStream, MrawvOutputStream, UcbMpegOutputStream, FrameOfilt, HashOutputSeries, InfoOutputSeries, RasterOutputSeries, and StatsOutputSeries.

Definition at line 59 of file FrameOstream.C.

bool FrameOstream::setFrameNumber ( int  n  )  [virtual]

Advise the FrameOstream object of the current frame number.

NOTE: the default implementation does nothing -- it just ignores the frame number. This is allowed for subclasses, too, since for certain output formats (e.g., onscreen windows) it doesn't make any sense to specify a frame number. On the other hand, certain subclasses require a frame number to function properly (e.g., for writing a series of consecutively-numbered raster files). So, the bottom line is: clients of FrameOstream must be sure to call setFrameNumber(), but should make no assumptions about what it will actually do.

Returns:
Whether the frame number was successfully set as requested.

Reimplemented in QtDisplayStream, QtDisplayStream, FrameOfilt, HashOutputSeries, RasterOutputSeries, and StatsOutputSeries.

Definition at line 65 of file FrameOstream.C.

void FrameOstream::writeFloat ( const Image< float > &  image,
const int  flags,
const std::string shortname,
const FrameInfo auxinfo = defaultInfo 
)

Write a frame to the output destination.

Just calls writeFrame() with GenericFrame(image, flags).

Derived classes must not override this function; instead they must implement writeFrame().

Definition at line 87 of file FrameOstream.C.

References writeFrame().

virtual void FrameOstream::writeFrame ( const GenericFrame frame,
const std::string shortname,
const FrameInfo auxinfo = defaultInfo 
) [pure virtual]

Write a frame to the output destination.

Destination could be a raster file, frame in an mpeg-encoded movie, an on-screen window, etc., depending on the concrete subclass.

Parameters:
image the image to be written, displayed, etc.
shortname a brief string (with no spaces) describing the image; it is expected that this shortname should be usable as part of a filename if the particular FrameOstream subclass involves writing files to disk
auxinfo extra optional information describing the image; FrameOstream subclasses make use of this information in a subclass-dependent manner, e.g. they could display this information in an onscreen window, or embed it into a comments in an image or movie file, etc.

Implemented in DiskDataStream, ImageDisplayStream, QtDisplayStream, QtDisplayStream, SDLdisplayStream, OutputFrameSeries, NullOutputStream, FrameOfilt, HashOutputSeries, InfoOutputSeries, LowLevelEncoderMap, RasterOutputSeries, and StatsOutputSeries.

Referenced by ColorizeOfilt::filterFrame(), LuminanceOfilt::filterFrame(), SplitRgbOfilt::filterFrame(), CoerceVideoFormatOfilt::filterFrame(), writeFloat(), writeGray(), writeGrayLayout(), writeRGB(), and writeRgbLayout().

void FrameOstream::writeGray ( const Image< byte > &  image,
const std::string shortname,
const FrameInfo auxinfo = defaultInfo 
)

Write a frame to the output destination.

Just calls writeFrame() with GenericFrame(image).

Derived classes must not override this function; instead they must implement writeFrame().

Definition at line 80 of file FrameOstream.C.

References writeFrame().

void FrameOstream::writeGrayLayout ( const Layout< byte > &  layout,
const std::string shortname,
const FrameInfo auxinfo = defaultInfo 
)

Write an image layout to the output destination.

This constructs a GenericFrame that retains the layout information and passes that to writeFrame(). Some subclasses may be able to handle a Layout in an optimized way, while others may simple call render() on it and handle it as an ordinary image.

Definition at line 102 of file FrameOstream.C.

References writeFrame().

void FrameOstream::writeRGB ( const Image< PixRGB< byte > > &  image,
const std::string shortname,
const FrameInfo auxinfo = defaultInfo 
)

Write a frame to the output destination.

Just calls writeFrame() with GenericFrame(image).

Derived classes must not override this function; instead they must implement writeFrame().

Definition at line 73 of file FrameOstream.C.

References writeFrame().

Referenced by ColorizeOfilt::filterFrame().

void FrameOstream::writeRgbLayout ( const Layout< PixRGB< byte > > &  layout,
const std::string shortname,
const FrameInfo auxinfo = defaultInfo 
)

Write an image layout to the output destination.

This constructs a GenericFrame that retains the layout information and passes that to writeFrame(). Some subclasses may be able to handle a Layout in an optimized way, while others may simple call render() on it and handle it as an ordinary image.

Definition at line 95 of file FrameOstream.C.

References writeFrame().


Member Data Documentation

Default FrameInfo object.

The purpose of this object is so that the default value for the write functions can be 'defaultInfo' rather than 'FrameInfo()', since the former does not require include "Transport/FrameInfo.H", while the latter does require it.

Definition at line 208 of file FrameOstream.H.


The documentation for this class was generated from the following files:
Generated on Sun May 8 08:43:20 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3