Base class for error diffusion dithering, where error is diffused to adjacent neighbor pixels.

Namespace:  AForge.Imaging.Filters
Assembly:  AForge.Imaging (in AForge.Imaging.dll) Version: 2.2.5.0 (2.2.5.0)

Syntax

C#
public class ErrorDiffusionToAdjacentNeighbors : ErrorDiffusionDithering

Remarks

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:

CopyC#
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):

Copy 
    | * | 7 |
| 3 | 5 | 1 |

/ 16

The filter accepts 8 bpp grayscale images for processing.

Sample usage:

CopyC#
// create filter
ErrorDiffusionToAdjacentNeighbors filter = new ErrorDiffusionToAdjacentNeighbors(
    new int[3][] {
        new int[2] { 5, 3 },
        new int[5] { 2, 4, 5, 4, 2 },
        new int[3] { 2, 3, 2 }
    } );
// apply the filter
filter.ApplyInPlace( image );

Inheritance Hierarchy

See Also