Table of Contents

Class GPUVideoEffectPixelate

Namespace
VisioForge.Core.Types.VideoEffects
Assembly
VisioForge.Core.dll

Represents a GPU-accelerated pixelate video effect that reduces video resolution to create a mosaic or blocky appearance.

public class GPUVideoEffectPixelate : GPUVideoEffect, IGPUVideoEffectPixelate, IGPUVideoEffect

Inheritance

Implements

Inherited Members

Remarks

The VisioForge.Core.Types.VideoEffects.GPUVideoEffectPixelate effect creates a stylized low-resolution appearance by grouping pixels into larger rectangular blocks of uniform color. This effect is commonly known as pixelation, mosaicing, or 8-bit style graphics. Each block represents the average or sampled color of the source pixels it covers, creating a characteristic blocky, retro aesthetic reminiscent of early digital graphics, video game sprites, and low-resolution displays.

SDK Availability

  • Video Capture SDK .Net: Yes
  • Video Edit SDK .Net: Yes
  • Media Player SDK .Net: Yes
  • Media Blocks SDK .Net: Yes

GPU Acceleration

This effect utilizes GPU shader processing to perform block-based color averaging or sampling in real-time. The shader divides the frame into a grid of rectangular blocks and computes the representative color for each block, typically by sampling the center pixel or averaging nearby pixels. The brick offset parameter enables alternating row patterns for more complex mosaic styles. All computations are performed in parallel on the GPU, ensuring real-time performance even with very small pixel sizes that create highly detailed mosaics.

Technical Details

  • Divides frame into grid of rectangular blocks based on pixel counts
  • Each block displays a single uniform color (sampled or averaged)
  • Pixel counts parameter controls horizontal and vertical block dimensions
  • Brick offset creates alternating pattern for brick-style mosaic effects
  • Supports independent X and Y pixel count values for non-square blocks
  • Real-time GPU processing with minimal performance impact

Common Use Cases

  • Creating retro 8-bit or 16-bit video game aesthetics
  • Privacy protection by obscuring faces or sensitive information
  • Artistic stylization for music videos and creative projects
  • Simulating low-resolution or low-bandwidth video feeds
  • Creating mosaic or tile-based visual effects for transitions
  • Generating pixel art style animations from video footage
  • Censorship effects for broadcast content

Performance Characteristics

The pixelate effect is highly efficient as it reduces the effective number of unique color values to compute. Larger pixel sizes (lower pixel counts) result in even better performance as fewer blocks need processing. The effect can be applied at 4K resolution in real-time with negligible frame rate impact. Memory usage is minimal as the effect performs in-place color sampling without requiring temporary buffers.

Parameter Configuration

The VisioForge.Core.Types.VideoEffects.GPUVideoEffectPixelate.PixelCounts property defines the number of blocks in the horizontal (X) and vertical (Y) dimensions. Higher values create smaller, more numerous blocks for a subtle pixelated look, while lower values create larger blocks for a more pronounced effect. The VisioForge.Core.Types.VideoEffects.GPUVideoEffectPixelate.BrickOffset parameter (range 0.0 to 1.0) controls the horizontal offset of alternating rows, enabling brick pattern effects where odd and even rows are staggered. A value of 0.0 creates a standard grid, 0.5 creates a brick wall pattern, and 1.0 creates maximum offset.

Privacy and Censorship Applications

The pixelate effect is widely used for privacy protection in video content, particularly for obscuring faces, license plates, or other sensitive information. For effective privacy protection, use pixel count values of 50-100 in the affected region. Note that this effect should not be considered cryptographically secure - advanced image processing techniques may attempt to recover detail from pixelated content. For maximum privacy, combine with VisioForge.Core.Types.VideoEffects.GPUVideoEffectBlur or use opaque overlays.

Artistic Considerations

  • Low pixel counts (10-30) create strong retro gaming aesthetic
  • Medium counts (50-100) balance style and recognizability
  • High counts (200-500) create subtle texture while maintaining detail
  • Non-square ratios (e.g., X:50, Y:100) create directional effects
  • Brick offset adds visual interest to static pixelated scenes

Integration Tips

For retro gaming aesthetics, combine this effect with VisioForge.Core.Types.VideoEffects.GPUVideoEffectSaturation boost and VisioForge.Core.Types.VideoEffects.GPUVideoEffectContrast adjustment to replicate classic CRT monitor color characteristics. For privacy applications, apply the effect to specific regions using masking techniques rather than the entire frame. The effect can be animated by gradually changing pixel counts over time for creative transition effects.

Related Effects

  • VisioForge.Core.Types.VideoEffects.VideoEffectMosaic: CPU-based mosaic effect with different characteristics
  • VisioForge.Core.Types.VideoEffects.GPUVideoEffectBlur: Alternative for privacy protection with softer appearance
  • VisioForge.Core.Types.VideoEffects.GPUVideoEffectContrast: Enhance retro aesthetic when combined
  • VisioForge.Core.Types.VideoEffects.GPUVideoEffectSaturation: Boost colors for vibrant pixel art look

