Module wu

Source
Expand description

Wu’s color quantizer (Greedy Orthogonal Bipartitioning).

This preclustering method recursively splits the histogram box with the greatest variance along the dimension and bin that results in the greatest decrease in variance. It should give much better results than median cut while having nearly the same computational cost.

A binner with 32 bins (B = 32) is a good compromise between speed and accuracy. If the PaletteSize is small, less bins can be used without sacrificing accuracy too much. Otherwise, use more bins (e.g., 64) if you want greater accuracy.

Structs§

FloatBinner
A binner for colors with components that are floating point types.
UIntBinner
A binner for colors with components that are unsigned integer types.

Traits§

Binner3
An interface for taking colors with 3 components and returning a 3-dimensional histogram bin index.

Functions§

indexed_palette
Computes a color palette from the given color_counts with at most palette_size entries and using the given binner. The returned QuantizeOutput will have its indices populated.
indexed_palette_par
Computes a color palette in parallel from the given color_counts with at most palette_size entries and using the given binner. The returned QuantizeOutput will have its indices populated.
palette
Computes a color palette from the given color_counts with at most palette_size entries and using the given binner.
palette_par
Computes a color palette in parallel from the given color_counts with at most palette_size entries and using the given binner.