C# Class ScreenToGif.Encoding.NeuQuant

Neural Quantization Class
Mostrar archivo Open project: dbremner/ScreenToGif Class Usage Examples

Public Methods

Method Description
Map ( int b, int g, int r ) : int

Search for BGR values 0..255 (after net is unbiased) and return color index.

NeuQuant ( byte thePic, int len, int sample ) : System

Initialise the quantization process in range (0,0,0) to (255,255,255).

Process ( ) : byte[]

Starts the quantization.

Private Methods

Method Description
AlterNeighbour ( int radValue, int bestBias, int b, int g, int r ) : void

Move adjacent neurons by precomputed alpha*(1-((i-j)^2/[r]^2)) in _radpower[|i-j|]

Altersingle ( int alpha, int bestBias, int b, int g, int r ) : void

Move neuron (bestBias) towards biased (b,g,r) by factor alpha.

ColorMap ( ) : byte[]
Contest ( int b, int g, int r ) : int

Search for biased BGR values.

Inxbuild ( ) : void

Insertion sort of network and building of _netindex[0..255] (to do after unbias).

Learn ( ) : void

Main Learning Loop.

Unbiasnet ( ) : void

Unbias network to give byte values 0..255 and record position to prepare for sort.

Method Details

Map() public method

Search for BGR values 0..255 (after net is unbiased) and return color index.
public Map ( int b, int g, int r ) : int
b int Blue
g int Green
r int Red
return int

NeuQuant() public method

Initialise the quantization process in range (0,0,0) to (255,255,255).
public NeuQuant ( byte thePic, int len, int sample ) : System
thePic byte The image in bytes.
len int The length of the pixels.
sample int Sample interval for the quantitizer.
return System

Process() public method

Starts the quantization.
public Process ( ) : byte[]
return byte[]