Raster Namespace Reference

For reading, writing and displaying images. More...

Functions

bool fileExists (std::string fname, const RasterFileFormat ftype=RASFMT_AUTO, const bool chkFormat=false)
 Return true if file exists on disk.
std::string getImageComments (std::string fname, const RasterFileFormat ftype=RASFMT_AUTO)
 Get image comments without fully reading the image (PPM only).
Dims getImageDims (std::string fname, const RasterFileFormat ftype=RASFMT_AUTO)
 Get image dimensions without fully reading the image.
GenericFrameSpec getFrameSpec (std::string fname, const RasterFileFormat ftype=RASFMT_AUTO)
 Get image specifications without fully reading the image.
GenericFrame ReadFrame (std::string fname, RasterFileFormat ftype=RASFMT_AUTO)
 Read a GenericFrame from a raster file.
Image< PixRGB< byte > > ReadRGB (std::string fname, RasterFileFormat ftype=RASFMT_AUTO)
 Read an RGB byte image from a raster file.
Image< byteReadGray (std::string fname, RasterFileFormat ftype=RASFMT_AUTO)
 Read a greyscale byte image from a greyscale raster file.
Image< byteReadGrayNTSC (std::string fname, const RasterFileFormat ftype=RASFMT_AUTO)
 Read a greyscale byte image, converting to NTSC coordinates if necessary.
Image< float > ReadFloat (std::string fname, RasterFileFormat ftype=RASFMT_AUTO)
 Read a greyscale float image from a greyscale raster file.
VideoFrame ReadVideo (std::string fname, RasterFileFormat ftype=RASFMT_AUTO)
 Read a VideoFrame from a raster file.
std::string WriteFrame (const GenericFrame &image, std::string fname, RasterFileFormat ftype=RASFMT_AUTO)
 Write a GenericFrame to a raster file.
std::string WriteRGB (const Image< PixRGB< byte > > &image, std::string fname, const RasterFileFormat ftype=RASFMT_AUTO)
 Write an RGB byte image to a raster file.
std::string WriteGray (const Image< byte > &image, std::string fname, const RasterFileFormat ftype=RASFMT_AUTO)
 Write a grayscale byte image to a raster file.
std::string WriteFloat (const Image< float > &image, const int flags, std::string fname, const RasterFileFormat ftype=RASFMT_AUTO)
 Write a float image to a raster file.
void NoXV ()
 Turn off the use of xv.
void Display (const char *file)
 calls xv to display an image that is on disk
void waitForKey ()
 wait for the [return] key
void VisuRGB (const Image< PixRGB< byte > > &image, std::string fname, const RasterFileFormat ftype=RASFMT_AUTO)
 Save image of type Image< PixRGB<byte> > to disk then display it using xv.
void VisuGray (const Image< byte > &image, std::string fname, const RasterFileFormat ftype=RASFMT_AUTO)
 Save image of type Image<byte> to disk then display it using xv.
void VisuFloat (const Image< float > &image, const int flags, std::string fname, const RasterFileFormat ftype=RASFMT_AUTO)
 Save image of type Image<float> to disk then display it using xv.

Detailed Description

For reading, writing and displaying images.

Raster works with PGM files (for grayscale images) and PPM files (for RGB images). Selection between PGM and PPM given the RASFMT_PNM RasterFileFormat is automatic based on whether the image is greyscale or color. In addition, it offers PNG read capability (grayscale, RGB, or color-palette, at any bit-depth), and write capability (8-bit grayscale and RGB). Similarly, it offers write capability for RASFMT_RAW_IMAGE data (straight pixel data with no header information), but no such read capability. Both the raw and ASCII variants of PGM/PPM files are supported. Display of images uses the program "xv" to output images to the screen. The filename argument is passed to the various methods of this class in the same way as in printf().


Function Documentation

void Raster::Display ( const char *  file  ) 
bool Raster::fileExists ( std::string  fname,
const RasterFileFormat  ftype = RASFMT_AUTO,
const bool  chkFormat = false 
)

Return true if file exists on disk.

If ftype is RASFMT_AUTO, then the raster file type is inferred from the filename.

Definition at line 378 of file Raster.C.

Referenced by VisualObject::deleteImageFile(), main(), operator<<(), RasterlistInputSeries::readFrame(), RasterInputSeries::readFrame(), and SimulationViewerEyeMvtNeuro::start1().

GenericFrameSpec Raster::getFrameSpec ( std::string  fname,
const RasterFileFormat  ftype = RASFMT_AUTO 
)

