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

lti::colorModelEstimator Class Reference

This functor is used to create three-dimensional histograms for the colors of images. More...

#include <ltiColorModelEstimator.h>

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

List of all members.

Classes

class  parameters
 The parameters for the class colorModelEstimator. More...

Public Member Functions

 colorModelEstimator ()
 colorModelEstimator (const colorModelEstimator &other)
virtual ~colorModelEstimator ()
virtual const char * getTypeName () const
bool reset ()
bool consider (const rgbPixel &pix, const int times=1)
bool smoothConsider (const rgbPixel &pix, const int times=1)
bool consider (const float &c1, const float &c2, const float &c3, const int times=1)
bool consider (const palette &pal)
bool consider (const image &img)
bool consider (const channel &c1, const channel &c2, const channel &c3)
bool consider (const image &img, const channel8 &mask)
bool consider (const image &img, const imatrix &mask)
bool consider (const channel &c1, const channel &c2, const channel &c3, const channel8 &mask)
bool consider (const channel &c1, const channel &c2, const channel &c3, const imatrix &mask)
bool consider (const image &img, const channel8 &mask, const ubyte label)
bool consider (const image &img, const imatrix &mask, const int label)
bool consider (const std::list< image > &imgs)
bool consider (const std::list< image > &imgs, const std::list< channel8 > &masks)
const thistogram< double > & getColorModel ()
bool apply (thistogram< double > &model) const
bool apply (trgbPixel< double > &mean, dmatrix &covar) const
colorModelEstimatorcopy (const colorModelEstimator &other)
colorModelEstimatoroperator= (const colorModelEstimator &other)
virtual functorclone () const
virtual bool updateParameters ()
const parametersgetParameters () const

Protected Member Functions

void outer (const trgbPixel< double > &a, const trgbPixel< double > &b, dmatrix &mat) const

Protected Attributes

thistogram< double > theModel
trgbPixel< double > sum
dmatrix sumOuter
int n

Detailed Description

This functor is used to create three-dimensional histograms for the colors of images.

The histograms are used as color models in functors like lti::colorModelSelector and lti::probabilityMap.

It is possible to provide whole images (usefull to create histograms of backgrounds, if they can be captured as a whole image), or images with corresponding masks, that allow to consider only those pixels with a mask value different than zero.

It is also possible to provide directly a list of images.

This functor generates also simple statistics for a multivariate gaussian model for the color (mean color and covariance matrix)


Constructor & Destructor Documentation

lti::colorModelEstimator::colorModelEstimator (  ) 

Default constructor.

lti::colorModelEstimator::colorModelEstimator ( const colorModelEstimator other  ) 

Copy constructor.

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

Destructor.


Member Function Documentation

bool lti::colorModelEstimator::apply ( trgbPixel< double > &  mean,
dmatrix covar 
) const

Get the mean color and covariance matrix of the internal model.

Parameters:
mean the mean color
covar covariance matrix of the color (3x3 matrix)
Returns:
true if apply successful, false otherwise.
bool lti::colorModelEstimator::apply ( thistogram< double > &  model  )  const

Get a copy of the internal model in the given parameter.

Parameters:
model the color model (as 3D histogram) computed until now
Returns:
true if apply successful or false otherwise.
virtual functor* lti::colorModelEstimator::clone (  )  const [virtual]

Returns a pointer to a clone of this functor.

Reimplemented from lti::statisticsFunctor.

bool lti::colorModelEstimator::consider ( const std::list< image > &  imgs,
const std::list< channel8 > &  masks 
)

Consider all the images in the given list.

The mask list must have the same size, and the corresponding images must also have the same size.

Parameters:
imgs list of images to be considered.
masks list of all masks.
Returns:
true if successful or false otherwise.
bool lti::colorModelEstimator::consider ( const std::list< image > &  imgs  ) 

Consider all the images in the given list.

Parameters:
imgs list of images to be considered
Returns:
true if successful or false otherwise.
bool lti::colorModelEstimator::consider ( const image img,
const imatrix mask,
const int  label 
)

Consider the pixels in the image, for which the corresponding pixel in the mask contains the value given by label.

The mask and the image must have the same size.

This is seldom used. See lti::computePalette, maybe that is what you are looking for!

Parameters:
img image with colors to be considered
mask imatrix with the mask.
label only those pixel whose value in the mask are equal to this parameters will be considered.
Returns:
true if successful or false otherwise.
bool lti::colorModelEstimator::consider ( const image img,
const channel8 mask,
const ubyte  label 
)

Consider the pixels in the image, for which the corresponding pixel in the mask contains the value given by label.

The mask and the image must have the same size.

This is seldom used. See lti::computePalette, maybe that is what you are looking for!

