CVR-Lib last update 20 Sep 2009

cvr::ioBMP Class Reference
[Image I/O Classes]

Class to load and save images and channels in the BMP format. More...

#include <cvrIOBMP.h>

Inheritance diagram for cvr::ioBMP:

Inheritance graph
[legend]
Collaboration diagram for cvr::ioBMP:

Collaboration graph
[legend]

List of all members.

Classes

class  header
 Class header implements BITMAPFILEHEADER. More...
class  infoHeader
 Class infoHeader implements BITMAPINFOHEADER. More...
class  palette
 Color Palette found in a BMP file. More...
class  parameters
 Parameter class of the ioBMP class. More...

Public Member Functions

 ioBMP ()
 ioBMP (const parameters &par)
virtual ~ioBMP ()
const parametersgetParameters () const
virtual const std::string & name () const
virtual ioBMPclone () const
virtual ioBMPnewInstance () const
virtual bool load (const std::string &filename, image &theImage)
virtual bool load (const std::string &filename, matrix< ubyte > &theChannel, cvr::palette &colors)
virtual bool load (const std::string &filename, matrix< ubyte > &theChannel)
virtual bool load (const std::string &filename, matrix< float > &theChannel)
virtual bool load (const std::string &filename, matrix< int32 > &theChannel, cvr::palette &colors)
virtual bool load (const std::string &filename, matrix< int32 > &theChannel)
virtual bool load (std::ifstream &file, image &theImage)
virtual int load (std::ifstream &file, image &theImage, matrix< ubyte > &theChannel, cvr::palette &colors)
int load (const std::string &filename, image &theImage, matrix< ubyte > &theChannel, cvr::palette &colors)
bool checkHeader (const std::string &filename, headerInformation &info)
virtual bool save (const std::string &filename, const image &theImage)
virtual bool save (const std::string &filename, const matrix< ubyte > &theChannel, const cvr::palette &colors)
virtual bool save (const std::string &filename, const matrix< ubyte > &theChannel)
virtual bool save (const std::string &filename, const matrix< float > &theChannel)
virtual bool save (const std::string &filename, const matrix< int32 > &chnl, const cvr::palette &pal)
virtual bool save (const std::string &filename, const matrix< int32 > &chnl)


Detailed Description

Class to load and save images and channels in the BMP format.

You can use it the same way as the other image io classes.

This class is NOT thread safe, in the sense that the same instance cannot be used in different threads. You can however load BMP files in paralell if each thread uses its own instance of ioBMP (or if you protect your instace with mutexes).

See also:
ioPNG, ioJPEG

Constructor & Destructor Documentation

cvr::ioBMP::ioBMP (  ) 

Default constructor.

cvr::ioBMP::ioBMP ( const parameters par  ) 

Constructor with parameters.

virtual cvr::ioBMP::~ioBMP (  )  [virtual]

destructor


Member Function Documentation

bool cvr::ioBMP::checkHeader ( const std::string &  filename,
headerInformation info 
) [virtual]

check the data of the bitmap header

Parameters:
filename name of the bitmap file to be tested
info contains the header data
Returns:
true if file and header are ok

Implements cvr::ioImageInterface.

virtual ioBMP* cvr::ioBMP::clone (  )  const [virtual]

Returns a pointer to a clone of this functor.

Implements cvr::ioImageInterface.

const parameters& cvr::ioBMP::getParameters (  )  const

returns current parameters.

Reimplemented from cvr::ioImageInterface.

int cvr::ioBMP::load ( const std::string &  filename,
image theImage,
matrix< ubyte > &  theChannel,
cvr::palette colors 
)

This method loads an image or a matrix<ubyte>, depending on the contents of the file header.

If the number of bits per pixel is 24, the image will be loaded, if the number of bits is less or equal 8, the channel and palette will be initialized.

The wrong type will be resized to (0,0)

Parameters:
filename name of the file to be readed
theImage if the file contains a 24 bit color image, this parameter will be resized and initialized with the contents of the file
theChannel if the file contains a 8 bit or less indexed image, this parameter and the palette will be initialized with the contents of the file.
colors the color palette for the indexed image.
Returns:
the number of bits per pixel of the loaded image or 0 if an error occured. The valid values are 1, 4, 8, or 24

virtual int cvr::ioBMP::load ( std::ifstream &  file,
image theImage,
matrix< ubyte > &  theChannel,
cvr::palette colors 
) [virtual]

This method loads an image or a matrix<ubyte>, depending on the contents of the file header.

If the number of bits per pixel is 24, the image will be loaded, if the number of bits is less or equal 8, the channel and palette will be initialized.

The wrong type will be resized to (0,0)

Parameters:
file and already opened stream for reading binary data
theImage if the file contains a 24 bit color image, this parameter will be resized and initialized with the contents of the file
theChannel if the file contains a 8 bit or less indexed image, this parameter and the palette will be initialized with the contents of the file.
colors the color palette for the indexed image.
Returns:
the number of bits per pixel of the loaded image or 0 if an error occured. The valid values are 1, 4, 8, or 24

