Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Raster Namespace Reference


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


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.


Function Documentation

void Raster::Display const char *  file  ) 
 

calls xv to display an image that is on disk

Definition at line 539 of file Raster.C.

References GVX_TRACE, LERROR, and USING_XV.

Referenced by main(), VisuFloat(), VisuGray(), VisuRGB(), waitXKeyPress(), OutputMbariFrameSeries::writeMbariFloat(), OutputMbariFrameSeries::writeMbariGray(), and OutputMbariFrameSeries::writeMbariRGB().

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.

References addFileExtension(), GVX_TRACE, MODE_R, and PLERROR.

Referenced by VisualObject::deleteImageFile(), LeastSquaresLearner::getBiasMap(), FeatureExtractor::load(), main(), operator<<(), RasterlistInputSeries::readFrame(), RasterInputSeries::readFrame(), HmaxFL::readInC1Patches(), TrainingSet::save(), FeatureExtractor::save(), and submain().

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.

References addFileExtension(), GVX_TRACE, makeParser(), MODE_R, and pp.

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.

References addFileExtension(), GVX_TRACE, makeParser(), MODE_R, and pp.

Referenced by main().

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 GenericFrameSpec::dims, getFrameSpec(), and GVX_TRACE.

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.

References GVX_TRACE, and USING_XV.

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 GenericFrame::asFloat(), GVX_TRACE, and ReadFrame().

Referenced by LeastSquaresLearner::getBiasMap(), TrainingSet::load(), FeatureExtractor::load(), TrainingSet::loadRebalanced(), main(), mexFunction(), Raster_xx_img_float_write_float_read_float_xx_1(), readFloat(), ScaleRemoveSurprise< FLOAT >::SRSopenBayesFeatureBias(), ScaleRemoveSurprise< FLOAT >::SRSprocessFrame(), ScaleRemoveSurprise< FLOAT >::SRSsetAntiWeights(), and ScaleRemoveSurprise< FLOAT >::SRSsetAntiWeightsInteract().

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.

References addFileExtension(), GVX_TRACE, LDEBUG, makeParser(), MODE_R, and pp.

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
 

Read a greyscale byte 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 449 of file Raster.C.

References GenericFrame::asGray(), GVX_TRACE, and ReadFrame().

Referenced by featureClusterVision< FLOAT >::fCVgetImageBaseStats(), featureClusterVision< FLOAT >::fCVgetImageComplexStats(), featureClusterVision< FLOAT >::fCVprocessOutSaccadeData(), fillEyeData(), fillMouthData(), fillNoseData(), getPartImage(), getPartRect(), TaskRelevanceMapGistClassify::getTDMap(), FeatureExtractor::load(), main(), Raster_xx_img_gray_write_bw_read_gray_xx_1(), Raster_xx_img_gray_write_gray_read_gray_xx_1(), Raster_xx_img_gray_write_rgb_read_gray_xx_1(), Raster_xx_img_rgb_write_gray_read_gray_xx_1(), Raster_xx_img_rgb_write_rgb_read_gray_xx_1(), readGray(), HmaxFL::readInC1Patches(), CINNICstatsRun::runPointAndFlood(), CINNICstatsRun::runStandardStats(), ScaleRemoveSurprise< FLOAT >::SRScomputeBayesFeatureBias(), ScaleRemoveSurprise< FLOAT >::SRScomputeBayesFeatureCurrent(), TargetChecker::start1(), Retina::start1(), RetinaStd::start2(), and train().

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(), GVX_TRACE, and ReadFrame().

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

Read an RGB byte image 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 441 of file Raster.C.

References GenericFrame::asRgb(), GVX_TRACE, and ReadFrame().

Referenced by aux::build_scaled_pixmap(), SimulationViewerStats::computeAGStats(), VisualObject::createVisualObject(), BeoSubMappingQtMainForm::displayLog(), featureClusterVision< FLOAT >::fCVgetImageBaseStats(), featureClusterVision< FLOAT >::fCVgetImageComplexStats(), featureClusterVision< FLOAT >::fCVsetUpfCV(), SceneUnderstandingForm::fileOpen(), POMDP::findMultipleObjects(), POMDP::findObject(), TestImages::generateScene(), TestImages::getCscLabScene(), TestImages::getLabelMeScene(), TestImages::getObject(), TestImages::getObjectData(), TestImages::getScene(), BeoSubSim::grabImage(), POMDP::init(), SeaBee3MainDisplayForm::loadColorPickerImg(), ImageQtMainForm::loadImage(), main(), BeoMap::makePanorama(), Raster_xx_img_gray_write_gray_read_rgb_xx_1(), Raster_xx_img_gray_write_rgb_read_rgb_xx_1(), Raster_xx_img_rgb_write_gray_read_rgb_xx_1(), Raster_xx_img_rgb_write_rgb_read_rgb_xx_1(), readRGB(), InputMbariFrameSeries::readRGB(), CINNICstatsRun::runPointAndFlood(), CINNICstatsRun::runStandardStats(), SimulationViewerI::SimulationViewerI(), RetinaSpaceVariant::start2(), RetinaStd::start2(), and submain().

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(), GVX_TRACE, 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(), GVX_TRACE, LINFO, 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(), GVX_TRACE, LINFO, 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(), GVX_TRACE, image, LINFO, and WriteRGB().

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

