Otsu thresholding.

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

Syntax

C#
public class OtsuThreshold : BaseInPlacePartialFilter

Remarks

The class implements Otsu thresholding, which is described in N. Otsu, "A threshold selection method from gray-level histograms", IEEE Trans. Systems, Man and Cybernetics 9(1), pp. 62–66, 1979.

This implementation instead of minimizing the weighted within-class variance does maximization of between-class variance, what gives the same result. The approach is described in this presentation.

The filter accepts 8 bpp grayscale images for processing.

Sample usage:

CopyC#
// create filter
OtsuThreshold filter = new OtsuThreshold( );
// apply the filter
filter.ApplyInPlace( image );
// check threshold value
byte t = filter.ThresholdValue;
// ...

Initial image:

Result image (calculated threshold is 97):

Inheritance Hierarchy

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

See Also