Enum MorphologyOp
- Namespace
- Egami.Operations
- Assembly
- Egami.dll
The operations of Morphology(MorphologyOp, StructuringElement, int), all flat (gray-level) and per channel.
public enum MorphologyOp
Fields
BottomHat = 6The Close minus the image: the dark details smaller than the shape. Alpha is kept.
Close = 3Dilate, then erode: fills dark gaps and holes smaller than the shape. Never darkens a pixel.
Dilate = 0The maximum over the shape: light areas grow, dark specks vanish.
Erode = 1The minimum over the shape: light areas shrink, light specks vanish.
Gradient = 4Dilate minus erode: the outlines of shapes, as wide as the shape. Alpha is kept.
Open = 2Erode, then dilate: removes light details smaller than the shape and keeps the rest. Never brightens a pixel.
TopHat = 5The image minus its Open: the light details smaller than the shape. Alpha is kept.
Examples
// Close removes dark specks smaller than the shape (dust and toner dots on the paper) and keeps strokes wider than it;
// Open does the opposite, for light pinholes in dark areas.
using Raster<Gray8> scan = Raster.Load<Gray8>("scan.tif");
scan.Apply(o => o.Morphology(MorphologyOp.Close, StructuringElement.Disk(1)), Ct);
// The outlines of shapes, and the light details smaller than a disk.
using Raster outlines = scan.Derive(o => o.Morphology(MorphologyOp.Gradient, StructuringElement.Square(1)), Ct);
using Raster details = scan.Derive(o => o.Morphology(MorphologyOp.TopHat, StructuringElement.Disk(5)), Ct);