Class VideoEffectGrayscale
- Namespace
- VisioForge.Core.Types.VideoEffects
- Assembly
- VisioForge.Core.dll
Represents a grayscale conversion effect that transforms color video into monochrome/black-and-white.
public class VideoEffectGrayscale : VideoEffect, IVideoEffectGrayscale, IVideoEffectInheritance
Implements
Inherited Members
Remarks
The grayscale effect removes all color information from the video while preserving luminance (brightness). It converts RGB color pixels to grayscale using a weighted average that mimics human brightness perception, typically using the formula: Gray = 0.299*R + 0.587*G + 0.114*B.
This effect is commonly used for:
- Creating classic black-and-white cinematography
- Artistic and nostalgic effects
- Reducing visual complexity for analysis or processing
- Improving video compression by eliminating color information
- Creating retro or documentary-style footage
The effect has no adjustable parameters - it performs complete color removal. For GPU-accelerated grayscale conversion with better performance on high-resolution video, consider using VisioForge.Core.Types.VideoEffects.GPUVideoEffectGrayscale.
Constructors
VideoEffectGrayscale(bool, string, TimeSpan, TimeSpan)
Initializes a new instance of the VisioForge.Core.Types.VideoEffects.VideoEffectGrayscale class with specified parameters.
public VideoEffectGrayscale(bool enabled, string name = "Grayscale", TimeSpan startTime = default, TimeSpan stopTime = default)Parameters
enabledbool-
trueto enable the effect immediately;falseto create the effect in a disabled state. namestring-
An optional name identifier for this effect instance. Default is "Grayscale". Used to retrieve specific effect instances from a collection.
startTimeTimeSpan-
The time at which the effect should start being applied. Default is Zero, which applies the effect from the beginning.
stopTimeTimeSpan-
The time at which the effect should stop being applied. Default is Zero, which applies the effect until the end.
Remarks
The grayscale effect is lightweight and has minimal performance impact.
If both startTime and stopTime are zero (default),
the effect will be applied for the entire video duration.
Methods
GetEffectType()
Gets the specific type of this video effect.
public VideoEffectType GetEffectType()Returns
- VideoEffectType
-
Returns VisioForge.Core.Types.VideoEffects.VideoEffectType.Greyscale to identify this as a grayscale conversion effect.
Remarks
This method is used by the video processing pipeline to route the effect to the appropriate grayscale conversion processor.