C# Class 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].
Inheritance: BaseColorCacheQuantizer
Mostra file Open project: RHY3756547/FreeSO Class Usage Examples

Public Methods

Method Description
GetPaletteIndex ( Color color, Int32 &paletteIndex ) : void

See IColorQuantizer.GetPaletteIndex for more details.

Protected Methods

Method Description
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.

Private Methods

Method Description
SplitCubes ( Int32 colorCount ) : void

Splits all the cubes on the list.

Method Details

GetPaletteIndex() public method

See IColorQuantizer.GetPaletteIndex for more details.
public GetPaletteIndex ( Color color, Int32 &paletteIndex ) : void
color Color
paletteIndex System.Int32
return void

OnCreateDefaultCache() protected method

See BaseColorCacheQuantizer.OnCreateDefaultCache for more details.
protected OnCreateDefaultCache ( ) : IColorCache
return IColorCache

OnFinish() protected method

See BaseColorQuantizer.OnFinish for more details.
protected OnFinish ( ) : void
return void

OnGetPaletteToCache() protected method

See BaseColorCacheQuantizer.OnGetPaletteToCache for more details.
protected OnGetPaletteToCache ( Int32 colorCount ) : List
colorCount System.Int32
return List

OnPrepare() protected method

See IColorQuantizer.Prepare for more details.
protected OnPrepare ( ImageBuffer image ) : void
image SimplePaletteQuantizer.Helpers.ImageBuffer
return void