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

lti::colorACASegmentation Class Reference

Color Adaptive Clustering Algorithm. More...

#include <ltiColorACASegmentation.h>

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

List of all members.

Classes

class  parameters
 The parameters for the class colorACASegmentation. More...

Public Member Functions

 colorACASegmentation ()
 colorACASegmentation (const parameters &par)
 colorACASegmentation (const colorACASegmentation &other)
virtual ~colorACASegmentation ()
virtual const char * getTypeName () const
bool apply (image &srcdest) const
bool apply (const image &src, image &dest) const
bool apply (const image &src, imatrix &mask, image &means) const
bool apply (const image &src, imatrix &mask) const
colorACASegmentationcopy (const colorACASegmentation &other)
colorACASegmentationoperator= (const colorACASegmentation &other)
virtual functorclone () const
const parametersgetParameters () const
bool setParameters (const functor::parameters &param)

Protected Member Functions

bool aca (const image &src, imatrix &mask, image &means, const bool computeMeans) const
bool kMeansInit (const image &src, imatrix &mask) const
bool estimateMeans (const image &src, const imatrix &mask, std::vector< image > &means, const int windowSize, const int gridSize, const int tMin) const
bool interpolate (image &src, const int gridSize) const
bool estimateSegmentation (const image &src, const std::vector< image > &means, const float gfactor, imatrix &mask, int &cycles) const
int computeLabel (const image &src, const std::vector< image > &means, const imatrix &mask, const point &p, const int from, const int to, const float gfactor, int &numChanges) const
bool estimateSegmentationStep (const image &src, const std::vector< image > &means, const float gfactor, imatrix &mask, imatrix &nmask, int &numChanges) const
bool createMeanImage (const std::vector< image > &lmeans, const imatrix mask, image &means) const

Detailed Description

Color Adaptive Clustering Algorithm.

This functor provides a segmentation algorithm based on the Adaptive Clustering Algorithm (ACA) proposed by Thrasyvoulos N. Pappas in his paper "An adaptive clustering algorithm for image segmentation", IEEE Transactions on signal processing, vol. 40, No. 4, april 1992.

Even if in the original version the algorithm has been applied to gray valued images, the current implementation has been adapted for the segmentation of color images.

The algorithm first generates an image pyramid for the input. For the smallest image a k-Means color clustering is done, and a labeling procedure assigns to each pixel the corresponding label.

Using this first segmentation proposal and the current window size (initially the whole image) it generates a new estimation of the expected mean values for each pixel. With the new mean values compute the a-posteriori probabilities for each pixel to belong to any of the classes and compute with them a new segmentation hypothesis.

Repeat the estimation of the expected values and the new segmentation until the algorithm converges or only a small number of changes has been done in the last iteration.

Reduce the window size and begin the iterations again, until the minimum window size is reached.

Now duplicate the size of the segmentation result and use it as initialization for the next iteration using the next pyramid level.

The whole process is repeated until the highest resolution level has been analyzed.

Note that this algorithm is very slow. It is implemented to provide a comparison possibility with your own algorithms.


Constructor & Destructor Documentation

lti::colorACASegmentation::colorACASegmentation (  ) 

Default constructor.

lti::colorACASegmentation::colorACASegmentation ( const parameters par  ) 

Construct a functor using the given parameters.

lti::colorACASegmentation::colorACASegmentation ( const colorACASegmentation other  ) 

Copy constructor.

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

Destructor.


Member Function Documentation

bool lti::colorACASegmentation::aca ( const image src,
imatrix mask,
image means,
const bool  computeMeans 
) const [protected]

Segmentates the image and computes the labeled mask, with labels between 0 and parameters::kMeansParam::numberOfColors - 1.

Additionally, the estimated mean values will be computed.

Note that the result differs from other segmentation approaches in the fact that the functor doesn't compute a palette, since the values within a region are allowed to slowly change.

Parameters:
src image with the source data
mask imatrix with the labels for each region
means image with the estimated mean values per pixel.
computeMeans compute image with means
Returns:
true if successful, false otherwise.
bool lti::colorACASegmentation::apply ( const image src,
imatrix mask 
) const

