PnmWriter Class Reference

Write pbm/pgm/ppm image files. More...

#include <Raster/PnmWriter.H>

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

List of all members.

Public Member Functions

 PnmWriter (const bool forcepbm=false, const byte pbmthresh=0)
virtual std::string writeFrame (const GenericFrame &image, const std::string &fname)
 Write the frame to disk.

Static Public Member Functions

static void writeRGB (const Image< PixRGB< byte > > &image, std::ostream &strm)
 Write the RGB image in PPM (P6) format to the given ostream.
static void writeGray (const Image< byte > &image, std::ostream &strm)
 Write the grayscale image in PGM (P5) format to the given ostream.
static void writeRawBW (const Image< byte > &image, const byte thresh, std::ostream &strm)
 Write the grayscale image in raw PBM (P4) format to the given ostream.
static void writeAsciiBW (const Image< byte > &image, const byte thresh, std::ostream &strm)
 Write the grayscale image in ascii PBM (P1) format to the given ostream.
static void writeRGB (const Image< PixRGB< byte > > &image, const std::string &fname)
 Write the RGB image in PPM (P6) format to the named file.
static void writeGray (const Image< byte > &image, const std::string &fname)
 Write the grayscale image in PGM (P5) format to the named file.
static void writeRawBW (const Image< byte > &image, const byte thresh, const std::string &fname)
 Write the grayscale image in raw PBM (P4) format to the named file.
static void writeAsciiBW (const Image< byte > &image, const byte thresh, const std::string &fname)
 Write the grayscale image in ascii PBM (P1) format to the named file.

Detailed Description

Write pbm/pgm/ppm image files.

Definition at line 50 of file PnmWriter.H.


Member Function Documentation

void PnmWriter::writeAsciiBW ( const Image< byte > &  image,
const byte  thresh,
const std::string fname 
) [static]

Write the grayscale image in ascii PBM (P1) format to the named file.

Pixels with values greater than or equal to thresh will be written as white, and other pixels will be written as black.

Definition at line 250 of file PnmWriter.C.

References writeAsciiBW().

void PnmWriter::writeAsciiBW ( const Image< byte > &  image,
const byte  thresh,
std::ostream &  strm 
) [static]

Write the grayscale image in ascii PBM (P1) format to the given ostream.

Pixels with values greater than or equal to thresh will be written as white, and other pixels will be written as black.

Definition at line 186 of file PnmWriter.C.

References Image< T >::begin(), Image< T >::getHeight(), and Image< T >::getWidth().

Referenced by writeAsciiBW(), and BitObject::writeToStream().

std::string PnmWriter::writeFrame ( const GenericFrame image,
const std::string fname 
) [virtual]

Write the frame to disk.

Returns:
the actual name of the file that was created (for some subclasses, this may be slightly different than the input fname, if e.g. the subclass decides to add or change a file extension)

Implements RasterWriter.

Definition at line 62 of file PnmWriter.C.

References GenericFrame::asGrayF32(), GenericFrame::asGrayU8(), GenericFrame::asRgbU8(), FLOAT_NORM_PRESERVE, GenericFrame::floatFlags(), GenericFrame::GRAY_F32, GenericFrame::GRAY_U16, GenericFrame::GRAY_U8, GenericFrame::nativeType(), GenericFrame::NONE, GenericFrame::RGB_F32, GenericFrame::RGB_U16, GenericFrame::RGB_U8, GenericFrame::RGBD, writeGray(), writeRawBW(), and writeRGB().

void PnmWriter::writeGray ( const Image< byte > &  image,
const std::string fname 
) [static]

Write the grayscale image in PGM (P5) format to the named file.

Definition at line 222 of file PnmWriter.C.

References writeGray().

void PnmWriter::writeGray ( const Image< byte > &  image,
std::ostream &  strm 
) [static]

Write the grayscale image in PGM (P5) format to the given ostream.

There is no checking done on the stream state; so, if you want to know whether the write succeded you need to explicitly check strm.fail().

Definition at line 147 of file PnmWriter.C.

References Image< T >::getArrayPtr(), Image< T >::getHeight(), Image< T >::getSize(), and Image< T >::getWidth().

Referenced by writeFrame(), and writeGray().

void PnmWriter::writeRawBW ( const Image< byte > &  image,
const byte  thresh,
const std::string fname 
) [static]

Write the grayscale image in raw PBM (P4) format to the named file.

Pixels with values greater than or equal to thresh will be written as white, and other pixels will be written as black.

Definition at line 236 of file PnmWriter.C.

References writeRawBW().

void PnmWriter::writeRawBW ( const Image< byte > &  image,
const byte  thresh,
std::ostream &  strm 
) [static]

Write the grayscale image in raw PBM (P4) format to the given ostream.

Pixels with values greater than or equal to thresh will be written as white, and other pixels will be written as black.

Definition at line 157 of file PnmWriter.C.

References Image< T >::begin(), Image< T >::end(), Image< T >::getHeight(), and Image< T >::getWidth().

Referenced by writeFrame(), and writeRawBW().

void PnmWriter::writeRGB ( const Image< PixRGB< byte > > &  image,
const std::string fname 
) [static]

Write the RGB image in PPM (P6) format to the named file.

Definition at line 207 of file PnmWriter.C.

References image, and writeRGB().

void PnmWriter::writeRGB ( const Image< PixRGB< byte > > &  image,
std::ostream &  strm 
) [static]

Write the RGB image in PPM (P6) format to the given ostream.

There is no checking done on the stream state; so, if you want to know whether the write succeded you need to explicitly check strm.fail().

Definition at line 137 of file PnmWriter.C.

References Image< T >::getArrayPtr(), Image< T >::getHeight(), Image< T >::getSize(), Image< T >::getWidth(), and image.

Referenced by LoggerModule::evolve(), writeFrame(), and writeRGB().


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