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

lti::chrominanceModelEstimator Class Reference

This class stores a 2d histogram containing all chrominances which have been seen on a specific object. More...

#include <ltiChrominanceModelEstimator.h>

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

List of all members.

Classes

class  parameters
 The parameters for the class chrominanceModelEstimator. More...

Public Member Functions

 chrominanceModelEstimator ()
 chrominanceModelEstimator (const parameters &par)
 chrominanceModelEstimator (const chrominanceModelEstimator &other)
virtual ~chrominanceModelEstimator ()
virtual const char * getTypeName () const
chrominanceModelEstimatorcopy (const chrominanceModelEstimator &other)
chrominanceModelEstimatoroperator= (const chrominanceModelEstimator &other)
virtual functorclone () const
const parametersgetParameters () const
bool setParameters (const parameters &theParams)
bool setChrominanceModels (const std::vector< histogram2D > &theModels)
const std::vector< histogram2D > & getChrominanceModels () const
bool writeChrominanceModels (const std::string &prefix, const std::vector< std::string > &fileNames) const
bool readChrominanceModels (const std::string &prefix, const std::vector< std::string > &fileNames)
virtual bool consider (const channel8 &uChan, const channel8 &vChan, const channel8 &mask)
virtual bool consider (const channel8 &uChan, const channel8 &vChan, const channel8 &mask, const ivector &count)
virtual bool consider (const channel8 &uChan, const channel8 &vChan, const bool trainForeground)
virtual bool consider (const channel8 &uChan, const channel8 &vChan, const bool trainForeground, const ivector &count)
virtual bool consider (const channel8 &uChan, const channel8 &vChan, const int index)
virtual bool consider (const channel8 &uChan, const channel8 &vChan, const int index, const ivector &count)

Protected Member Functions

parametersgetWritableParameters ()
bool checkHistograms (const std::vector< histogram2D > &theHistos)
bool scaleValues (histogram2D &theHisto)
bool rescale (histogram2D &theHisto, const int cellsInDimension)
bool rescale (const histogram2D &theHisto, histogram2D &destHisto, const int cellsInDimension)
bool upsample (const histogram2D &theHisto, histogram2D &destHisto, const int factor)
bool downsample (const histogram2D &theHisto, histogram2D &destHisto, const int factor)
bool increaseCount (const ivector &count)

Protected Attributes

std::vector< histogram2Dm_chromHistos
ivector m_count
int m_maxEntries
int m_numEntries
bool m_constructModel

Detailed Description

This class stores a 2d histogram containing all chrominances which have been seen on a specific object.

The class administers histograms for >=1 objects. The histograms may be processed by other classes to create probability maps or a look up table containing the most likely object for each chrominance.

The class supports a time out of the histogram entries. For robustness and run-time efficiency a maximal chrominance set may be specified for each object including the background. E.g. if an object is known to be red it is advantageous to store only red chrominances inside it's histogram. This way no false chrominances are stored if the segmentation is errornous. Furthermore, if only red objects are processed all other chrominances may be excluded from processing for run time efficiency. We do not need to store these non-object chrominances in the background histogram neither.

If using fully automatic re-calibration it is possible to carve out chrominances that are well known to belong to an object from the background. These chrominances will always be segmented and the object cannot dissappear due to time-out and wrong maxima.

If you change the maximal chrominance sets online you should implement a method that deletes all histogram entries outside the region defined by the maximal chrominance sets. This is not done yet.

See also:
overlappingSets2D, chrominanceMapEstimator, probabilityMap2D

Constructor & Destructor Documentation

lti::chrominanceModelEstimator::chrominanceModelEstimator (  ) 

Default constructor.

lti::chrominanceModelEstimator::chrominanceModelEstimator ( const parameters par  ) 

Construct a functor using the given parameters.

lti::chrominanceModelEstimator::chrominanceModelEstimator ( const chrominanceModelEstimator other  ) 

Copy constructor.

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

Destructor.


Member Function Documentation

bool lti::chrominanceModelEstimator::checkHistograms ( const std::vector< histogram2D > &  theHistos  )  [protected]

Check if the histograms are valid, i.e.

have the correct size and accord to the number of models

