Table of Contents

Enum ThresholdMethod

Namespace
Egami.Operations
Assembly
Egami.dll
public enum ThresholdMethod

Fields

Kapur = 2

Kapur, Sahoo and Wong (1985): the level that maximizes the summed entropy of the two classes.

Otsu = 0

Otsu (1979): the level that best separates two classes, by between-class variance. The default, and the best for printed pages.

Triangle = 1

The 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);