C# Класс SimplePaletteQuantizer.Quantizers.MedianCut.MedianCutQuantizer

The premise behind median cut algorithms is to have every entry in the color map represent the same number of pixels in the original image. In contrast to uniform sub-division, these algorithms divide the color space based on the distribution of the original colors. The process is as follows[2]: 1. Find the smallest box which contains all the colors in the image. 2. Sort the enclosed colors along the longest axis of the box. 3. Split the box into 2 regions at median of the sorted list. 4. Repeat the above process until the original color space has been divided into 256 regions. 5. The algorithm then divides the color space in a manner depicted below. 6. The representative colors are found by averaging the colors in each box, and the appropriate color map index assigned to each color in that box. Because these algorithms use image information in dividing the color space this class of algorithms consistently produce good results while having memory and time complexity no worse than popularity algorithms[1].
Наследование: BaseColorCacheQuantizer
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
GetPaletteIndex ( Color color, Int32 &paletteIndex ) : void

See IColorQuantizer.GetPaletteIndex for more details.

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

Метод Описание
OnCreateDefaultCache ( ) : IColorCache

See BaseColorCacheQuantizer.OnCreateDefaultCache for more details.

OnFinish ( ) : void

See BaseColorQuantizer.OnFinish for more details.

OnGetPaletteToCache ( Int32 colorCount ) : List

See BaseColorCacheQuantizer.OnGetPaletteToCache for more details.

OnPrepare ( ImageBuffer image ) : void

See IColorQuantizer.Prepare for more details.

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

Метод Описание
SplitCubes ( Int32 colorCount ) : void

Splits all the cubes on the list.

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

GetPaletteIndex() публичный Метод

See IColorQuantizer.GetPaletteIndex for more details.
public GetPaletteIndex ( Color color, Int32 &paletteIndex ) : void
color Color
paletteIndex System.Int32
Результат void

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

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

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

See BaseColorQuantizer.OnFinish for more details.
protected OnFinish ( ) : void
Результат void

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

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

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

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