NeuQuant Neural-Net Quantization Algorithm
------------------------------------------
Copyright (c) 1994 Anthony Dekker
NEUQUANT Neural-Net quantization algorithm by Anthony Dekker, 1994.
See "Kohonen neural networks for optimal colour quantization"
in "Network: Computation in Neural Systems" Vol. 5 (1994) pp 351-367.
for a discussion of the algorithm.
Any party obtaining a copy of these files from the author, directly or
indirectly, is granted, free of charge, a full and unrestricted irrevocable,
world-wide, paid up, royalty-free, nonexclusive right and license to deal
in this software and documentation files (the "Software"), including without
limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons who receive
copies from any such party to do so, with the only requirement being
that this copyright notice remain intact.
Ported to Java 12/00 K Weiner
Modified by Simon Bridewell, June 2009:
Downloaded from
http://www.thinkedge.com/BlogEngine/file.axd?file=NGif_src2.zip
Adapted by for FxCop code analysis compliance and documentation comments
converted to .net XML comments.
Updated to use .net 2.0 generics - use List instead of byte[]
Declaration Syntax
C# | Visual Basic | Visual C++ |
public class NeuQuant
Public Class NeuQuant
public ref class NeuQuant
Members
All Members | Constructors | Methods | |||
Icon | Member | Description |
---|---|---|
NeuQuant(Collection<(Of <(Byte>)>), Int32, Int32) |
Constructor.
Initialise network in range (0,0,0) to (255,255,255) and set parameters
| |
BuildIndex()()() |
Insertion sort of network and building of netindex[0..255] (to do
after unbias)
| |
Equals(Object) | (Inherited from Object.) | |
Finalize()()() | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode()()() | Serves as a hash function for a particular type. GetHashCode()()() is suitable for use in hashing algorithms and data structures like a hash table. (Inherited from Object.) | |
GetType()()() | Gets the Type of the current instance. (Inherited from Object.) | |
Learn()()() |
Main Learning Loop
| |
Map(Int32, Int32, Int32) |
Search for BGR values 0..255 (after net is unbiased) and return
the index in the colour table of the colour closest to the supplied
colour.
TODO: consider accepting a Color rather than R,G,B integers.
| |
MemberwiseClone()()() | Creates a shallow copy of the current Object. (Inherited from Object.) | |
Process()()() |
Calls the Learn, UnbiasNetwork and BuildIndex method and returns the
ColorMap.
| |
ToString()()() | (Inherited from Object.) | |
UnbiasNetwork()()() |
Unbias network to give byte values 0..255 and record position i to
prepare for sort
|
Inheritance Hierarchy
Object | |
NeuQuant |