Table of Contents

Class VideoEffectMosaic

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

Represents a mosaic (pixelation) effect that creates a blocky, pixelated appearance by grouping adjacent pixels into uniform color blocks.

public class VideoEffectMosaic : VideoEffect, IVideoEffectMosaic, IVideoEffect

Inheritance

Implements

Inherited Members

Remarks

The mosaic effect reduces image detail by dividing the video frame into uniform rectangular blocks and filling each block with a single averaged color value. This creates a pixelated, low-resolution appearance similar to Japanese mosaic censorship or retro 8-bit video game graphics.

SDK Availability: VideoCaptureCore, MediaPlayerCore, VideoEditCore (Windows only)

Platform Support: Windows only

Common use cases include:

  • Privacy protection and face/object anonymization
  • Content censorship and sensitive information concealment
  • Artistic effects and retro aesthetic styling
  • Creating 8-bit or pixelated video game looks
  • Gradual reveal effects when animating between Value and ValueStop

The mosaic intensity can be animated by specifying different VisioForge.Core.Types.VideoEffects.VideoEffectMosaic.Value and VisioForge.Core.Types.VideoEffects.VideoEffectMosaic.ValueStop values. The effect will automatically interpolate between these values over the effect's time range, enabling smooth transitions from subtle pixelation to heavily pixelated and vice versa.

Performance: This is a CPU-based effect. Higher mosaic values (larger blocks) generally have better performance than lower values (smaller blocks). For GPU-accelerated pixelation with better performance on high-resolution video, consider using VisioForge.Core.Types.VideoEffects.GPUVideoEffectPixelate.

Constructors

VideoEffectMosaic(bool, int, int, string, TimeSpan, TimeSpan)

Initializes a new instance of the VisioForge.Core.Types.VideoEffects.VideoEffectMosaic class with specified parameters.

public VideoEffectMosaic(bool enabled, int value, int valueStop = 0, string name = "Mosaic", TimeSpan startTime = default, TimeSpan stopTime = default)

Parameters

enabled bool

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

value int

The mosaic block size in pixels. Higher values create larger blocks and more pronounced pixelation. Typical range is 2-30, with 2-5 for subtle effects and 16+ for strong censorship effects. Valid range is 1 to 255.

valueStop int

The ending mosaic block size for animated transitions. Set to 0 to disable animation and maintain constant intensity at value. When non-zero, the mosaic size will interpolate between value and this value over the effect's time range. Default is 0 (no animation). Valid range is 0 to 255.

name string

An optional name identifier for this effect instance. Default is "Mosaic". Used to retrieve specific effect instances from a collection via the name property. Multiple effects with the same type can coexist with different names.

startTime TimeSpan

The time at which the effect should start being applied. Default is Zero, which applies the effect from the beginning. Use a specific time value to delay the effect start.

stopTime TimeSpan

The time at which the effect should stop being applied. Default is Zero, which applies the effect until the end. Set to a specific time to limit the effect duration. When using animated transitions with valueStop, this defines the end point of the animation.

Remarks

If both startTime and stopTime are zero (default), the effect will be applied for the entire video duration.

For animated mosaic effects, ensure that stopTime is set to a value greater than startTime to allow the interpolation to occur.

Properties

Value

Gets or sets the mosaic block size (starting value for animations).

public int Value { get; set; }

Property Value

int

Remarks

Specifies the size of the mosaic blocks in pixels. Higher values create larger blocks and more pronounced pixelation effects. Lower values create smaller blocks with more subtle pixelation.

Typical value ranges:

  • 2-5: Subtle pixelation, slight detail reduction
  • 6-15: Moderate mosaic effect, visible blocks
  • 16-30: Strong pixelation, pronounced censorship effect
  • 31+: Very large blocks, extreme pixelation

When VisioForge.Core.Types.VideoEffects.VideoEffectMosaic.ValueStop is set to a different non-zero value, this property serves as the starting value for an animated transition.

ValueStop

Gets or sets the ending mosaic block size for animated transitions (optional).

public int ValueStop { get; set; }

Property Value

int

Remarks

When set to a non-zero value different from VisioForge.Core.Types.VideoEffects.VideoEffectMosaic.Value, the mosaic block size will automatically interpolate between VisioForge.Core.Types.VideoEffects.VideoEffectMosaic.Value and VisioForge.Core.Types.VideoEffects.VideoEffectMosaic.ValueStop over the effect's duration (from VisioForge.Core.Types.VideoEffects.VideoEffect.StartTime to VisioForge.Core.Types.VideoEffects.VideoEffect.StopTime).

Animation examples:

  • Value=2, ValueStop=30: Gradually increase pixelation (reveal to censored)
  • Value=30, ValueStop=2: Gradually decrease pixelation (censored to reveal)
  • ValueStop=0: No animation, constant mosaic at Value

Set to 0 to disable animation and maintain constant mosaic intensity at VisioForge.Core.Types.VideoEffects.VideoEffectMosaic.Value.

Methods

GetEffectType()

Gets the specific type of this video effect.

public VideoEffectType GetEffectType()

Returns

VideoEffectType

Returns VisioForge.Core.Types.VideoEffects.VideoEffectType.Mosaic to identify this as a mosaic/pixelation effect.

Remarks

This method overrides the base class implementation to provide the concrete effect type. The effect type is used by the video processing pipeline to route the effect to the appropriate mosaic processing module.