C# Class AForge.Imaging.Filters.ErrorDiffusionDithering

Base class for error diffusion dithering.

The class is the base class for binarization algorithms based on error diffusion.

Binarization with error diffusion in its idea is similar to binarization based on thresholding of pixels' cumulative value (see ThresholdWithCarry). Each pixel is binarized based not only on its own value, but on values of some surrounding pixels. During pixel's binarization, its binarization error is distributed (diffused) to some neighbor pixels with some coefficients. This error diffusion updates neighbor pixels changing their values, what affects their upcoming binarization. Error diffuses only on unprocessed yet neighbor pixels, which are right and bottom pixels usually (in the case if image processing is done from upper left corner to bottom right corner). Binarization error equals to processing pixel value, if it is below threshold value, or pixel value minus 255 otherwise.

The filter accepts 8 bpp grayscale images for processing.

Inheritance: BaseInPlacePartialFilter
Datei anzeigen Open project: holisticware-admin/MonoVersal.AForgeNET

Protected Properties

Property Type Description
startX int
startY int
stopX int
stopY int
stride int
x int
y int

Protected Methods

Method Description
Diffuse ( int error, byte ptr ) : void

Do error diffusion.

All parameters of the image and current processing pixel's coordinates are initialized in protected members.

ErrorDiffusionDithering ( ) : System

Initializes a new instance of the ErrorDiffusionDithering class.

ProcessFilter ( UnmanagedImage image, Rectangle rect ) : void

Process the filter on the specified image.

Method Details

Diffuse() protected abstract method

Do error diffusion.
All parameters of the image and current processing pixel's coordinates are initialized in protected members.
protected abstract Diffuse ( int error, byte ptr ) : void
error int Current error value.
ptr byte Pointer to current processing pixel.
return void

ErrorDiffusionDithering() protected method

Initializes a new instance of the ErrorDiffusionDithering class.
protected ErrorDiffusionDithering ( ) : System
return System

ProcessFilter() protected method

Process the filter on the specified image.
protected ProcessFilter ( UnmanagedImage image, Rectangle rect ) : void
image UnmanagedImage Source image data.
rect System.Drawing.Rectangle Image rectangle for processing by the filter.
return void

Property Details

startX protected_oe property

Processing X start position.
protected int startX
return int

startY protected_oe property

Processing Y start position.
protected int startY
return int

stopX protected_oe property

Processing X stop position.
protected int stopX
return int

stopY protected_oe property

Processing Y stop position.
protected int stopY
return int

stride protected_oe property

Processing image's stride (line size).
protected int stride
return int

x protected_oe property

Current processing X coordinate.
protected int x
return int

y protected_oe property

Current processing Y coordinate.
protected int y
return int