last update 20 Sep 2009 |
#include <cvrIOJPEG.h>
Classes | |
class | parameters |
Parameter class of ioJPEG. More... | |
Public Member Functions | |
ioJPEG () | |
ioJPEG (const parameters &other) | |
ioJPEG (const ioJPEG &other) | |
~ioJPEG () | |
const parameters & | getParameters () const |
virtual const std::string & | name () const |
virtual ioJPEG * | clone () const |
virtual ioJPEG * | newInstance () const |
virtual bool | load (const std::string &filename, image &theImage) |
virtual bool | load (const std::string &filename, matrix< ubyte > &theImage, palette &colors) |
virtual bool | load (const std::string &filename, matrix< ubyte > &chnl) |
virtual bool | load (const std::string &filename, matrix< float > &chnl) |
virtual bool | load (const std::string &filename, matrix< int32 > &chnl, palette &pal) |
virtual bool | load (const std::string &filename, matrix< int32 > &chnl) |
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) |
bool | save (const std::string &filename, const matrix< float > &theChannel) |
virtual bool | save (const std::string &filename, const matrix< int32 > &chnl, const palette &pal) |
virtual bool | save (const std::string &filename, const matrix< int32 > &chnl) |
Additional methods not in ioImageInterface | |
bool | load (const std::string &filename, image &theImage, bool &isGray) |
It is NOT thread save, this means, the SAME instance can not be used from different threads or processes at the same time. If this occurs an unpredictible behaviour must be expected!. If this is required, just use a different instance of the functor for each thread, or use mutexes to avoid parallel accesses.
Example:
cvr::image anImg; // an image ... cvr::ioJPEG loader; // the load/save class loader.load("~/tmp/theFile.jpeg",img); // load the image.
BadJpegStream | is thrown when the Stream is corrupted. |
We recomend to use the libjpeg, it is more robust against not 100% correct JPEG-files, and it is faster. Mianos' implementation is mainly for windows users who do not want to install the jpeglib.
cvr::ioJPEG::ioJPEG | ( | ) |
Default constructor.
cvr::ioJPEG::ioJPEG | ( | const parameters & | other | ) |
Constructor with parameters.
cvr::ioJPEG::ioJPEG | ( | const ioJPEG & | other | ) |
Copy constructor.
cvr::ioJPEG::~ioJPEG | ( | ) |
Destructor.
bool cvr::ioJPEG::checkHeader | ( | const std::string & | filename, | |
headerInformation & | info | |||
) | [virtual] |
Returns the essential image information.
This function will search the file for all chunks with essential picture information. Scanning stops before the first StartOfScan-Block. That is, all comments that follow the image data are not read!
filename | name of the file to check | |
info | contains the header data |
Implements cvr::ioImageInterface.
virtual ioJPEG* cvr::ioJPEG::clone | ( | ) | const [virtual] |
const parameters& cvr::ioJPEG::getParameters | ( | ) | const |
bool cvr::ioJPEG::load | ( | const std::string & | filename, | |
image & | theImage, | |||
bool & | isGray | |||
) |
Load the contents as a integer mask.
Default implementation discards the palette of the other matrix<int32> method.
Reimplemented from cvr::ioImageInterface.
virtual bool cvr::ioJPEG::load | ( | const std::string & | filename, | |
matrix< int32 > & | chnl, | |||
palette & | pal | |||
) | [virtual] |
Load the contents as a integer mask.
Default implementation returns the casting of the channel8 related method.
Reimplemented from cvr::ioImageInterface.
virtual bool cvr::ioJPEG::load | ( | const std::string & | filename, | |
matrix< float > & | chnl | |||
) | [virtual] |
Load a floating point channel.
Not many file formats support floating point channels, so the default implementation just casts a channel8 into the float.
Reimplemented from cvr::ioImageInterface.
Load the contents as a gray channel.
Default implementation just discards the palette of load(const std::string&,matrix<ubyte>&,palette&)
Reimplemented from cvr::ioImageInterface.
virtual bool cvr::ioJPEG::load | ( | const std::string & | filename, | |
image & | theImage | |||
) | [virtual] |
Load true-color image.
filename | name of the file to read | |
theImage | variable where the image is stored |
Implements cvr::ioImageInterface.
virtual const std::string& cvr::ioJPEG::name | ( | ) | const [virtual] |
virtual ioJPEG* cvr::ioJPEG::newInstance | ( | ) | const [virtual] |
virtual bool cvr::ioJPEG::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::ioJPEG::save | ( | const std::string & | filename, | |
const matrix< int32 > & | chnl, | |||
const palette & | pal | |||
) | [virtual] |
Save the contents as a integer mask.
Default implementation returns the casting of the channel8 related method.
Reimplemented from cvr::ioImageInterface.
bool cvr::ioJPEG::save | ( | const std::string & | filename, | |
const matrix< float > & | theChannel | |||
) | [virtual] |
Save a channel as a gray valued JPEG.
filename | name of the file to save | |
theChannel | the channel to be saved |
Reimplemented from cvr::ioImageInterface.
virtual bool cvr::ioJPEG::save | ( | const std::string & | filename, | |
const matrix< ubyte > & | theChannel | |||
) | [virtual] |
shortcut for load JPEG
filename | name of the file to save | |
theChannel | the channel to be saved |
Reimplemented from cvr::ioImageInterface.
virtual bool cvr::ioJPEG::save | ( | const std::string & | filename, | |
const matrix< ubyte > & | theChannel, | |||
const cvr::palette & | colors | |||
) | [virtual] |
Save an "indexed" image contained in the given channel8 (indices) and the given color palette.
Implements cvr::ioImageInterface.
virtual bool cvr::ioJPEG::save | ( | const std::string & | filename, | |
const image & | theImage | |||
) | [virtual] |
Save an image in JPEG format.
filename | name of the file to save | |
theImage | the image to be saved |
Implements cvr::ioImageInterface.