Pad<T>
Models & Types · AiDotNet.Augmentation.Image
Pads an image with configurable padding amounts and fill modes.
Inheritance: AugmentationBase<T, ImageTensor<T>> → SpatialAugmentationBase<T, ImageTensor<T>> → SpatialImageAugmenterBase<T> → Pad<T>
For Beginners
Padding makes an image larger by adding extra pixels around the edges. This is useful when you need a specific size but don’t want to crop or stretch the image. Black padding (constant=0) is most common.
How It Works
Padding adds pixels around the border of an image. Multiple fill modes control how the new pixels are filled:
- Constant: Fills with a fixed value (e.g., 0 for black, 255 for white)
- Edge: Extends the edge pixel values outward
- Reflect: Mirrors the image at the boundary
- Symmetric: Like reflect but includes the boundary pixel
When to use:
- Making images a specific size without distortion
- Preparing for convolutions that reduce spatial size
- Adding borders for visual presentation
Constructors
| Constructor | Summary |
|---|---|
Pad(int padHorizontal, int padVertical, PaddingMode mode, double fillValue, double probability) |
Creates a new pad augmentation with separate horizontal and vertical padding. |
Pad(int padLeft, int padRight, int padTop, int padBottom, PaddingMode mode, double fillValue, double probability) |
Creates a new pad augmentation with individual padding per side. |
Pad(int padding, PaddingMode mode, double fillValue, double probability) |
Creates a new pad augmentation with uniform padding. |
Properties
| Property | Summary |
|---|---|
PaddingMode Mode { get; } |
Gets the padding mode. |
double FillValue { get; } |
Gets the constant fill value (used when Mode is Constant). |
int PadBottom { get; } |
Gets the padding on the bottom side. |
int PadLeft { get; } |
Gets the padding on the left side. |
int PadRight { get; } |
Gets the padding on the right side. |
int PadTop { get; } |
Gets the padding on the top side. |
Methods
| Method | Summary |
|---|---|
IDictionary<string, object> GetParameters() |