PANDORE Version 6 GREYC-IMAGE

pcolorquantization



Reduction of the number of colors used to encode an image.



Synopsis

pcolorquantization color_number color_space [-m mask] [im_in|-] [im_out|-]

Description

Color quantization aims to reduce the number of color used to encode the color image im_in so as to minimize the visual sensation difference. The output image im_out is a color image with the specified number of colors or less.

The algorithm is based on the minimization of the global quadratic error after reassignment of the colors:

Error = sum_{ij} ||c(i,j) - c'(i,j)||^2

where c(i,j) is the color of the pixel (i,j) in the original image and c'(i,j) is the color of quantized image. Pixel color depends on the color space.

This operator is often used as preprocessing before segmentation.

Parameters

Inputs

Outputs

Result

Returns the number of colors used or FAILURE.

Examples

Reduce to 10 the number of colors used by the image butterfly and extract the regions:

   pcolorquantization 10 0 examples/butterfly.pan b.pan
   pim2rg bpan out.pan

See also

Segmentation

C++ prototype

Errc PColorQuantization( const Img2duc &im_in1, const Img2duc &im_in2, Img2duc &im_out, int colorNumber, int colorSpace );

Author: Luc Brun