Core Optical, Inc.
AdaptiveThresholder ClassIndustrial Strength, Scientific Grade
Encapsulates the Niblack adaptive binarization operation.
Inheritance Hierarchy

OnlineSystem Object
  PrecisionImage.BinarizationAndMorphology AdaptiveThresholder

Namespace: PrecisionImage.BinarizationAndMorphology
Assembly: PrecisionImage (in PrecisionImage.dll) Version: 2.0.0.0 (2.0.0.0)
Syntax

public class AdaptiveThresholder
Remarks

This class is used to apply the Niblack adaptive thresholding method of data binarization. This method is effective for thresholding objects or text under non-uniform illumination. The Niblack method computes a locally-optimum threshold based on the local average and standard deviation of a smoothed version of the input data. The algorithm operates on the assumption that the input data consists of a field of dark objects against a bright background. If the opposite is the case, invert the input data prior to applying the thresholding operation, or invert the resulting binary mask.
Examples

The following example illustrates the results of thresholding a non-uniform field using the Otsue thresholding method and the adaptive method.

using PrecisionImage;
using PrecisionImage.BinarizationAndMorphology;

// Read the source image from disk and load into a SourceData object: 
Uri imageUri                   = new Uri("Cells.tif", UriKind.Relative);
TiffBitmapDecoder imageDecoder = new TiffBitmapDecoder(imageUri, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
BitmapSource SourceImage       = imageDecoder.Frames[0];
SourceData sourceData          = new SourceData(SourceImage, GammaEncoding.None);

// Apply Otsu thresholding and display result: 
OtsuThresholder otsu = new OtsuThresholder();
BinaryMask otsuMask = otsu.GetThresholdBinaryMask(sourceData, 0, PrecisionImage.HistogramProcessing.HistogramResolution.EightBit);
image1.Source = otsuMask.GetMaskImage();

// Apply adaptive threshold and display result: 
AdaptiveThresholder adaptiveThresholder = new AdaptiveThresholder();
adaptiveThresholder.LocalRadius = 100;
adaptiveThresholder.StdDevFraction = 0.005f;
BinaryMask adaptiveMask = adaptiveThresholder.GetThresholdBinaryMask(sourceData, 0);
image2.Source = adaptiveMask.GetMaskImage();

The above example generates the following image pair:

See Also