virtual bool cvr::ioBMP::load ( std::ifstream &  file,
image theImage 
) [virtual]

Load a BMP from an opened stream.

Parameters:
file an already opened stream for reading binary data
theImage variable where the image will to be stored

virtual bool cvr::ioBMP::load ( const std::string &  filename,
matrix< int32 > &  theChannel 
) [virtual]

Load gray valued channel.

Use this method if you know that the file contains a gray valued image.

Parameters:
filename name of the file to be readed
theChannel variable where the image will be stored

Reimplemented from cvr::ioImageInterface.

virtual bool cvr::ioBMP::load ( const std::string &  filename,
matrix< int32 > &  theChannel,
cvr::palette colors 
) [virtual]

Load BMP containing a labeled mask with its corresponding palette entries.

Use this method if you know that the file contains a gray valued image or an indexed color image. If you try to load a 24-bit image with this method, then "false" will be returned.

Parameters:
filename name of the file to be readed
theChannel variable where the image will be stored
colors the palette used will be stored here

Reimplemented from cvr::ioImageInterface.

virtual bool cvr::ioBMP::load ( const std::string &  filename,
matrix< float > &  theChannel 
) [virtual]

Load gray valued channel.

Use this method if you know that the file contains a gray valued image.

Parameters:
filename name of the file to be readed
theChannel variable where the image will be stored

Reimplemented from cvr::ioImageInterface.

virtual bool cvr::ioBMP::load ( const std::string &  filename,
matrix< ubyte > &  theChannel 
) [virtual]

Load gray valued channel.

Use this method if you know that the file contains a gray valued image.

Parameters:
filename name of the file to be readed
theChannel variable where the image will be stored

Reimplemented from cvr::ioImageInterface.

virtual bool cvr::ioBMP::load ( const std::string &  filename,
matrix< ubyte > &  theChannel,
cvr::palette colors 
) [virtual]

Load BMP containing a labeled mask with its corresponding palette entries.

Use this method if you know that the file contains a gray valued image or an indexed color image. If you try to load a 24-bit image with this method, then "false" will be returned.

Parameters:
filename name of the file to be readed
theChannel variable where the image will be stored
colors the palette used will be stored here

Implements cvr::ioImageInterface.

virtual bool cvr::ioBMP::load ( const std::string &  filename,
image theImage 
) [virtual]

Load file with BMP image.

Parameters:
filename name of the file to be readed
theImage variable where the image will to be stored

Implements cvr::ioImageInterface.

virtual const std::string& cvr::ioBMP::name (  )  const [virtual]

Returns the name of this class.

Reimplemented from cvr::ioImageInterface.

virtual ioBMP* cvr::ioBMP::newInstance (  )  const [virtual]

Returns a pointer to a new instance of this functor.

Implements cvr::ioImageInterface.

virtual bool cvr::ioBMP::save ( const std::string &  filename,
const matrix< int32 > &  chnl 
) [virtual]

Save the contents as a integer mask.

Default implementation discards the palette of the other matrix<int32> method.

Reimplemented from cvr::ioImageInterface.

virtual bool cvr::ioBMP::save ( const std::string &  filename,
const matrix< int32 > &  chnl,
const cvr::palette pal 
) [virtual]

Save the contents as a integer mask.

Default implementation returns the casting of the channel8 related method.

Reimplemented from cvr::ioImageInterface.

virtual bool cvr::ioBMP::save ( const std::string &  filename,
const matrix< float > &  theChannel 
) [virtual]

Save a floating point channel as an 8 bit RGB bitmap image.

The values of the channel must be between 0.0f and 1.0f!

Parameters:
filename name of the destination file
theChannel the channel to be saved

Reimplemented from cvr::ioImageInterface.

virtual bool cvr::ioBMP::save ( const std::string &  filename,
const matrix< ubyte > &  theChannel 
) [virtual]

Save a channel8 as an 8 bit RGB bitmap image.

Parameters:
filename name of the destination file
theChannel the channel to be save

Reimplemented from cvr::ioImageInterface.

virtual bool cvr::ioBMP::save ( const std::string &  filename,
const matrix< ubyte > &  theChannel,
const cvr::palette colors 
) [virtual]

Save a channel8 as an 8 bit RGB bitmap image.

Parameters:
filename name of the destination file
theChannel the channel to be save
colors the palette to be used.

Implements cvr::ioImageInterface.

virtual bool cvr::ioBMP::save ( const std::string &  filename,
const image theImage 
) [virtual]

Save an image as a 24 bit RGB bitmap image.

Implements cvr::ioImageInterface.


The documentation for this class was generated from the following file:

Generated on Sun Sep 20 22:08:53 2009 for CVR-Lib by Doxygen 1.5.8