C# Класс SimplePaletteQuantizer.Quantizers.Popularity.PopularityQuantizer

Popularity algorithms are another form of uniform quantization. However, instead of dividing the color space into 256 regions these algorithms break the color space into much smaller, and consequently many more, regions. One possible implementation is to divide the space into regions 4x4x4 in size (262,144 regions). The original colors are again mapped to the region they fall in. The representative color for each region is the average of the colors mapped to it. The color map is selected by taking the representative colors of the 256 most popular regions (the regions that had the most colors mapped to them). If a non-empty region is not selected for the color map its index into the color map (the index that will be assigned to colors that map to that region) is then the entry in the color map that is closest (Euclidean distance) to its representative color). These algorithms are also easy to implement and yield better results than the uniform quantization algorithm. They do, however, take slightly longer to execute and can have a significantly larger storage requirement depending on the size of regions. Also depending on the image characteristics this may not produce a good result. This can be said about all uniform sub-division schemes, because the method for dividing the color space does utilize any information about the image.
Наследование: BaseColorCacheQuantizer
Показать файл Открыть проект

Защищенные методы

Метод Описание
OnAddColor ( Color color, Int32 key, Int32 x, Int32 y ) : void

See BaseColorQuantizer.OnAddColor for more details.

OnCreateDefaultCache ( ) : IColorCache

See BaseColorCacheQuantizer.OnCreateDefaultCache for more details.

OnGetPaletteToCache ( Int32 colorCount ) : List

See BaseColorCacheQuantizer.OnGetPaletteToCache for more details.

OnPrepare ( ImageBuffer image ) : void

See BaseColorQuantizer.OnPrepare for more details.

Приватные методы

Метод Описание
GetColorIndex ( Color color ) : Int32

Описание методов

OnAddColor() защищенный Метод

See BaseColorQuantizer.OnAddColor 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
Результат void

OnCreateDefaultCache() защищенный Метод

See BaseColorCacheQuantizer.OnCreateDefaultCache for more details.
protected OnCreateDefaultCache ( ) : IColorCache
Результат IColorCache

OnGetPaletteToCache() защищенный Метод

See BaseColorCacheQuantizer.OnGetPaletteToCache for more details.
protected OnGetPaletteToCache ( Int32 colorCount ) : List
colorCount System.Int32
Результат List

OnPrepare() защищенный Метод

See BaseColorQuantizer.OnPrepare for more details.
protected OnPrepare ( ImageBuffer image ) : void
image SimplePaletteQuantizer.Helpers.ImageBuffer
Результат void