latest version v1.9 - last update 10 Apr 2010 |
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>
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 functor * | clone () const |
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.
BadJpegStream | is thrown when the Stream is corrupted. |
For more information on implementation issues see ioJPEG
lti::loadJPEG::loadJPEG | ( | ) |
default constructor
lti::loadJPEG::~loadJPEG | ( | ) |
destructor
bool lti::loadJPEG::apply | ( | image & | theImage, | |
bool & | isGray | |||
) |
bool lti::loadJPEG::apply | ( | image & | theImage | ) | [virtual] |
loads a JPEG image
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!
filename | name of the file to check | |
imageSize | size of the image | |
comment | file comments (author, ...) | |
isGray | returns true, if grayscale jpeg |
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 | |||
) |
bool lti::loadJPEG::load | ( | const std::string & | filename, | |
image & | theImage | |||
) | [virtual] |
shortcut for loading a JPEG
filename | name of the file to read | |
theImage | variable where the image is stored |
Reimplemented from lti::ioFunctor.