Get image specifications without fully reading the image.

If ftype is RASFMT_AUTO, then the raster file type is inferred from the filename.

Definition at line 418 of file Raster.C.

Referenced by getImageDims(), RasterInputSeries::peekFrameSpec(), and RasterlistInputSeries::setListFile().

std::string Raster::getImageComments ( std::string  fname,
const RasterFileFormat  ftype = RASFMT_AUTO 
)

Get image comments without fully reading the image (PPM only).

If ftype is RASFMT_AUTO, then the raster file type is inferred from the filename.

Definition at line 398 of file Raster.C.

Dims Raster::getImageDims ( std::string  fname,
const RasterFileFormat  ftype = RASFMT_AUTO 
)

Get image dimensions without fully reading the image.

If ftype is RASFMT_AUTO, then the raster file type is inferred from the filename.

Definition at line 409 of file Raster.C.

References getFrameSpec().

Referenced by InputMbariFrameSeries::peekDims().

void Raster::NoXV (  ) 

Turn off the use of xv.

Turn off xv, so that calls to Display() do nothing, and calls to Visu() just save the image to disk without displaying it onscreen.

Definition at line 532 of file Raster.C.

Image< float > Raster::ReadFloat ( std::string  fname,
RasterFileFormat  ftype = RASFMT_AUTO 
)

Read a greyscale float image from a greyscale raster file.

Just calls ReadFrame() internally.

If ftype is RASFMT_AUTO, then the raster file type is inferred from the filename.

Definition at line 466 of file Raster.C.

References ReadFrame().

Referenced by TrainingSet::load(), TrainingSet::loadRebalanced(), mexFunction(), ScaleRemoveSurprise< FLOAT >::SRSopenBayesFeatureBias(), ScaleRemoveSurprise< FLOAT >::SRSprocessFrame(), ScaleRemoveSurprise< FLOAT >::SRSsetAntiWeights(), ScaleRemoveSurprise< FLOAT >::SRSsetAntiWeightsInteract(), and SimulationViewerEyeMvtNeuro::start1().

GenericFrame Raster::ReadFrame ( std::string  fname,
RasterFileFormat  ftype = RASFMT_AUTO 
)

Read a GenericFrame from a raster file.

This can subsequently be converted to rgb, grayscale, floating-point, or video-yuv.

If ftype is RASFMT_AUTO, then the raster file type is inferred from the filename.

Definition at line 429 of file Raster.C.

Referenced by main(), mexFunction(), ReadFloat(), RasterlistInputSeries::readFrame(), RasterInputSeries::readFrame(), ReadGray(), ReadGrayNTSC(), ReadRGB(), and ReadVideo().

Image< byte > Raster::ReadGray ( std::string  fname,
RasterFileFormat  ftype = RASFMT_AUTO 
)
Image< byte > Raster::ReadGrayNTSC ( std::string  fname,
const RasterFileFormat  ftype = RASFMT_AUTO 
)

Read a greyscale byte image, converting to NTSC coordinates if necessary.

Just calls ReadFrame() internally.

If ftype is RASFMT_AUTO, then the raster file type is inferred from the filename.

Definition at line 457 of file Raster.C.

References GenericFrame::asGrayNTSC(), and ReadFrame().

Image< PixRGB< byte > > Raster::ReadRGB ( std::string  fname,
RasterFileFormat  ftype = RASFMT_AUTO 
)
VideoFrame Raster::ReadVideo ( std::string  fname,
RasterFileFormat  ftype = RASFMT_AUTO 
)

Read a VideoFrame from a raster file.

Just calls ReadFrame() internally.

If ftype is RASFMT_AUTO, then the raster file type is inferred from the filename.

Definition at line 474 of file Raster.C.

References GenericFrame::asVideo(), and ReadFrame().

void Raster::VisuFloat ( const Image< float > &  image,
const int  flags,
std::string  fname,
const RasterFileFormat  ftype = RASFMT_AUTO 
)

Save image of type Image<float> to disk then display it using xv.

If ftype is RASFMT_AUTO, then the raster file type is inferred from the filename.

Definition at line 593 of file Raster.C.

References Display(), FLOAT_NORM_0_255, getMinMax(), and WriteFloat().

Referenced by featureClusterVision< FLOAT >::fCVrunStandAloneMSBatchTest(), and main().

void Raster::VisuGray ( const Image< byte > &  image,
std::string  fname,
const RasterFileFormat  ftype = RASFMT_AUTO 
)

