OutpaintingMaskGenerator<T>
Models & Types · AiDotNet.Diffusion.MaskUtilities
Generates masks for outpainting by marking regions outside the original image bounds.
Implements: IDataTransformer<T, Tensor<T>, Tensor<T>>
For Beginners
Outpainting extends an image beyond its borders. This utility creates the mask that tells the model which parts are the original image (don’t change) and which parts need to be generated (extend). The feathering option makes the transition smoother.
How It Works
Creates a mask where the original image region is unmasked (0) and extended regions are masked (1). Supports extending in any direction with optional feathering at the boundary for smooth blending.
When used as an IDataTransformer, the Transform method
takes the original image tensor and generates an outpainting mask based on the padding
configured in the constructor.
Constructors
| Constructor | Summary |
|---|---|
OutpaintingMaskGenerator(int featherRadius, int padTop, int padRight, int padBottom, int padLeft) |
Initializes a new instance of the OutpaintingMaskGenerator class. |
Properties
| Property | Summary |
|---|---|
bool IsFitted { get; } |
|
bool SupportsInverseTransform { get; } |
|
int[] ColumnIndices { get; } |
Methods
| Method | Summary |
|---|---|
Tensor<T> FitTransform(Tensor<T> data) |
|
Tensor<T> Generate(int canvasHeight, int canvasWidth, int imageTop, int imageLeft, int imageHeight, int imageWidth) |
Generates an outpainting mask for the given canvas and image bounds. |
Tensor<T> InverseTransform(Tensor<T> data) |
|
Tensor<T> Transform(Tensor<T> data) |
Generates an outpainting mask from the input image tensor’s dimensions. |
string[] GetFeatureNamesOut(string[] inputFeatureNames) |
|
void Fit(Tensor<T> data) |