Assembly: AForge.Imaging (in AForge.Imaging.dll) Version: 18.104.22.168 (22.214.171.124)
public class OtsuThreshold : BaseInPlacePartialFilter
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.
// create filter OtsuThreshold filter = new OtsuThreshold( ); // apply the filter filter.ApplyInPlace( image ); // check threshold value byte t = filter.ThresholdValue; // ...
Result image (calculated threshold is 97):