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

lti::computePalette Class Reference

This class is used to compute a palette given a color image and an index mask. More...

#include <ltiComputePalette.h>

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

List of all members.

Classes

class  parameters
 the parameters for the class computePalette More...

Public Member Functions

 computePalette ()
 computePalette (const computePalette &other)
virtual ~computePalette ()
virtual const char * getTypeName () const
bool apply (const image &src, const channel8 &mask, palette &dest) const
bool apply (const image &src, const matrix< int > &mask, palette &dest) const
bool apply (const image &src, const channel8 &mask, palette &dest, vector< trgbPixel< float > > &palStdDev) const
bool apply (const image &src, const matrix< int > &mask, palette &dest, vector< trgbPixel< float > > &palStdDev) const
bool apply (const image &src, const matrix< int > &mask, vector< trgbPixel< float > > &means, ivector &n, const int numLabels=-1) const
bool apply (const image &src, const channel8 &mask, palette &dest, vector< trgbPixel< float > > &palStdDev, vector< int > &n) const
bool apply (const image &src, const matrix< int > &mask, palette &dest, vector< trgbPixel< float > > &palStdDev, vector< int > &n) const
bool apply (const image &src, const matrix< int > &mask, vector< trgbPixel< float > > &dest, std::vector< matrix< float > > &palCovar, vector< int > &n) const
bool apply (const channel &ch1, const channel &ch2, const channel &ch3, const matrix< int > &mask, vector< trgbPixel< float > > &dest, std::vector< matrix< float > > &palCovar, vector< int > &n) const
bool apply (const channel &ch1, const channel &ch2, const channel &ch3, const matrix< int > &mask, vector< trgbPixel< float > > &dest, vector< int > &n) const
bool apply (const channel &ch, const matrix< int > &mask, vector< float > &means, vector< float > &vars, vector< int > &n) const
bool apply (const image &src, const matrix< int > &mask, const int label, trgbPixel< float > &mean, matrix< float > &covar, int &n) const
computePalettecopy (const computePalette &other)
computePaletteoperator= (const computePalette &other)
virtual functorclone () const
const parametersgetParameters () const

Detailed Description

This class is used to compute a palette given a color image and an index mask.

Both objects must have the same size. The size of the resulting palette will be the maximal value in the index mask plus one. The colors in the palette will be the average colors in the mask.

See also:
usePalette

Constructor & Destructor Documentation

lti::computePalette::computePalette (  ) 

default constructor

lti::computePalette::computePalette ( const computePalette other  ) 

copy constructor

Parameters:
other the object to be copied
virtual lti::computePalette::~computePalette (  )  [virtual]

destructor


Member Function Documentation

bool lti::computePalette::apply ( const image src,
const matrix< int > &  mask,
const int  label,
trgbPixel< float > &  mean,
matrix< float > &  covar,
int &  n 
) const

compute the mean value and covariance matrix for just one label in the mask.

Parameters:
src image with the source data.
mask mask with palette entry indices.
label label to be analyzed.
mean mean color of the given label.
covar covariance matrix for the given label.
n number of pixels found with the given label.
Returns:
true if apply successful or false otherwise.
bool lti::computePalette::apply ( const channel ch,
const matrix< int > &  mask,
vector< float > &  means,
vector< float > &  vars,
vector< int > &  n 
) const

This apply method computes the mean values and variances of the regions indicated by the mask for the given channel.

Parameters:
ch channel for which the region statistics will be computed
mask labeled mask indicating the regions
means mean values for each region
vars variances for each region
n number of pixels per region
Returns:
true if successful, false otherwise.
bool lti::computePalette::apply ( const channel ch1,
const channel ch2,
const channel ch3,
const matrix< int > &  mask,
vector< trgbPixel< float > > &  dest,
vector< int > &  n 
) const

this apply will generate multivariate statistics for each entry in the palette.

It takes more time than the other ones. The image will be assumed to be composed by the given three channels.

Parameters:
ch1 first channel of the image
ch2 second channel of the image
ch3 third channel of the image
mask mask with palette entry indices.
dest computed palette (mean value of all elements with the same index). Note that this apply will compute with floats)
n number of pixels found for each entry
Returns:
true if apply successful or false otherwise.
bool lti::computePalette::apply ( const channel ch1,
const channel ch2,
const channel ch3,
const matrix< int > &  mask,
vector< trgbPixel< float > > &  dest,
std::vector< matrix< float > > &  palCovar,
vector< int > &  n 
) const

