LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::loadJPEG Class Reference

Functor to read a JPEG file It is NOT thread save, this means, the SAME instance can not be used from different threads or processes at the same time. More...

#include <ltiJPEGFunctor.h>

Inheritance diagram for lti::loadJPEG:
Inheritance graph
[legend]
Collaboration diagram for lti::loadJPEG:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 loadJPEG ()
 ~loadJPEG ()
virtual const char * getTypeName () const
bool apply (image &theImage)
bool apply (image &theImage, bool &isGray)
bool load (const std::string &filename, image &theImage)
bool load (const std::string &filename, image &theImage, bool &isGray)
bool load (std::ifstream &file, image &theImage)
bool checkHeader (const std::string &filename, point &imageSize, std::string &comment, bool &isGray)
virtual functorclone () const

Detailed Description

Functor to read a JPEG file 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! Example:

 lti::image anImg;                      // an image
 ...
 lti::loadJPEG myImg;                    // the load functor
 lti::loadJPEG::parameters param;        // functor parameters
 param.filename = "~/tmp/theFile.jpeg";  // name of the JPEG file
 myImg.setParameters(param);            // set the functor parameters
 myImg.apply(anImg);                    // load the file

You can also use the more confortable shortcut:

 lti::image anImg;                      // an image
 ...
 lti::loadJPEG loadImg;                  // the load functor
 loadImg.load("~/tmp/theFile.jpeg",img); // load the image.
Exceptions:
BadJpegStream is thrown when the Stream is corrupted.
See also:
saveJPEG
image
loadJPEG::parameters

For more information on implementation issues see ioJPEG


Constructor & Destructor Documentation

lti::loadJPEG::loadJPEG (  ) 

default constructor

lti::loadJPEG::~loadJPEG (  ) 

destructor


Member Function Documentation

bool lti::loadJPEG::apply ( image theImage,
bool &  isGray 
)

load JPEG image

Parameters:
theImage variable where the image is to be stored
isGray returns true when the image is gray scale
bool lti::loadJPEG::apply ( image theImage  )  [virtual]

loads a JPEG image

Parameters:
theImage variable where the image is to be stored

Reimplemented from lti::ioFunctor.

bool lti::loadJPEG::checkHeader ( const std::string &  filename,
point imageSize,
std::string &  comment,
bool &  isGray 
)

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
imageSize size of the image
comment file comments (author, ...)
isGray returns true, if grayscale jpeg
Returns:
true if file is ok
virtual functor* lti::loadJPEG::clone (  )  const [virtual]

returns a pointer to a clone of the functor.

Implements lti::functor.

virtual const char* lti::loadJPEG::getTypeName (  )  const [virtual]

returns the name of this type

Reimplemented from lti::ioJPEG.

bool lti::loadJPEG::load ( std::ifstream &  file,
image theImage 
)

method for loading a JPEG image from an already opened stream.

bool lti::loadJPEG::load ( const std::string &  filename,
image theImage,
bool &  isGray 
)

shortcut for loading a JPEG

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.
bool lti::loadJPEG::load ( const std::string &  filename,
image theImage 
) [virtual]

shortcut for loading a JPEG

Parameters:
filename name of the file to read
theImage variable where the image is stored

Reimplemented from lti::ioFunctor.


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

Generated on Sat Apr 10 15:28:03 2010 for LTI-Lib by Doxygen 1.6.1