last update 20 Sep 2009 |
#include <cvrKMColorQuantization.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 |
virtual const std::string & | name () const |
kMColorQuantization & | copy (const kMColorQuantization &other) |
virtual kMColorQuantization * | clone () const |
virtual kMColorQuantization * | newInstance () 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 |
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.
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.
Quantize the colors of the given src image and leave the result in dest.
src | image with the source data. | |
dest | image with only the number of colors specified in the parameters |
Reimplemented from cvr::colorQuantization.
virtual bool cvr::kMColorQuantization::apply | ( | image & | srcdest | ) | const [virtual] |
Quantize the colors of the given image.
srcdest | image with the source data. The result will be left here too. |
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.
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 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.
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 cvr::colorQuantization.
virtual kMColorQuantization* cvr::kMColorQuantization::clone | ( | ) | const [virtual] |
kMColorQuantization& cvr::kMColorQuantization::copy | ( | const kMColorQuantization & | other | ) |
const parameters& cvr::kMColorQuantization::getParameters | ( | ) | const |
virtual const std::string& cvr::kMColorQuantization::name | ( | ) | const [virtual] |
virtual kMColorQuantization* cvr::kMColorQuantization::newInstance | ( | ) | const [virtual] |