Core Optical, Inc.
MorphologicalProcessor GetDilatedBinaryMask Method Industrial Strength, Scientific Grade
Returns a dilated version of the input BinaryMask image.

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

public BinaryMask GetDilatedBinaryMask(
	BinaryMask binaryMask,
	BinaryMask structuringElement

Return Value

A BinaryMask object containing the results of the morphological dilation operation.

OnlineSystem ArgumentNullException Thrown when binaryMask and/or structuringElement is null.
OnlineSystem ArgumentException Thrown when the dimensions of structuringElement exceeds those of binaryMask.
OnlineSystem ArgumentException Thrown when either dimension of structuringElement is an even value.

Use this method to apply a binary dilation operation to the input BinaryMask. The dilation is performed using the specified structuring element, itself another BinaryMask. The most common type of structuring element is a circular erosion mask which can be retrieved via the static GetCircularStructuringElement(Int32) utility method. The result of the dilation operation is returned as another BinaryMask object.


The following example performs a morphological closing operation to a binary mask object (generated from thresholded data contained in "sourceData") by sequentially applying a dilation operation followed by an erosion operation using a circular structuring element:
using PrecisionImage;
using PrecisionImage.BinarizationAndMorphology;

// Apply optimum global threshold: 
OtsuThresholder thresholder = new OtsuThresholder();
BinaryMask objectMask = thresholder.GetThresholdBinaryMask(sourceData, 0, HistogramResolution.EightBit);

// Get a circular stucturing element with a radius of 2: 
BinaryMask structuringElement = BinaryMask.GetCircularStructuringElement(2);

// Apply the closing operation:
MorphologyProcessor morphProcessor = new MorphologyProcessor();
objectMask = morphProcessor.GetDilatedBinaryMask(objectMask, BinaryMask.GetCircularStructuringElement(2));
objectMask = morphProcessor.GetErodedBinaryMask(objectMask, BinaryMask.GetCircularStructuringElement(2));
See Also