PANDORE Version 6 | GREYC-IMAGE |
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.
Returns the number of colors used or FAILURE.
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
Author: Luc Brun