Class GPUVideoEffectGrayscale
- Namespace
- VisioForge.Core.Types.VideoEffects
- Assembly
- VisioForge.Core.dll
GPU-accelerated grayscale conversion effect that transforms color video into monochrome/black-and-white using DirectX hardware acceleration.
public class GPUVideoEffectGrayscale : GPUVideoEffect, IGPUVideoEffectGrayscale, IGPUVideoEffectInheritance
Implements
Inherited Members
Remarks
Available in: VideoCaptureCore, MediaPlayerCore, VideoEditCore (Windows only)
GPU-accelerated version using DirectX. Significantly faster than CPU equivalent for real-time processing of high-resolution video streams.
The grayscale effect removes all color information while preserving luminance (brightness) using a perceptually-weighted formula. The conversion uses the standard luminosity method that mimics human brightness perception: Gray = 0.299*R + 0.587*G + 0.114*B. This weighting accounts for the human eye's greater sensitivity to green light. The effect uses DirectX compute shaders to perform the conversion per-pixel, enabling real-time processing with minimal CPU overhead even at 4K resolutions. The result is a true monochrome image that accurately represents the original scene's brightness and tonal relationships.
Common use cases include: creating classic black-and-white cinematography, artistic and nostalgic film effects, documentary-style footage, film noir aesthetics, reducing visual complexity for computer vision processing, improving video compression efficiency by eliminating chroma data, creating retro or vintage looks, preparing footage for further stylization, enhancing tonal contrast visibility, and simulating security camera or surveillance footage appearance. The effect is also useful for accessibility, making content more distinguishable for color-blind viewers.
Performance characteristics: GPU acceleration provides near-instantaneous conversion, processing full 4K frames in under 0.5ms on modern GPUs. The operation is extremely compute-efficient with minimal memory bandwidth requirements. One of the lightest GPU effects available, it can be combined with multiple other effects without impacting frame rate. Ideal for real-time live streaming and recording applications.
Technical notes: The effect has no adjustable parameters—it performs complete color removal using the industry-standard luminosity formula. Unlike simple averaging (R+G+B)/3 or desaturation, this method produces perceptually accurate grayscale that maintains proper brightness relationships. The weighted conversion ensures that colors of different hues but similar RGB values appear with correct relative brightness in the monochrome result. For creative control over the grayscale conversion, consider combining with contrast or brightness effects to adjust the tonal range after conversion. The effect is reversible (can be disabled), but color information is not retained—turning it off restores the original color video.
Cross-reference to CPU equivalent: See VisioForge.Core.Types.VideoEffects.VideoEffectGrayscale for CPU-based alternative.
Constructors
GPUVideoEffectGrayscale(bool, string, TimeSpan, TimeSpan)
Initializes a new instance of the VisioForge.Core.Types.VideoEffects.GPUVideoEffectGrayscale class with specified parameters.
public GPUVideoEffectGrayscale(bool enabled, string name = "Grayscale", TimeSpan startTime = default, TimeSpan stopTime = default)Parameters
enabledbool-
Whether the effect is enabled. Set to
trueto apply immediately,falseto create in disabled state. namestring-
Optional effect name for identification and retrieval. Default is "Grayscale".
startTimeTimeSpan-
Start time for timed effects. Default is zero (apply from beginning).
stopTimeTimeSpan-
Stop time for timed effects. Default is zero (apply until end).
Remarks
When both start and stop times are zero, the effect applies for the entire video duration. The effect type is automatically set to VisioForge.Core.Types.VideoEffects.GPUVideoEffectType.Greyscale. No additional configuration needed—grayscale conversion is automatically applied using perceptually-weighted luminance formula.
Methods
GetEffectType()
Gets the specific type of this GPU video effect.
public GPUVideoEffectType GetEffectType()Returns
- GPUVideoEffectType
-
Returns VisioForge.Core.Types.VideoEffects.GPUVideoEffectType.Greyscale to identify this as a GPU-accelerated grayscale conversion effect.
Remarks
Used by the video processing pipeline to select the appropriate DirectX shader for grayscale conversion processing.