MaskErosion<T>
Models & Types · AiDotNet.Diffusion.MaskUtilities
Erodes a mask by shrinking masked regions, removing thin protrusions and small artifacts.
Implements: IDataTransformer<T, Tensor<T>, Tensor<T>>
For Beginners
Erosion makes the white (masked) area smaller. If your mask has small white specks or thin white lines, erosion removes them. It’s like “peeling” a layer off the edge of the masked region.
How It Works
Morphological erosion shrinks white (masked) regions by taking the minimum value in a local neighborhood. This removes small noise, thin connections, and smooths mask boundaries inward.
Constructors
| Constructor | Summary |
|---|---|
MaskErosion(int kernelSize) |
Initializes a new instance of the MaskErosion class. |
Properties
| Property | Summary |
|---|---|
bool IsFitted { get; } |
|
bool SupportsInverseTransform { get; } |
|
int[] ColumnIndices { get; } |
Methods
| Method | Summary |
|---|---|
Tensor<T> Apply(Tensor<T> mask) |
Applies morphological erosion to a mask tensor. |
Tensor<T> FitTransform(Tensor<T> data) |
|
Tensor<T> InverseTransform(Tensor<T> data) |
|
Tensor<T> Transform(Tensor<T> data) |
|
string[] GetFeatureNamesOut(string[] inputFeatureNames) |
|
void Fit(Tensor<T> data) |