Parameters:
theHistos the chrominance models.
Returns:
true on success and false otherwise.
virtual functor* lti::chrominanceModelEstimator::clone (  )  const [virtual]

Returns a pointer to a clone of this functor.

Reimplemented from lti::statisticsFunctor.

Reimplemented in lti::chrominanceMapEstimator.

virtual bool lti::chrominanceModelEstimator::consider ( const channel8 uChan,
const channel8 vChan,
const int  index,
const ivector count 
) [virtual]

Consider the chrominances in the supplied channel8.

All histograms are incremented.

Parameters:
uChan refers to the columns of the histogram.
vChan refers to the rows of the histogram.
count specifies how the counters will be incremented. The counter determine if a histogram is decayed prior to considering the new values.
index train chrominance model associated with index i. Index 0 refers to the background.
Returns:
true on success and false otherwise.
virtual bool lti::chrominanceModelEstimator::consider ( const channel8 uChan,
const channel8 vChan,
const int  index 
) [virtual]

Consider the chrominances in the supplied channel8.

All histograms are incremented. All histograms will be considered as updated, no matter whether they really did change.

Parameters:
uChan refers to the columns of the histogram.
vChan refers to the rows of the histogram.
index train chrominance model associated with index i. Index 0 refers to the background.
Returns:
true on success and false otherwise.
virtual bool lti::chrominanceModelEstimator::consider ( const channel8 uChan,
const channel8 vChan,
const bool  trainForeground,
const ivector count 
) [virtual]

Consider the chrominances in the supplied channel8.

All histograms are incremented.

Parameters:
uChan refers to the columns of the histogram.
vChan refers to the rows of the histogram.
count specifies how the counters will be incremented. The counter determine if a histogram is decayed prior to considering the new values.
trainForeground if true all histogram apart the background are trained. If false the background is trained. If you train more than two models please use the objectTable to distinguish the objects' colors. E.g. the object table provides the rough segmentation, which this class refines. Of course, this method only works for non-overlapping object colors.
Returns:
true on success and false otherwise.
virtual bool lti::chrominanceModelEstimator::consider ( const channel8 uChan,
const channel8 vChan,
const bool  trainForeground 
) [virtual]

Consider the chrominances in the supplied channel8.

All histograms are incremented. All histograms will be considered as updated, no matter whether they really did change.

Parameters:
uChan refers to the columns of the histogram.
vChan refers to the rows of the histogram.
trainForeground if true all histogram apart the background are trained. If false the background is trained. If you train more than two models please use the objectTable to distinguish the objects' colors. E.g. the object table provides the rough segmentation, which this class refines. Of course, this method only works for non-overlapping object colors.
Returns:
true on success and false otherwise.
virtual bool lti::chrominanceModelEstimator::consider ( const channel8 uChan,
const channel8 vChan,
const channel8 mask,
const ivector count 
) [virtual]

Consider the chrominances in the supplied channel8.

The mask specifies which histogram is incremented. Usually the background has the index 0. Any pixels that shall not be considered must have a value above or equal to the number of models.

Parameters:
uChan refers to the columns of the histogram.
vChan refers to the rows of the histogram.
mask specifies which models will be updated.
count specifies how the counters will be incremented. The counter determine if a histogram is decayed prior to considering the new values.
Returns:
true on success and false otherwise.
virtual bool lti::chrominanceModelEstimator::consider ( const channel8 uChan,
const channel8 vChan,
const channel8 mask 
) [virtual]

Consider the chrominances in the supplied channel8.

The mask specifies which histogram is incremented. Usually the background has the index 0. Any pixels that shall not be considered must have a value above or equal to the number of models. All histograms will be considered as updated, no matter whether they really did change.

Parameters:
uChan refers to the columns of the histogram.
vChan refers to the rows of the histogram.
mask specifies which models will be updated. Tip: If drawing the mask from object shape keep in mind that drawing rectangles is faster than drawing polygons.
Returns:
true on success and false otherwise.
chrominanceModelEstimator& lti::chrominanceModelEstimator::copy ( const chrominanceModelEstimator other  ) 

Copy data of "other" functor.

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

Reimplemented from lti::statisticsFunctor.

