Class Saturation<T>
- Namespace
- AiDotNet.Augmentation.Image
- Assembly
- AiDotNet.dll
Adjusts the saturation (color intensity) of an image.
public class Saturation<T> : AugmentationBase<T, ImageTensor<T>>, IAugmentation<T, ImageTensor<T>>
Type Parameters
TThe numeric type for calculations.
- Inheritance
-
AugmentationBase<T, ImageTensor<T>>Saturation<T>
- Implements
-
IAugmentation<T, ImageTensor<T>>
- Inherited Members
Remarks
Saturation adjustment changes how vivid or muted colors appear in an image. Higher saturation makes colors more vibrant, while lower saturation makes colors appear more gray or washed out.
For Beginners: Think of saturation like the vibrancy slider on photo apps. High saturation makes colors pop (like a sunset photo), while low saturation makes colors look faded (like an old photograph). A saturation of 0 would make the image completely grayscale.
When to use:
- Images from different cameras with varying color profiles
- Scenes with different lighting temperatures (warm vs cool)
- When you want the model to focus on shapes rather than colors
When NOT to use:
- Color is the primary classification feature (e.g., traffic lights)
- Medical imaging where color accuracy matters
- Tasks involving color matching or color recognition
Constructors
Saturation(double, double, double)
Creates a new saturation augmentation.
public Saturation(double minFactor = 0.8, double maxFactor = 1.2, double probability = 0.5)
Parameters
minFactordoubleThe minimum saturation factor. Values below 1.0 reduce saturation. Industry standard default is 0.8 (20% desaturation at minimum). A value of 0.0 would produce a grayscale image.
maxFactordoubleThe maximum saturation factor. Values above 1.0 increase saturation. Industry standard default is 1.2 (20% increase at maximum).
probabilitydoubleThe probability of applying this augmentation (0.0 to 1.0). Industry standard default is 0.5.
Remarks
For Beginners: The factor range of 0.8 to 1.2 creates subtle, natural-looking variations. Going below 0.5 makes images noticeably washed out, while going above 2.0 can make colors unnaturally vivid.
Properties
MaxFactor
Gets the maximum saturation adjustment factor.
public double MaxFactor { get; }
Property Value
Remarks
Values greater than 1.0 increase color intensity.
MinFactor
Gets the minimum saturation adjustment factor.
public double MinFactor { get; }
Property Value
Remarks
A factor of 1.0 means no change. Factor of 0.0 converts to grayscale.
Methods
ApplyAugmentation(ImageTensor<T>, AugmentationContext<T>)
Applies the saturation adjustment to the image.
protected override ImageTensor<T> ApplyAugmentation(ImageTensor<T> data, AugmentationContext<T> context)
Parameters
dataImageTensor<T>contextAugmentationContext<T>
Returns
- ImageTensor<T>
GetParameters()
Gets the parameters of this augmentation.
public override IDictionary<string, object> GetParameters()
Returns
- IDictionary<string, object>
A dictionary of parameter names to values.