this apply will generate multivariate statistics for each entry in the palette.

It takes more time than the other ones. The image will be assumed to be composed by the given three channels.

Parameters:
ch1 first channel of the image
ch2 second channel of the image
ch3 third channel of the image
mask mask with palette entry indices.
dest computed palette (mean value of all elements with the same index). Note that this apply will compute with floats)
palCovar covariance matrices for each palette entry.
n number of pixels found for each entry
Returns:
true if apply successful or false otherwise.
bool lti::computePalette::apply ( const image src,
const matrix< int > &  mask,
vector< trgbPixel< float > > &  dest,
std::vector< matrix< float > > &  palCovar,
vector< int > &  n 
) const

this apply will generate multivariate statistics for each entry in the palette, at it takes more time than the other ones.

Parameters:
src image with the source data.
mask mask with palette entry indices.
dest computed palette (mean value of all elements with the same index). Note that this apply will compute with floats)
palCovar covariance matrices for each palette entry.
n number of pixels found for each entry
Returns:
true if apply successful or false otherwise.
bool lti::computePalette::apply ( const image src,
const matrix< int > &  mask,
palette dest,
vector< trgbPixel< float > > &  palStdDev,
vector< int > &  n 
) const

operates on a copy of the given parameters.

Parameters:
src image with the source data.
mask mask with palette entry indices.
dest computed palette (mean value of all elements with the same index).
palStdDev standard deviation for each palette entry.
n number of pixels found for each entry
Returns:
true if apply successful or false otherwise.
bool lti::computePalette::apply ( const image src,
const channel8 mask,
palette dest,
vector< trgbPixel< float > > &  palStdDev,
vector< int > &  n 
) const

operates on a copy of the given parameters.

Parameters:
src image with the source data.
mask mask with palette entry indices.
dest computed palette (mean value of all elements with the same index).
palStdDev standard deviation for each palette entry.
n number of pixels found for each entry
Returns:
true if apply successful or false otherwise.
bool lti::computePalette::apply ( const image src,
const matrix< int > &  mask,
vector< trgbPixel< float > > &  means,
ivector n,
const int  numLabels = -1 
) const

computes the mean values for each label present in the image

Parameters:
src image with the source data.
mask mask with palette entry indices.
means mean value of all elements with the same label.
n number of elements for each label.
numLabels this optional parameter can be used to save some time if you give the number of labels in the mask, or to be more specific the greatest label in mask + 1. If ommited, the mask.maximum() will be called to find out how many elements the vectors n and means must have, which costs one iteration on the whole mask.
Returns:
true if apply successful or false otherwise.
bool lti::computePalette::apply ( const image src,
const matrix< int > &  mask,
palette dest,
vector< trgbPixel< float > > &  palStdDev 
) const

operates on a copy of the given parameters.

Parameters:
src image with the source data.
mask mask with palette entry indices.
dest computed palette (mean value of all elements with the same index).
palStdDev standard deviation for each palette entry.
Returns:
true if apply successful or false otherwise.
bool lti::computePalette::apply ( const image src,
const channel8 mask,
palette dest,
vector< trgbPixel< float > > &  palStdDev 
) const

operates on a copy of the given parameters.

Parameters:
src image with the source data.
mask mask with palette entry indices.
dest computed palette (mean value of all elements with the same index).
palStdDev standard deviation for each palette entry.
Returns:
true if apply successful or false otherwise.
bool lti::computePalette::apply ( const image src,
const matrix< int > &  mask,
palette dest 
) const

operates on a copy of the given parameters.

Parameters:
src image with the source data.
mask mask with palette entry indices.
dest computed palette.
Returns:
true if apply successful or false otherwise.
bool lti::computePalette::apply ( const image src,
const channel8 mask,
palette dest 
) const

operates on a copy of the given parameters.

Parameters:
src image with the source data.
mask mask with palette entry indices.
dest computed palette.
Returns:
true if apply successful or false otherwise.
virtual functor* lti::computePalette::clone (  )  const [virtual]

returns a pointer to a clone of this functor.

Implements lti::functor.

computePalette& lti::computePalette::copy ( const computePalette other  ) 

copy data of "other" functor.

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

Reimplemented from lti::functor.

const parameters& lti::computePalette::getParameters (  )  const

returns used parameters

Reimplemented from lti::functor.

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

returns the name of this type ("computePalette")

Reimplemented from lti::functor.

computePalette& lti::computePalette::operator= ( const computePalette other  ) 

alias for copy member

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

Reimplemented from lti::functor.


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

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