Save image of type Image<byte> to disk then display it using xv.

If ftype is RASFMT_AUTO, then the raster file type is inferred from the filename.

Definition at line 579 of file Raster.C.

References Display(), getMinMax(), and WriteGray().

void Raster::VisuRGB ( const Image< PixRGB< byte > > &  image,
std::string  fname,
const RasterFileFormat  ftype = RASFMT_AUTO 
)

Save image of type Image< PixRGB<byte> > to disk then display it using xv.

If ftype is RASFMT_AUTO, then the raster file type is inferred from the filename.

Definition at line 565 of file Raster.C.

References Display(), getMinMaxC(), image, and WriteRGB().

Referenced by main(), Omni< T >::run(), and CINNIC::viewNeuronTemplate().

void Raster::waitForKey (  ) 
std::string Raster::WriteFloat ( const Image< float > &  image,
const int  flags,
std::string  fname,
const RasterFileFormat  ftype = RASFMT_AUTO 
)

Write a float image to a raster file.

Just calls WriteFrame() internally.

Returns the full name of the image file that was actually written; this may differ slightly from fname if a filename extension was added to match ftype.

If ftype is RASFMT_AUTO, then the raster file type is inferred from the filename.

Definition at line 517 of file Raster.C.

References WriteFrame().

Referenced by main(), mexFunction(), ScaleRemoveSurprise< FLOAT >::SRScomputeBayesFeatureBias(), SimulationViewerEyeMvtNeuro::stop1(), VisuFloat(), and OutputMbariFrameSeries::writeMbariFloat().

std::string Raster::WriteFrame ( const GenericFrame image,
std::string  fname,
RasterFileFormat  ftype = RASFMT_AUTO 
)

Write a GenericFrame to a raster file.

The GenericFrame could be constructed from rgb, grayscale, floating-point, or video-yuv.

Returns the full name of the image file that was actually written; this may differ slightly from fname if a filename extension was added to match ftype.

If ftype is RASFMT_AUTO, then the raster file type is inferred from the filename.

Definition at line 482 of file Raster.C.

References GenericFrame::initialized().

Referenced by WriteFloat(), RasterOutputSeries::writeFrame(), WriteGray(), and WriteRGB().

std::string Raster::WriteGray ( const Image< byte > &  image,
std::string  fname,
const RasterFileFormat  ftype = RASFMT_AUTO 
)

Write a grayscale byte image to a raster file.

Just calls WriteFrame() internally.

Returns the full name of the image file that was actually written; this may differ slightly from fname if a filename extension was added to match ftype.

If ftype is RASFMT_AUTO, then the raster file type is inferred from the filename.

Definition at line 508 of file Raster.C.

References WriteFrame().

Referenced by featureClusterVision< FLOAT >::fCVgetImageComplexStats(), main(), ScaleRemoveSurprise< FLOAT >::SRScomputeBayesFeatureBias(), ScaleRemoveSurprise< FLOAT >::SRScomputeBayesFeatureCurrent(), VisuGray(), and OutputMbariFrameSeries::writeMbariGray().

std::string Raster::WriteRGB ( const Image< PixRGB< byte > > &  image,
std::string  fname,
const RasterFileFormat  ftype = RASFMT_AUTO 
)

Write an RGB byte image to a raster file.

Just calls WriteFrame() internally.

Returns the full name of the image file that was actually written; this may differ slightly from fname if a filename extension was added to match ftype.

If ftype is RASFMT_AUTO, then the raster file type is inferred from the filename.

Definition at line 499 of file Raster.C.

References image, and WriteFrame().

Referenced by contourRun::dumpEnergySigmoid(), main(), BeoMap::makePanorama(), operator<<(), CINNICstatsRun::pointAndFlood(), processLocalizerResults(), SimulationViewerNerdCam::saveResults(), SurpriseControl< PIXTYPE, BETATYPE, FLOAT >::SCcomputeLocalBias(), SurpriseControl< PIXTYPE, BETATYPE, FLOAT >::SCcomputeNewBeta(), SurpriseControl< PIXTYPE, BETATYPE, FLOAT >::SCinputConspicMap(), ScaleRemoveSurprise< FLOAT >::SRScomputeBayesFeatureBias(), ScaleRemoveSurprise< FLOAT >::SRSopenBayesFeatureBias(), BeoLogger::updateMessage(), VisuRGB(), and OutputMbariFrameSeries::writeMbariRGB().

Generated on Sun May 8 08:44:41 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3