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

lti::loadImage Class Reference

Functor to read an image file. More...

#include <ltiALLFunctor.h>

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

List of all members.

Public Member Functions

 loadImage ()
 ~loadImage ()
virtual const char * getTypeName () const
bool apply (image &theImage)
bool apply (channel8 &theChannel, lti::palette &colors)
bool apply (channel &theChannel)
bool load (const std::string &filename, image &theImage)
bool load (const std::string &filename, channel8 &theChannel, lti::palette &colors)
bool load (const std::string &filename, channel &theChannel)
bool checkHeader (const std::string &filename, point &imageSize)
bool checkHeader (const std::string &filename, point &imageSize, bool &trueColor)
virtual functorclone () const

Protected Attributes

lti::loadBMP loaderBMP
lti::loadJPEG loaderJPEG
lti::loadPNG loaderPNG
lti::splitImageToRGB rgbSplitter
lti::splitImageToHSI hsiSplitter

Detailed Description

Functor to read an image 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 you need to read or write many images at the same time, use in each thread an instance of this functor, or protect your code with semaphores.

This class is used to load lti::image or lti::channel objects from files of one of the formats supported by the LTI-Lib.

The load methods will use the extension in the filename to decide the format in which the image should be read.

Three formats are supported: PNG, BMP and JPEG.

Example:

 lti::loadImage loader; // functor to load images
 lti::image img;        // the image loaded will be left here.

 loader.load("myimage.png",img);  // load PNG image
 loader.load("myimage.bmp",img);  // load BMP image
 loader.load("myimage.jpg",img);  // load JPG image

The valid extensions are case insensitive matches for .jpg, .jpeg, .png and .bmp.


Constructor & Destructor Documentation

lti::loadImage::loadImage (  ) 

default constructor

lti::loadImage::~loadImage (  )  [inline]

destructor


Member Function Documentation

bool lti::loadImage::apply ( channel theChannel  ) 

load channel

Use this method if you know that the file contains a gray valued image. If you try to load a 24-bit image with this method, some quantization algorithms will be used to reduce the number of colors to 256.

Parameters:
theChannel the image on the file will be loaded here
Returns:
true if successful, false otherwise.
bool lti::loadImage::apply ( channel8 theChannel,
lti::palette colors 
) [virtual]

load channel

Use this method if you know that the file contains a gray valued image. If you try to load a 24-bit image with this method, some quantization algorithms will be used to reduce the number of colors to 256.

Parameters:
theChannel the image on the file will be loaded here
colors theChannel contains just indexes to the pixel values in this vector.
Returns:
true if successful, false otherwise.

Reimplemented from lti::ioFunctor.

bool lti::loadImage::apply ( image theImage  )  [virtual]

load Image

Parameters:
theImage the file specified in the parameters will be loaded in this image. Note that independently of the soft of image in the file, this will always be converted to a color lti::image.
Returns:
a reference to the loaded image.

Reimplemented from lti::ioFunctor.

bool lti::loadImage::checkHeader ( const std::string &  filename,
point imageSize,
bool &  trueColor 
)

check the data of the image header

Parameters:
filename name of the image file to be tested
imageSize returns the size of the image: imageSize.x is the number of columns and imageSize.y the number of rows.
trueColor true if the image contains 3x256 bits per pixel, false, otherwise. If false, you can use the methods to read channel8+palette
Returns:
true if file is ok
bool lti::loadImage::checkHeader ( const std::string &  filename,
point imageSize 
)

check the data of the image header

Parameters:
filename name of the image file to be tested
imageSize returns the size of the image: imageSize.x is the number of columns and imageSize.y the number of rows.
Returns:
true if file is ok
virtual functor* lti::loadImage::clone (  )  const [virtual]

returns a pointer to a clone of the functor.

Implements lti::functor.

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

returns the name of this type ("loadImage")

Reimplemented from lti::ioImage.

bool lti::loadImage::load ( const std::string &  filename,
channel theChannel 
)

shortcut for load an image.

Use this method if you know that the file contains a gray valued image. If you try to load a 24-bit image with this method, some quantization algorithms will be used to reduce the number of colors to 256.

Parameters:
filename name of the file to be readed
theChannel variable where the image will be stored
bool lti::loadImage::load ( const std::string &  filename,
channel8 theChannel,
lti::palette colors 
) [virtual]

shortcut for load an image.

Use this method if you know that the file contains a gray valued image. If you try to load a 24-bit image with this method, some quantization algorithms will be used to reduce the number of colors to 256.

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

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

shortcut for load an image

Parameters:
filename name of the file to be readed
theImage variable where the image will to be stored

Reimplemented from lti::ioFunctor.


Member Data Documentation

functor to split images to HSI

functor to load BMP images

functor to load JPEG images

functor to load PNG images

functor to split images to RGB


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

Generated on Sat Apr 10 15:27:59 2010 for LTI-Lib by Doxygen 1.6.1