Segmentates the image and computes the labeled mask, with labels between 0 and parameters::kMeansParam::numberOfColors - 1.

Additionally, the estimated mean values will be computed.

Note that the result differs from other segmentation approaches in the fact that the functor doesn't compute a palette, since the values within a region are allowed to slowly change.

Parameters:
src image with the source data
mask imatrix with the labels for each region
bool lti::colorACASegmentation::apply ( const image src,
imatrix mask,
image means 
) const

Segmentates the image and computes the labeled mask, with labels between 0 and parameters::kMeansParam::numberOfColors - 1.

Additionally, the estimated mean values will be computed.

Note that the result differs from other segmentation approaches in the fact that the functor doesn't compute a palette, since the values within a region are allowed to slowly change.

Parameters:
src image with the source data
mask imatrix with the labels for each region
means image with the estimated mean values per pixel.
bool lti::colorACASegmentation::apply ( const image src,
image dest 
) const

Segmentates the image src and compute the estimated mean values.

Parameters:
src image with the source data.
dest image with the smooth changing means per region.
Returns:
true if apply successful or false otherwise.
bool lti::colorACASegmentation::apply ( image srcdest  )  const

Segmentates the srcdest image and replaces it with the estimated mean values.

Parameters:
srcdest image with the source data. The result will be left here too.
Returns:
true if apply successful or false otherwise.
virtual functor* lti::colorACASegmentation::clone (  )  const [virtual]

Returns a pointer to a clone of this functor.

Reimplemented from lti::segmentation.

int lti::colorACASegmentation::computeLabel ( const image src,
const std::vector< image > &  means,
const imatrix mask,
const point p,
const int  from,
const int  to,
const float  gfactor,
int &  numChanges 
) const [inline, protected]

Compute label.

Parameters:
src original image
means the mean values for each label
mask initial segmentation
p point to be evaluated
from which neighbor should be considered first
to which neighbor should be considered last
gfactor must be -1/2*sigma^2
numChanges number of changes taken in the iteration.
Returns:
label that maximizes the a posteriori probability
colorACASegmentation& lti::colorACASegmentation::copy ( const colorACASegmentation other  ) 

Copy data of "other" functor.

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

Reimplemented from lti::segmentation.

bool lti::colorACASegmentation::createMeanImage ( const std::vector< image > &  lmeans,
const imatrix  mask,
image means 
) const [protected]

Create an image containing the appropriate mean values.

bool lti::colorACASegmentation::estimateMeans ( const image src,
const imatrix mask,
std::vector< image > &  means,
const int  windowSize,
const int  gridSize,
const int  tMin 
) const [protected]

Estimates the means channel using linear interpolation of the support points at the grid, using a window of the given size.

The means image vector must have the proper size when initialized: parameters::kMeansParam::numberOfColors

bool lti::colorACASegmentation::estimateSegmentation ( const image src,
const std::vector< image > &  means,
const float  gfactor,
imatrix mask,
int &  cycles 
) const [protected]

Estimate segmentation given the means.

bool lti::colorACASegmentation::estimateSegmentationStep ( const image src,
const std::vector< image > &  means,
const float  gfactor,
imatrix mask,
imatrix nmask,
int &  numChanges 
) const [protected]

Estimate segmentation given the means.

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

Returns used parameters.

Reimplemented from lti::functor.

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

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

Reimplemented from lti::segmentation.

bool lti::colorACASegmentation::interpolate ( image src,
const int  gridSize 
) const [protected]

Interpolate all pixels not at the grid points using bilinear interpolation.

bool lti::colorACASegmentation::kMeansInit ( const image src,
imatrix mask 
) const [protected]

Initialize the segmentation using k-Means.

The argument mask represents the variable x in the original paper

colorACASegmentation& lti::colorACASegmentation::operator= ( const colorACASegmentation 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::colorACASegmentation::setParameters ( const functor::parameters param  )  [virtual]

Set the parameters.

Reimplemented from lti::functor.


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

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