last update 20 Sep 2009 |
#include <cvrIOBMP.h>
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 parameters & | getParameters () const |
virtual const std::string & | name () const |
virtual ioBMP * | clone () const |
virtual ioBMP * | newInstance () 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) |
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).
cvr::ioBMP::ioBMP | ( | ) |
Default constructor.
cvr::ioBMP::ioBMP | ( | const parameters & | par | ) |
Constructor with parameters.
virtual cvr::ioBMP::~ioBMP | ( | ) | [virtual] |
destructor
bool cvr::ioBMP::checkHeader | ( | const std::string & | filename, | |
headerInformation & | info | |||
) | [virtual] |
check the data of the bitmap header
filename | name of the bitmap file to be tested | |
info | contains the header data |
Implements cvr::ioImageInterface.
virtual ioBMP* cvr::ioBMP::clone | ( | ) | const [virtual] |
const parameters& cvr::ioBMP::getParameters | ( | ) | const |
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)
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. |
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)
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. |
virtual bool cvr::ioBMP::load | ( | std::ifstream & | file, | |
image & | theImage | |||
) | [virtual] |
Load a BMP from an opened stream.
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.
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.
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.
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.
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.
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.
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] |
virtual ioBMP* cvr::ioBMP::newInstance | ( | ) | const [virtual] |
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] |
virtual bool cvr::ioBMP::save | ( | const std::string & | filename, | |
const matrix< ubyte > & | theChannel | |||
) | [virtual] |
Save a channel8 as an 8 bit RGB bitmap image.
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.
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] |