Assembly: AForge.Imaging (in AForge.Imaging.dll) Version: 220.127.116.11 (18.104.22.168)
public class IterativeThreshold : Threshold
The algorithm works in the following way:
- select any start threshold;
- compute average value of Background (µB) and Object (µO) values: 1) all pixels with a value that is below threshold, belong to the Background values; 2) all pixels greater or equal threshold, belong to the Object values.
- calculate new thresghold: (µB + µO) / 2;
- if |oldThreshold - newThreshold| is less than a given manimum allowed error, then stop iteration process and create the binary image with the new threshold.
For additional information see Digital Image Processing, Gonzalez/Woods. Ch.10 page:599.
The filter accepts 8 and 16 bpp grayscale images for processing.
// create filter IterativeThreshold filter = new IterativeThreshold( 2, 128 ); // apply the filter Bitmap newImage = filter.Apply( image );
Result image (calculated threshold is 102):