CVR-Lib last update 20 Sep 2009

cvr::kMColorQuantization Class Reference
[Color Quantization]

k-Means based color quantization. More...

#include <cvrKMColorQuantization.h>

Inheritance diagram for cvr::kMColorQuantization:

Inheritance graph
[legend]
Collaboration diagram for cvr::kMColorQuantization:

Collaboration graph
[legend]

List of all members.

Classes

class  parameters
 the parameters for the class kMColorQuantization More...

Public Member Functions

 kMColorQuantization ()
 kMColorQuantization (const parameters &par)
 kMColorQuantization (const kMColorQuantization &other)
virtual ~kMColorQuantization ()
const parametersgetParameters () const
virtual const std::string & name () const
kMColorQuantizationcopy (const kMColorQuantization &other)
virtual kMColorQuantizationclone () const
virtual kMColorQuantizationnewInstance () const
virtual bool apply (const image &src, matrix< ubyte > &dest, palette &thePalette) const
virtual bool apply (const image &src, matrix< int > &dest, palette &thePalette) const
virtual bool apply (image &srcdest) const
virtual bool apply (const image &src, image &dest) const


Detailed Description

k-Means based color quantization.

This functor calculates (using k-Means) an optimal color subpalette for the input image. The maximal number of colors to be used is given through the parameters (inherited from colorQuantization::parameters).

If the real number of colors used in the image is less than the desired number of quantized colors, no quantization is done and the output palette will contain all image colors, i.e. it will be smaller that the expected size of parameters::numberOfColors.


Constructor & Destructor Documentation

cvr::kMColorQuantization::kMColorQuantization (  ) 

Default constructor.

cvr::kMColorQuantization::kMColorQuantization ( const parameters par  ) 

Constructor with parameters.

cvr::kMColorQuantization::kMColorQuantization ( const kMColorQuantization other  ) 

Copy constructor.

virtual cvr::kMColorQuantization::~kMColorQuantization (  )  [virtual]

Destructor.


Member Function Documentation

virtual bool cvr::kMColorQuantization::apply ( const image src,
image dest 
) const [virtual]

Quantize the colors of the given src image and leave the result in dest.

Parameters:
src image with the source data.
dest image with only the number of colors specified in the parameters
Returns:
true if apply successful or false otherwise.

Reimplemented from cvr::colorQuantization.

virtual bool cvr::kMColorQuantization::apply ( image srcdest  )  const [virtual]

Quantize the colors of the given image.

Parameters:
srcdest image with the source data. The result will be left here too.
Returns:
true if apply successful or false otherwise.

Reimplemented from cvr::colorQuantization.

virtual bool cvr::kMColorQuantization::apply ( const image src,
matrix< int > &  dest,
palette thePalette 
) const [virtual]

Quantize the colors of src and leave the labels for the quantized colors in dest, and in the palette entries corresponding to the labels the mean colors for each label.

Parameters:
src Original image with the true-color data
dest matrix<int> where the indexes of the calculated palette will be.
thePalette The color palette used by the matrix. If it is not empty, it will be taken as a InitPalette for the computation of the new one.
Returns:
true if apply successful or false otherwise.

virtual bool cvr::kMColorQuantization::apply ( const image src,
matrix< ubyte > &  dest,
palette thePalette 
) const [virtual]

Quantize the colors of src and leave the labels for the quantized colors in dest, and in the palette entries corresponding to the labels the mean colors for each label.

Parameters:
src Original image with the true-color data
dest channel8 where the indexes of the also calculated palette will be.
thePalette the color palette used by the channel. If it is not empty, it will be taken as a InitPalette for the computation of the new one.
Returns:
true if apply successful or false otherwise.

Implements cvr::colorQuantization.

virtual kMColorQuantization* cvr::kMColorQuantization::clone (  )  const [virtual]

Returns a pointer to a clone of this functor.

Implements cvr::colorQuantization.

kMColorQuantization& cvr::kMColorQuantization::copy ( const kMColorQuantization other  ) 

Copy data of "other" functor.

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

const parameters& cvr::kMColorQuantization::getParameters (  )  const

Returns current parameters.

Reimplemented from cvr::colorQuantization.

virtual const std::string& cvr::kMColorQuantization::name (  )  const [virtual]

Returns the name of this type.

Reimplemented from cvr::colorQuantization.

virtual kMColorQuantization* cvr::kMColorQuantization::newInstance (  )  const [virtual]

Returns a pointer to a clone of this functor.

Implements cvr::colorQuantization.


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

Generated on Sun Sep 20 22:08:47 2009 for CVR-Lib by Doxygen 1.5.8