Write pbm/pgm/ppm image files. More...
#include <Raster/PnmWriter.H>
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. |
Write pbm/pgm/ppm image files.
Definition at line 50 of file PnmWriter.H.
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.
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().
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().
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().