Threshold using Simple Image Statistics (SIS).

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


public class SISThreshold : BaseInPlacePartialFilter


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:

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

Initial image:

Result image (calculated threshold is 127):

Inheritance Hierarchy


See Also