Parameters:
img image with colors to be considered
mask channel8 with the mask.
label only those pixel whose value in the mask are equal to this parameters will be considered.
Returns:
true if successful or false otherwise.
bool lti::colorModelEstimator::consider ( const channel c1,
const channel c2,
const channel c3,
const imatrix mask 
)

Consider the pixels in the image, for which the corresponding pixel in the mask is not zero.

The mask and the image must have the same size.

Parameters:
c1 first channel.
c2 second channel.
c3 third channel.
mask imatrix with the mask. A value of zero means, that the corresponding pixel in the image must be ignored.
Returns:
true if successful or false otherwise.
bool lti::colorModelEstimator::consider ( const channel c1,
const channel c2,
const channel c3,
const channel8 mask 
)

Consider the pixels in the image, for which the corresponding pixel in the mask is not zero.

The mask and the image must have the same size.

Parameters:
c1 first channel.
c2 second channel.
c3 third channel.
mask channel8 with the mask. A value of zero means, that the corresponding pixel in the image must be ignored.
Returns:
true if successful or false otherwise.
bool lti::colorModelEstimator::consider ( const image img,
const imatrix mask 
)

Consider the pixels in the image, for which the corresponding pixel in the mask is not zero.

The mask and the image must have the same size.

Parameters:
img image with colors to be considered
mask imatrix with the mask. A value of zero means, that the corresponding pixel in the image must be ignored.
Returns:
true if successful or false otherwise.
bool lti::colorModelEstimator::consider ( const image img,
const channel8 mask 
)

Consider the pixels in the image, for which the corresponding pixel in the mask is not zero.

The mask and the image must have the same size.

Parameters:
img image with colors to be considered
mask channel8 with the mask. A value of zero means, that the corresponding pixel in the image must be ignored.
Returns:
true if successful or false otherwise.
bool lti::colorModelEstimator::consider ( const channel c1,
const channel c2,
const channel c3 
)

Consider all pixels defined by the correspondent elements in the three given channels.

Parameters:
c1 first channel.
c2 second channel.
c3 third channel.
Returns:
true if successful or false otherwise.
bool lti::colorModelEstimator::consider ( const image img  ) 

Consider all pixels in the image.

Parameters:
img image with colors to be considered
Returns:
true if successful or false otherwise.
bool lti::colorModelEstimator::consider ( const palette pal  ) 

Consider a pixel for the model.

Parameters:
pal the color palette to be considered
Returns:
true if successful or false otherwise.
bool lti::colorModelEstimator::consider ( const float &  c1,
const float &  c2,
const float &  c3,
const int  times = 1 
)

Consider a three dimensional pixel value given its three components.

It is assumed that the value range of all channels lies between 0.0 and 1.0.

Parameters:
c1 first color component.
c2 second color component.
c3 third color component.
times number of times the given color point must be consider.
bool lti::colorModelEstimator::consider ( const rgbPixel pix,
const int  times = 1 
)

Consider a pixel for the model.

Parameters:
pix pixel to be considered
times how many times should the pixel be considered
Returns:
true if successful or false otherwise.
colorModelEstimator& lti::colorModelEstimator::copy ( const colorModelEstimator other  ) 

Copy data of "other" functor.

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

Reimplemented from lti::statisticsFunctor.

const thistogram<double>& lti::colorModelEstimator::getColorModel (  ) 

Get a constant reference to the internal model.

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

Returns used parameters.

Reimplemented from lti::statisticsFunctor.

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

Returns the name of this type ("colorModelEstimator").

Reimplemented from lti::statisticsFunctor.

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

Alias for copy member.

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

Reimplemented from lti::functor.

void lti::colorModelEstimator::outer ( const trgbPixel< double > &  a,
const trgbPixel< double > &  b,
dmatrix mat 
) const [protected]

Outer product of two colors.

The matrix MUST be 3x3 before calling this method.

bool lti::colorModelEstimator::reset (  ) 

Reset the internal histogram to consider new elements.

The internal model will be empty, but with the correct size.

bool lti::colorModelEstimator::smoothConsider ( const rgbPixel pix,
const int  times = 1 
)

Consider a pixel for the model.

This more time consuming consider method will not only add 1 to the "winner" bin, but will also distribute the "1" vote using tri-linear interpolation among the seven neighbors.

Parameters:
pix pixel to be considered
times how many times should the pixel be considered
Returns:
true if successful or false otherwise.
virtual bool lti::colorModelEstimator::updateParameters (  )  [virtual]

Set functor's parameters.

This member makes a copy of theParam: the functor will keep its own copy of the parameters!

This overloading will initialize the size of the internal color model

Returns:
true if successful, false otherwise

Reimplemented from lti::functor.


Member Data Documentation

int lti::colorModelEstimator::n [protected]

Number of pixels considered until now.

Sum of colors until now.

Sum of outer-product of the colors until now (required for the computation of the covariance matrix.

The color model used.

If empty, it is assumed to be uninitialized.


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

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