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

lti::overlappingSets2D Class Reference

Considering 2d sets, which may overlap, one might ask in which sets a particular 2d point is contained. More...

#include <ltiOverlappingSets2D.h>

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

List of all members.

Classes

class  parameters
 The parameters for the class overlappingSets2D. More...

Public Member Functions

 overlappingSets2D ()
 overlappingSets2D (const parameters &par)
 overlappingSets2D (const overlappingSets2D &other)
virtual ~overlappingSets2D ()
virtual const char * getTypeName () const
overlappingSets2Dcopy (const overlappingSets2D &other)
overlappingSets2Doperator= (const overlappingSets2D &other)
virtual functorclone () const
const parametersgetParameters () const
bool setParameters (const parameters &theParams)
bool readObjectTable (const std::string &prefix, const std::vector< std::string > &names)
bool setObjectTable (const std::vector< channel8 > &src)
bool setObjectTable (const std::vector< image > &src)
const imatrixgetObjectTable () const
bool isContained (int label, int u, int v) const
bool doDiscard (int u, int v) const
bool isInitialized () const
bool apply (int label, int u, int v, bool &isContained) const
bool apply (int u, int v, bool &doDiscard) const

Protected Member Functions

bool initObjectTable (const std::vector< channel8 > &src)
bool scale (const channel8 &src, channel8 &dest) const
bool scale (channel8 &src) const
bool resize ()

Protected Attributes

imatrix m_objectTable
std::vector< int > m_id
int m_discardThreshold

Detailed Description

Considering 2d sets, which may overlap, one might ask in which sets a particular 2d point is contained.

This class creates a single 2d look up table (LUT), which stores the ids of all sets that cover a particular position. This is useful to exclude any other set from further processing. For example an image contains several objects and each object has certain 2d features, which are known a priori. If a specific feature is extracted, an application would only process the objects which contain the feature. The classes for estimating chrominance models use this framework for robustness and run time efficiency. If it is known that an object is red then only red chrominances are processed.

The LUT entry is coded in an additive manner. E.g. for a total of three sets the LUT will contain values from 0 to 7. If a position is covered by no set, the LUT contains a 0. If a position is contained in all sets the LUT's entry is 7. If a position is contained in the first and third set the LUT returns 3. If a position is contained in the third set only the LUT contains 4.

The maximum number of sets is limited by the capacity of the data type int. Caution, this class is only efficient if a few sets overlap.

See also:
chrominanceMapEstimator, chrominanceModelEstimator

Constructor & Destructor Documentation

lti::overlappingSets2D::overlappingSets2D (  ) 

Default constructor.

lti::overlappingSets2D::overlappingSets2D ( const parameters par  ) 

Construct a functor using the given parameters.

lti::overlappingSets2D::overlappingSets2D ( const overlappingSets2D other  ) 

Copy constructor.

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

Destructor.


Member Function Documentation

bool lti::overlappingSets2D::apply ( int  u,
int  v,
bool &  doDiscard 
) const

Checks if position (u,v) is not contained in any set, whose internal id is above the discard threshold.

Parameters:
u the column of the LUT.
v the row of the LUT.
doDiscard true if (u,v) is not contained in any set and false otherwise.
Returns:
true on success and false otherwise.
bool lti::overlappingSets2D::apply ( int  label,
int  u,
int  v,
bool &  isContained 
) const

Checks if position (u,v) is contained in the set associated with the provided label.

Parameters:
label the label of the set, which starts from 0. Please note that the label and the internal id are not identical.
u the column of the LUT.
v the row of the LUT.
isContained true if (u,v) is contained in the set and false otherwise.
Returns:
true on success and false otherwise.
virtual functor* lti::overlappingSets2D::clone (  )  const [virtual]

Returns a pointer to a clone of this functor.

Implements lti::functor.

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

Copy data of "other" functor.

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

Reimplemented from lti::functor.

bool lti::overlappingSets2D::doDiscard ( int  u,
int  v 
) const [inline]

Returns true if position (u,v) is not contained in any set, whose internal id is above the discard threshold.

