C# Класс Accord.Imaging.ColorReduction.MedianCutQuantizer

Median cut color quantization algorithm.

The class implements median cut color quantization algorithm.

See also ColorImageQuantizer class, which may simplify processing of images.

Sample usage:

// create the color quantization algorithm IColorQuantizer quantizer = new MedianCutQuantizer( ); // process colors (taken from image for example) for ( int i = 0; i < pixelsToProcess; i++ ) { quantizer.AddColor( /* pixel color */ ); } // get palette reduced to 16 colors Color[] palette = quantizer.GetPalette( 16 );
Наследование: IColorQuantizer
Показать файл Открыть проект

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

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

Add color to the list of processed colors.

The method adds the specified color into internal list of processed colors. The list is used later by GetPalette method to build reduced color table of the specified size.

Clear ( ) : void

Clear internal state of the color quantization algorithm by clearing the list of colors so far processed.

GetPalette ( int colorCount ) : Color[]

Get paletter of the specified size.

The method must be called after continuously calling AddColor method and returns reduced color palette for colors accumulated/processed so far.

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

Метод Описание
SplitCubes ( List cubes, int count ) : void

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

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

Add color to the list of processed colors.

The method adds the specified color into internal list of processed colors. The list is used later by GetPalette method to build reduced color table of the specified size.

public AddColor ( Color color ) : void
color Color Color to add to the internal list.
Результат void

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

Clear internal state of the color quantization algorithm by clearing the list of colors so far processed.
public Clear ( ) : void
Результат void

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

Get paletter of the specified size.

The method must be called after continuously calling AddColor method and returns reduced color palette for colors accumulated/processed so far.

public GetPalette ( int colorCount ) : Color[]
colorCount int Palette size to get.
Результат Color[]