CVR-Lib last update 20 Sep 2009

cvr::ioJPEG Class Reference

Class to read and write images store in the Joint Picture Expert Group file format (JPEG). More...

#include <cvrIOJPEG.h>

Inheritance diagram for cvr::ioJPEG:

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

Collaboration graph
[legend]

List of all members.

Classes

class  parameters
 Parameter class of ioJPEG. More...

Public Member Functions

 ioJPEG ()
 ioJPEG (const parameters &other)
 ioJPEG (const ioJPEG &other)
 ~ioJPEG ()
const parametersgetParameters () const
virtual const std::string & name () const
virtual ioJPEGclone () const
virtual ioJPEGnewInstance () 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)


Detailed Description

Class to read and write images store in the Joint Picture Expert Group file format (JPEG).

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.

Exceptions:
BadJpegStream is thrown when the Stream is corrupted.
See also:
ioImage
There are two implementations of this functor.

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.


Constructor & Destructor Documentation

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.


Member Function Documentation

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!

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

Implements cvr::ioImageInterface.

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

Returns a pointer to a clone of this functor.

Implements cvr::ioImageInterface.

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

Returns current parameters.

Reimplemented from cvr::ioImageInterface.

bool cvr::ioJPEG::load ( const std::string &  filename,
image theImage,
bool &  isGray 
)

Load image with image type.

Parameters:
filename name of the file to read
theImage variable where the image is stored
isGray will be set with true if the image contains only gray values.

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

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.

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

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,
matrix< ubyte > &  theImage,
palette colors 
) [virtual]

Load indexed image.

Implements cvr::ioImageInterface.

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

Load true-color image.

Parameters:
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]

Returns the name of this class.

Reimplemented from cvr::ioImageInterface.

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

Returns a pointer to a new instance of this functor.

Implements cvr::ioImageInterface.

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.

Parameters:
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

Parameters:
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.

Parameters:
filename name of the file to save
theImage the image to be saved

Implements cvr::ioImageInterface.


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

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