Constructors

GPUVideoEffectPixelate(bool, PointF, float, string, TimeSpan, TimeSpan)

Initializes a new instance of the VisioForge.Core.Types.VideoEffects.GPUVideoEffectPixelate class with specified pixelation parameters and timing.

public GPUVideoEffectPixelate(bool enabled, PointF pixelCounts = default, float brickOffset = 0.5, string name = "Pixelate", TimeSpan startTime = default, TimeSpan stopTime = default)

Parameters

enabled bool

true to enable the pixelate effect immediately; false to create the effect in a disabled state. The effect can be enabled or disabled later using the VisioForge.Core.Types.VideoEffects.GPUVideoEffect.Enabled property.

pixelCounts PointF

The number of pixel blocks in horizontal (X) and vertical (Y) dimensions. Valid range is 0 to 1000 for both values. If not specified or empty, defaults to (100, 100). Higher values create smaller, more numerous blocks (subtle effect), while lower values create larger blocks (pronounced effect). Use non-square values for directional pixelation effects.

brickOffset float

The horizontal offset for alternating rows, ranging from 0.0 to 1.0. Defaults to 0.5 for a classic brick pattern. A value of 0.0 creates a standard grid, 0.5 creates a brick wall pattern with half-width offset, and 1.0 creates maximum staggering. This parameter adds visual variety by preventing vertical alignment of blocks.

name string

A unique identifier for this effect instance. Defaults to "Pixelate". This name can be used to retrieve the effect interface from the effect collection for runtime control and modification. Use descriptive names when applying multiple instances with different settings (e.g., "HeavyPixelate", "SubtlePixelate", "PrivacyMask").

startTime TimeSpan

The time position in the video timeline when this effect should become active. Use Zero (the default) to apply the effect from the beginning of the video. This enables time-based effect control for creating scenes that transition between normal and pixelated footage, or for applying privacy effects to specific time segments.

stopTime TimeSpan

The time position in the video timeline when this effect should become inactive. Use Zero (the default) to apply the effect until the end of the video. When combined with startTime, this creates time-windowed effects that automatically activate and deactivate at specific timestamps.

Remarks

The pixelate effect divides the video frame into a grid of rectangular blocks, each displaying a uniform color sampled or averaged from the source pixels. This creates a characteristic low-resolution mosaic appearance. The brick offset parameter allows alternating rows to be horizontally staggered, creating brick patterns rather than strict rectangular grids. All processing is GPU-accelerated for real-time performance.

Properties

BrickOffset

Gets or sets the brick offset value for creating alternating row patterns.

public float BrickOffset { get; set; }

Property Value

float

Remarks

The brick offset parameter adds visual interest by creating staggered patterns similar to brick masonry. When set to 0.5, the effect mimics running bond brick patterns where each row is offset by half the block width, preventing continuous vertical lines in the mosaic. This creates a more organic, less grid-like appearance.

Common brick offset values:

  • 0.0: Standard grid (no offset) - clean, regular appearance
  • 0.33: Third-offset pattern - subtle variation
  • 0.5: Half-offset brick pattern - classic masonry look (default)
  • 0.67: Two-thirds offset - alternative brick pattern
  • 1.0: Full offset - creates interesting visual rhythm

The brick offset only affects horizontal positioning of blocks in alternating rows. It does not affect vertical alignment or block dimensions.

PixelCounts

Gets or sets the pixel block counts for horizontal and vertical dimensions.

public PointF PixelCounts { get; set; }

Property Value

PointF

Remarks

The pixel counts determine how many rectangular blocks the frame is divided into. For example, setting X=50 and Y=50 divides a 1920x1080 frame into 50 horizontal and 50 vertical blocks, creating blocks of approximately 38x21 pixels each. Non-square values (e.g., X=100, Y=50) create rectangular blocks that can produce directional visual effects.

Practical value ranges:

  • 10-30: Strong pixelation for retro gaming or heavy censorship
  • 50-100: Medium pixelation for artistic effects or moderate privacy
  • 200-500: Subtle pixelation for texture effects while maintaining recognizability
  • 500-1000: Very fine pixelation for subtle stylization

Methods

GetEffectType()

Gets the specific GPU video effect type identifier for this pixelate effect.

public GPUVideoEffectType GetEffectType()

Returns

GPUVideoEffectType

Returns VisioForge.Core.Types.VideoEffects.GPUVideoEffectType.Pixelate, which uniquely identifies this effect as a pixelation/mosaic effect in the GPU video effects pipeline.

Remarks

This method is used internally by the video processing pipeline to identify and route effects to the appropriate GPU shader implementations. The effect type determines which shader program is executed and how the pixel counts and brick offset parameters are mapped to shader uniforms for block-based color sampling.