Fast access which does not check if the LUT is initialized.

Parameters:
u the column of the LUT.
v the row of the LUT.
Returns:
true if position (u,v) is not contained in any set.

References lti::genericMatrix< T >::at(), m_discardThreshold, and m_objectTable.

const imatrix& lti::overlappingSets2D::getObjectTable (  )  const

Returns the LUT with the overlapping sets.

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

Returns used parameters.

Reimplemented from lti::functor.

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

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

Reimplemented from lti::functor.

bool lti::overlappingSets2D::initObjectTable ( const std::vector< channel8 > &  src  )  [protected]

Initialize the LUT with overlapping sets coded as channel8.

Regions that are contained in a set must have values above 0.

Parameters:
src a vector containing one channel8 for each set. The internal set ids correspond with the order of this vector, but start from 1.
Returns:
true on success and false otherwise.
bool lti::overlappingSets2D::isContained ( int  label,
int  u,
int  v 
) const [inline]

Returns true if position (u,v) is contained in the set associated with the provided label.

Fast access which does not check if the LUT is initialized.

Parameters:
label the label of the set, which starts from 0. Please note that the label and the internal id are not identical.
u the column of the LUT.
v the row of the LUT.
Returns:
true if position (u,v) is contained.

References lti::genericMatrix< T >::at(), m_id, and m_objectTable.

bool lti::overlappingSets2D::isInitialized (  )  const

Checks if the LUT for the overlapping sets is initialized.

Returns:
true on success and false otherwise.
overlappingSets2D& lti::overlappingSets2D::operator= ( const overlappingSets2D other  ) 

Alias for copy member.

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

Reimplemented from lti::functor.

bool lti::overlappingSets2D::readObjectTable ( const std::string &  prefix,
const std::vector< std::string > &  names 
)

Initialize the LUT with the overlapping sets from disk.

Each set is interpreted as an image and loaded accordingly. Regions that are contained in a set must have intensities above 0.

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.
names a vector with the filename of each image or set. The internal set ids correspond with the order of this vector, but start from 1.
Returns:
true on success and false otherwise.
bool lti::overlappingSets2D::resize (  )  [protected]

Adjust the size of the internal LUT to fit the parameters.

The LUT will be scaled using nearest neighbor interpolation.

bool lti::overlappingSets2D::scale ( channel8 src  )  const [protected]

Scale a channel8 to match the LUT size specified in the parameters.

Parameters:
src channel8 to be scaled. The result is left here too.
Returns:
true on success and false otherwise.
bool lti::overlappingSets2D::scale ( const channel8 src,
channel8 dest 
) const [protected]

Scale a channel8 to match the LUT size specified in the parameters.

Parameters:
src original channel8.
dest scaled channel8.
Returns:
true on success and false otherwise.
bool lti::overlappingSets2D::setObjectTable ( const std::vector< image > &  src  ) 

Initialize the LUT with overlapping sets coded as channel8.

Regions that are contained in a set must have intensities above 0.

Parameters:
src a vector containing one image for each set. The internal set ids correspond with the order of this vector, but start from 1.
Returns:
true on success and false otherwise.
bool lti::overlappingSets2D::setObjectTable ( const std::vector< channel8 > &  src  ) 

Initialize the LUT with overlapping sets coded as channel8.

Regions that are contained in a set must have values above 0.

Parameters:
src a vector containing one channel8 for each set. The internal set ids correspond with the order of this vector, but start from 1.
Returns:
true on success and false otherwise.
bool lti::overlappingSets2D::setParameters ( const parameters theParams  )  [virtual]

Set used parameters.

Reimplemented from lti::functor.


Member Data Documentation

A copy of the discardThreshold in the parameters.

This is here for efficiency.

Referenced by doDiscard().

std::vector<int> lti::overlappingSets2D::m_id [protected]

A table which stores the id which is associated with each label, defined by id = 2 power label.

Referenced by isContained().

The LUT with the overlapping sets.

Referenced by doDiscard(), and isContained().


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

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