void Raster::waitForKey  ) 
 

wait for the [return] key

Definition at line 553 of file Raster.C.

References GVX_TRACE.

Referenced by GistEstimatorStd::diffGist(), GistEstimatorGen::diffGist(), LandmarkDB::display(), displayPartImage(), Environment::finishBuild(), getPartImage(), Beobot2_GistSalLocalizerMasterI::initParticles(), GSlocalizer::initParticles(), main(), ParticleFilterI::ParticleFilterI(), processSalCue(), submain(), SeaBee::test(), train(), and ColorSegmenterI::updateFrame().

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 GVX_TRACE, and WriteFrame().

Referenced by LeastSquaresLearner::getBiasMap(), main(), mexFunction(), Raster_xx_img_float_write_float_read_float_xx_1(), TrainingSet::save(), FeatureExtractor::save(), ScaleRemoveSurprise< FLOAT >::SRScomputeBayesFeatureBias(), VisuFloat(), writeFloat(), OutputMbariFrameSeries::writeMbariFloat(), and HmaxFL::writeOutC1Patches().

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 addFileExtension(), GVX_TRACE, GenericFrame::initialized(), LDEBUG, LFATAL, makeWriter(), and MODE_W.

Referenced by main(), QtImageFrame::saveImage(), 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 GVX_TRACE, and WriteFrame().

Referenced by density(), dumpFrame(), featureClusterVision< FLOAT >::fCVgetImageComplexStats(), featureClusterVision< FLOAT >::fCVprintOutCovSlices(), main(), Raster_xx_img_gray_write_bw_read_gray_xx_1(), Raster_xx_img_gray_write_gray_read_gray_xx_1(), Raster_xx_img_gray_write_gray_read_rgb_xx_1(), Raster_xx_img_rgb_write_gray_read_gray_xx_1(), Raster_xx_img_rgb_write_gray_read_rgb_xx_1(), runCanny(), FeatureExtractor::save(), ScaleRemoveSurprise< FLOAT >::SRScomputeBayesFeatureBias(), ScaleRemoveSurprise< FLOAT >::SRScomputeBayesFeatureCurrent(), test_lowpass5(), test_lowpass9(), VisuGray(), writeGray(), 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 GVX_TRACE, image, and WriteFrame().

Referenced by contourRun::dumpEnergySigmoid(), BiasImageForm::getScene(), main(), BeoMap::makePanorama(), operator<<(), CINNICstatsRun::pointAndFlood(), processLocalizerResults(), Raster_xx_img_gray_write_rgb_read_gray_xx_1(), Raster_xx_img_gray_write_rgb_read_rgb_xx_1(), Raster_xx_img_rgb_write_rgb_read_gray_xx_1(), Raster_xx_img_rgb_write_rgb_read_rgb_xx_1(), realvox::ripSlicesToFile(), saveframes(), GrabQtMainForm::saveImage(), BeoSubQtMainForm::saveImageDown(), BeoSubQtMainForm::saveImageFront(), BeoSubQtMainForm::saveImageUp(), ImageCanvas::saveImg(), Beobot2_GistSalLocalizerMasterI::saveLocalizerResults(), SimulationViewerNerdCam::saveResults(), SurpriseControl< PIXTYPE, BETATYPE, FLOAT >::SCcomputeLocalBias(), SurpriseControl< PIXTYPE, BETATYPE, FLOAT >::SCcomputeNewBeta(), SurpriseControl< PIXTYPE, BETATYPE, FLOAT >::SCinputConspicMap(), SurpriseMapFFT< T >::setFFTModels(), ScaleRemoveSurprise< FLOAT >::SRScomputeBayesFeatureBias(), ScaleRemoveSurprise< FLOAT >::SRSopenBayesFeatureBias(), storeImage(), BeoLogger::updateMessage(), VisuRGB(), OutputMbariFrameSeries::writeMbariRGB(), and writeRGB().


Generated on Fri Nov 6 13:37:52 2009 for iLab Neuromorphic Vision Toolkit by  doxygen 1.4.4