Reimplemented in lti::chrominanceMapEstimator.

bool lti::chrominanceModelEstimator::downsample ( const histogram2D theHisto,
histogram2D destHisto,
const int  factor 
) [protected]

Downsample a histogram.

Parameters:
theHisto a chrominance model.
destHisto scaled chrominance model.
factor the downsampling factor.
Returns:
true on success and false otherwise.
const std::vector<histogram2D>& lti::chrominanceModelEstimator::getChrominanceModels (  )  const

Get the histograms that are build up by this class.

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

Returns used parameters.

Reimplemented from lti::statisticsFunctor.

Reimplemented in lti::chrominanceMapEstimator.

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

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

Reimplemented from lti::statisticsFunctor.

Reimplemented in lti::chrominanceMapEstimator.

parameters& lti::chrominanceModelEstimator::getWritableParameters (  )  [protected]

Returns used parameters.

Reimplemented in lti::chrominanceMapEstimator.

bool lti::chrominanceModelEstimator::increaseCount ( const ivector count  )  [protected]

Increase the count and check decay.

Parameters:
count specifies how the counters will be incremented. The counter determine if a histogram is decayed prior to considering the new values.
Returns:
true on success and false otherwise.
chrominanceModelEstimator& lti::chrominanceModelEstimator::operator= ( const chrominanceModelEstimator other  ) 

Alias for copy member.

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

Reimplemented from lti::functor.

Reimplemented in lti::chrominanceMapEstimator.

bool lti::chrominanceModelEstimator::readChrominanceModels ( const std::string &  prefix,
const std::vector< std::string > &  fileNames 
)

Initialize the chrominance models from disk.

Parameters:
prefix a string containing the path or prefix to the files. If you specify a directory, please do not forget the /. It is not added automatically.
fileNames a vector with the filename for each histogram.
Returns:
true on success and false otherwise.
bool lti::chrominanceModelEstimator::rescale ( const histogram2D theHisto,
histogram2D destHisto,
const int  cellsInDimension 
) [protected]

Rescale a histogram.

Parameters:
theHisto a chrominance model.
destHisto scaled chrominance model.
cellsInDimension the new number of cells.
Returns:
true on success and false otherwise.
bool lti::chrominanceModelEstimator::rescale ( histogram2D theHisto,
const int  cellsInDimension 
) [protected]

Rescale a histogram, i.e.

change it's quantization.

Parameters:
theHisto a chrominance model. The result is left here, too.
cellsInDimension the new number of cells.
Returns:
true on success and false otherwise.
bool lti::chrominanceModelEstimator::scaleValues ( histogram2D theHisto  )  [protected]

Decrease the histogram's entries.

Parameters:
theHisto a chrominance model.
Returns:
true on success and false otherwise.
bool lti::chrominanceModelEstimator::setChrominanceModels ( const std::vector< histogram2D > &  theModels  ) 

Initialize the chrominance models.

Parameters:
theModels the histograms to be copied inside the internal state of the class.
Returns:
true on success and false otherwise.
bool lti::chrominanceModelEstimator::setParameters ( const parameters theParams  )  [virtual]

Set the parameters and ensure validity.

Reimplemented from lti::functor.

Reimplemented in lti::chrominanceMapEstimator.

bool lti::chrominanceModelEstimator::upsample ( const histogram2D theHisto,
histogram2D destHisto,
const int  factor 
) [protected]

Upsample a histogram.

Parameters:
theHisto a chrominance model.
destHisto scaled chrominance model.
factor the upsampling factor.
Returns:
true on success and false otherwise.
bool lti::chrominanceModelEstimator::writeChrominanceModels ( const std::string &  prefix,
const std::vector< std::string > &  fileNames 
) const

Store all chrominance models to disk.

Parameters:
prefix a string containing the path or prefix to the files. If you specify a directory, please do not forget the /. It is not added automatically.
fileNames a vector with the filename for each histogram.
Returns:
true on success and false otherwise.

Member Data Documentation

the 2D histograms of the chrominances

Special care with setParameters during construction.

Historic and complicated code, but it works.

counts calls of consider

maximum number of entries in the histograms that make sense (max.

ubyte)

the scaled number of entries


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

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