Documentation
¶
Index ¶
- func QuantizeWu(input []color.ARGB, maxColor int) []color.ARGB
- func QuantizeWuContext(ctx context.Context, input []color.ARGB, maxColor int) ([]color.ARGB, error)
- type QuantizedMap
- func QuantizeCelebi(input []color.ARGB, maxColor int) QuantizedMap
- func QuantizeCelebiContext(ctx context.Context, input []color.ARGB, maxColor int) (QuantizedMap, error)
- func QuantizeMap(input []color.ARGB) QuantizedMap
- func QuantizeWsMeans(input []color.ARGB, startingClusters []color.Lab, maxColors int) QuantizedMap
- func QuantizeWsMeansContext(ctx context.Context, input []color.ARGB, startingClusters []color.Lab, ...) (QuantizedMap, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func QuantizeWu ¶
QuantizeWu is an image quantizer that divides the image's pixels into clusters by recursively cutting an RGB cube, based on the weight of pixels in each area of the cube.
The algorithm was described by Xiaolin Wu in Graphic Gems II, published in 1991.
Types ¶
type QuantizedMap ¶
QuantizedMap is a map where ARGB is key and their frequencies as int
func QuantizeCelebi ¶
func QuantizeCelebi(input []color.ARGB, maxColor int) QuantizedMap
QuantizeCelebi is 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
func QuantizeCelebiContext ¶
func QuantizeCelebiContext( ctx context.Context, input []color.ARGB, maxColor int, ) (QuantizedMap, error)
QuantizeCelebiContext is QuantizeCelebi with context.Context support. Returns ctx.Err() if context is Done.
func QuantizeMap ¶
func QuantizeMap(input []color.ARGB) QuantizedMap
QuantizeMap takes a slice of []color.Color and returns Quantized
func QuantizeWsMeans ¶
func QuantizeWsMeans( input []color.ARGB, startingClusters []color.Lab, maxColors int, ) QuantizedMap
QuantizeWsMeans is an image quantizer that improves on the speed of a standard K-Means algorithm by implementing several optimizations, including deduping identical pixels and a triangle inequality rule that reduces the number of comparisons needed to identify which cluster a point should be moved to.
Wsmeans stands for Weighted Square Means.
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