quantize method
Reduce the number of colors needed to represented the input, minimizing the difference between the original image and the recolored image.
Returns a Map with keys of colors in ARGB format, and values of number of pixels in the original image that correspond to the color in the quantized image.
Implementation
@override
QuantizerResult quantize(
List<int> pixels,
int maxColors, {
bool returnInputPixelToClusterPixel = false,
}) {
final wu = QuantizerWu();
final wuResult = wu.quantize(pixels, maxColors);
final wsmeansResult = const QuantizerWsmeans().quantize(
pixels,
maxColors,
startingClusters: wuResult.colorToCount.keys.toList(),
pointProvider: const PointProviderLab(),
returnInputPixelToClusterPixel: returnInputPixelToClusterPixel,
);
return wsmeansResult;
}