C# Class SimplePaletteQuantizer.Quantizers.Uniform.UniformQuantizer

In uniform quantization each axis of the color space is treated independently. Each axis is then divided into equal sized segments. The planes perpendicular to the axis' that pass through the division points then define regions in the color space. The number of these regions is dependent on the scheme used for dividing the color space. One possible scheme is to divide the red and green axis into 8 segments each and the blue axis into 4 resulting in 256 regions. Another possibility is dividing the red and blue into 6 and the green into 7 segments resulting in 252 regions [3]. Each one of these regions will produce a color for the color map. Once the color space has been divided each of the original colors is then mapped to the region which it falls in. The representative colors for each region is then the average of all the colors mapped to that region. Because each of the regions represents an entry in the color map, the same process for mapping the original colors to a region can be repeated for mapping the original colors to colors in the color map. While this algorithm is quick and easy to implement it does not yield very good results. Often region in the color space will not have any colors mapped to them resulting in color map entries to be wasted. This algorithm can also be applied in a non-uniform manner if the axis are broken on a logarithmic scale instead of linear. This will produce slightly better results because the human eye cannot distinguish dark colors as well as bright ones.
Inheritance: BaseColorQuantizer
Afficher le fichier Open project: RHY3756547/FreeSO

Méthodes protégées

Méthode Description
OnAddColor ( Color color, Int32 key, Int32 x, Int32 y ) : void

See BaseColorQuantizer.AddColor for more details.

OnGetPalette ( Int32 colorCount ) : List

See BaseColorQuantizer.OnGetPalette for more details.

OnGetPaletteIndex ( Color color, Int32 key, Int32 x, Int32 y, Int32 &paletteIndex ) : void

See BaseColorQuantizer.OnGetPaletteIndex for more details.

OnPrepare ( ImageBuffer image ) : void

See BaseColorQuantizer.OnPrepare for more details.

Method Details

OnAddColor() protected méthode

See BaseColorQuantizer.AddColor for more details.
protected OnAddColor ( Color color, Int32 key, Int32 x, Int32 y ) : void
color Color
key System.Int32
x System.Int32
y System.Int32
Résultat void

OnGetPalette() protected méthode

See BaseColorQuantizer.OnGetPalette for more details.
protected OnGetPalette ( Int32 colorCount ) : List
colorCount System.Int32
Résultat List

OnGetPaletteIndex() protected méthode

See BaseColorQuantizer.OnGetPaletteIndex for more details.
protected OnGetPaletteIndex ( Color color, Int32 key, Int32 x, Int32 y, Int32 &paletteIndex ) : void
color Color
key System.Int32
x System.Int32
y System.Int32
paletteIndex System.Int32
Résultat void

OnPrepare() protected méthode

See BaseColorQuantizer.OnPrepare for more details.
protected OnPrepare ( ImageBuffer image ) : void
image SimplePaletteQuantizer.Helpers.ImageBuffer
Résultat void