Threshold using Simple Image Statistics (SIS).

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

Syntax

C#
public class SISThreshold : BaseInPlacePartialFilter

Remarks

The filter performs image thresholding calculating threshold automatically using simple image statistics method. For each pixel:

  • two gradients are calculated - ex = |I(x + 1, y) - I(x - 1, y)| and |I(x, y + 1) - I(x, y - 1)|;
  • weight is calculated as maximum of two gradients;
  • sum of weights is updated (weightTotal += weight);
  • sum of weighted pixel values is updated (total += weight * I(x, y)).
The result threshold is calculated as sum of weighted pixel values divided by sum of weight.

The filter accepts 8 bpp grayscale images for processing.

Sample usage:

CopyC#
// create filter
SISThreshold filter = new SISThreshold( );
// apply the filter
filter.ApplyInPlace( image );

Initial image:

Result image (calculated threshold is 127):

Inheritance Hierarchy

System..::.Object
  AForge.Imaging.Filters..::.BaseInPlacePartialFilter
    AForge.Imaging.Filters..::.SISThreshold

See Also