Table of Contents

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 = 6

The Close minus the image: the dark details smaller than the shape. Alpha is kept.

Close = 3

Dilate, then erode: fills dark gaps and holes smaller than the shape. Never darkens a pixel.

Dilate = 0

The maximum over the shape: light areas grow, dark specks vanish.

Erode = 1

The minimum over the shape: light areas shrink, light specks vanish.

Gradient = 4

Dilate minus erode: the outlines of shapes, as wide as the shape. Alpha is kept.

Open = 2

Erode, then dilate: removes light details smaller than the shape and keeps the rest. Never brightens a pixel.

TopHat = 5

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