latest version v1.9 - last update 10 Apr 2010 |
k-Means based color quantization. More...
#include <ltiKMColorQuantization.h>
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 parameters & | getParameters () const |
kMColorQuantization & | copy (const kMColorQuantization &other) |
virtual functor * | clone () const |
virtual const char * | getTypeName () const |
bool | apply (const image &src, matrix< int > &dest, palette &thePalette) const |
bool | apply (const image &src, channel8 &dest, palette &thePalette) const |
bool | apply (image &srcdest) const |
bool | apply (const image &src, image &dest) const |
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.
lti::kMColorQuantization::kMColorQuantization | ( | ) |
default constructor
lti::kMColorQuantization::kMColorQuantization | ( | const parameters & | par | ) |
default constructor
lti::kMColorQuantization::kMColorQuantization | ( | const kMColorQuantization & | other | ) |
copy constructor
virtual lti::kMColorQuantization::~kMColorQuantization | ( | ) | [virtual] |
destructor
Operates on the given parameter.
src | image with the source data. | |
dest | image with only the number of colors specified in the parameters |
Reimplemented from lti::colorQuantization.
bool lti::kMColorQuantization::apply | ( | image & | srcdest | ) | const [virtual] |
Operates on the given parameter.
srcdest | image with the source data. The result will be left here too. |
Reimplemented from lti::colorQuantization.
bool lti::kMColorQuantization::apply | ( | const image & | src, | |
channel8 & | dest, | |||
palette & | thePalette | |||
) | const [virtual] |
Apply.
Operates on a copy of the given 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. |
Implements lti::colorQuantization.
bool lti::kMColorQuantization::apply | ( | const image & | src, | |
matrix< int > & | dest, | |||
palette & | thePalette | |||
) | const |
Apply.
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. |
virtual functor* lti::kMColorQuantization::clone | ( | ) | const [virtual] |
returns a pointer to a clone of the functor.
Implements lti::colorQuantization.
kMColorQuantization& lti::kMColorQuantization::copy | ( | const kMColorQuantization & | other | ) |
copy data of "other" functor.
Reimplemented from lti::colorQuantization.
const parameters& lti::kMColorQuantization::getParameters | ( | ) | const |
returns current parameters.
Reimplemented from lti::colorQuantization.
virtual const char* lti::kMColorQuantization::getTypeName | ( | ) | const [virtual] |
returns the name of this type
Reimplemented from lti::colorQuantization.