Enum ThresholdMethod
- Namespace
- Egami.Operations
- Assembly
- Egami.dll
How AutoThreshold(ThresholdMethod, ThresholdMode, Rgba8?, Rgba8?, bool) and FindThreshold(ThresholdMethod, ThresholdMode) choose a level from the histogram.
public enum ThresholdMethod
Fields
Kapur = 2Kapur, Sahoo and Wong (1985): the level that maximizes the summed entropy of the two classes.
Otsu = 0Otsu (1979): the level that best separates two classes, by between-class variance. The default, and the best for printed pages.
Triangle = 1The triangle method (Zack, Rogers and Latt, 1977): the level farthest from the line from the histogram's peak to its far end, for images with one dominant peak.
Examples
// Threshold a scanned page for OCR: Otsu's level for an evenly lit page, or Bradley's local threshold for uneven light.
float level = page.FindThreshold(ThresholdMethod.Otsu);
using Raster<Gray8> even = page.Derive(o => o.AutoThreshold(ThresholdMethod.Otsu), Ct);
using Raster<Gray8> uneven = page.Derive(o => o.AdaptiveThreshold(limit: 0.15f), Ct);