ColorErrorDiffusionToAdjacentNeighbors Class |
Namespace: Accord.Imaging.ColorReduction
The ColorErrorDiffusionToAdjacentNeighbors type exposes the following members.
Name | Description | |
---|---|---|
ColorErrorDiffusionToAdjacentNeighbors |
Initializes a new instance of the ColorErrorDiffusionToAdjacentNeighbors class.
|
Name | Description | |
---|---|---|
Coefficients |
Diffusion coefficients.
| |
ColorTable |
Color table to use for image dithering. Must contain 2-256 colors.
(Inherited from ErrorDiffusionColorDithering.) | |
UseCaching |
Use color caching during color dithering or not.
(Inherited from ErrorDiffusionColorDithering.) |
Name | Description | |
---|---|---|
Apply(Bitmap) |
Perform color dithering for the specified image.
(Inherited from ErrorDiffusionColorDithering.) | |
Apply(UnmanagedImage) |
Perform color dithering for the specified image.
(Inherited from ErrorDiffusionColorDithering.) | |
Diffuse |
Do error diffusion.
(Overrides ErrorDiffusionColorDitheringDiffuse(Int32, Int32, Int32, Byte*).) | |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
height |
Processing image's height.
(Inherited from ErrorDiffusionColorDithering.) | |
pixelSize |
Processing image's pixel size in bytes.
(Inherited from ErrorDiffusionColorDithering.) | |
stride |
Processing image's stride (line size).
(Inherited from ErrorDiffusionColorDithering.) | |
width |
Processing image's width.
(Inherited from ErrorDiffusionColorDithering.) | |
x |
Current processing X coordinate.
(Inherited from ErrorDiffusionColorDithering.) | |
y |
Current processing Y coordinate.
(Inherited from ErrorDiffusionColorDithering.) |
Name | Description | |
---|---|---|
HasMethod |
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.) | |
IsEqual |
Compares two objects for equality, performing an elementwise
comparison if the elements are vectors or matrices.
(Defined by Matrix.) | |
To(Type) | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) | |
ToT | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) |
The class does error diffusion to adjacent neighbor pixels using specified set of coefficients. These coefficients are represented by 2 dimensional jugged array, where first array of coefficients is for right-standing pixels, but the rest of arrays are for bottom-standing pixels. All arrays except the first one should have odd number of coefficients.
Suppose that error diffusion coefficients are represented by the next jugged array:
int[][] coefficients = new int[2][] { new int[1] { 7 }, new int[3] { 3, 5, 1 } };
The above coefficients are used to diffuse error over the next neighbor pixels (* marks current pixel, coefficients are placed to corresponding neighbor pixels):
| * | 7 | | 3 | 5 | 1 | / 16
The image processing routine accepts 24/32 bpp color images for processing.
Sample usage:
// create dithering routine ColorErrorDiffusionToAdjacentNeighbors dithering = new ColorErrorDiffusionToAdjacentNeighbors( new int[3][] { new int[2] { 5, 3 }, new int[5] { 2, 4, 5, 4, 2 }, new int[3] { 2, 3, 2 } } ); // apply the dithering routine Bitmap newImage = dithering.Apply( image );