QuantizerCelebi

An image quantizer that improves on the quality of a standard K-Means algorithm by setting the K-Means initial state to the output of a Wu quantizer, instead of random centroids. Improves on speed by several optimizations, as implemented in Wsmeans, or Weighted Square Means, K-Means with those optimizations.

This algorithm was designed by M. Emre Celebi, and was found in their 2011 paper, Improving the Performance of K-Means for Color Quantization. https://arxiv.org/abs/1101.0395

Functions

Link copied to clipboard
fun quantize(pixels: IntArray, maxColors: Int): Map<Int, Int>

Reduce the number of colors needed to represented the input, minimizing the difference between the original image and the recolored image.