Table of Contents

Struct MFPDenoiseCAST

Namespace
VisioForge.Core.Types.FastImageProcessing
Assembly
VisioForge.Core.dll

Denoise CAST parameters.

public struct MFPDenoiseCAST

Inherited Members

Examples

// Configure for low-light webcam footage
var denoiseParams = new MFPDenoiseCAST
{
    TemporalDifferenceThreshold = 12,    // Moderate motion sensitivity
    NumberOfMotionPixelsThreshold = 16,  // Default motion detection
    StrongEdgeThreshold = 8,             // Preserve edges
    BlockWidth = 8,                      // Standard block size
    BlockHeight = 4,                     // Optimized for video
    EdgePixelWeight = 4,                 // Preserve edge detail
    NonEdgePixelWeight = 128,            // Strong noise reduction
    GaussianThresholdY = 16,             // Luminance filtering
    GaussianThresholdUV = 12,            // Chrominance filtering
    HistoryWeight = 6                    // Temporal smoothing
};

// Configure for high-quality source with minimal noise
var minimalDenoiseParams = new MFPDenoiseCAST
{
    TemporalDifferenceThreshold = 20,    // Less sensitive
    NumberOfMotionPixelsThreshold = 24,  // Higher motion threshold
    StrongEdgeThreshold = 4,             // Very edge-preserving
    BlockWidth = 16,                     // Larger blocks
    BlockHeight = 8,                     // Larger blocks
    EdgePixelWeight = 2,                 // Minimal edge filtering
    NonEdgePixelWeight = 64,             // Light noise reduction
    GaussianThresholdY = 8,              // Light filtering
    GaussianThresholdUV = 6,             // Light filtering
    HistoryWeight = 3                    // Less temporal averaging
};

Remarks

The MFPDenoiseCAST structure contains parameters for the CAST (Content Adaptive Spatio-Temporal) denoising algorithm. This advanced noise reduction technique analyzes video content both spatially (within a frame) and temporally (across frames) to effectively reduce noise while preserving important details and motion.

The algorithm works by: 1. Dividing frames into blocks for localized analysis 2. Detecting edges and motion to preserve important features 3. Applying different filtering strengths based on content characteristics 4. Using temporal information from previous frames to improve noise estimation

CAST is particularly effective for: - Low-light video with high noise levels - Compressed video with block artifacts - Analog video captures with grain and interference - Webcam footage in poor lighting conditions

Fields

BlockHeight

Block height.

public int BlockHeight

Field Value

int

Remarks

Height of the processing blocks in pixels. Often set to half the width for video content to account for the aspect ratio of video pixels and interlacing considerations.

Default: 4, Range: [1, 16] Note: For interlaced content, heights of 2 or 4 work best.

BlockWidth

Block width.

public int BlockWidth

Field Value

int

Remarks

Width of the processing blocks in pixels. The frame is divided into blocks of this size for localized noise analysis. Smaller blocks provide more localized processing but increase computational cost.

Default: 8, Range: [0, 255] Common configurations: - 4x4: Fine detail preservation, higher CPU usage - 8x4: Optimized for video content (recommended) - 8x8: Balanced performance and quality - 16x8: Faster processing, less localized

EdgePixelWeight

Edge pixel weight.

public int EdgePixelWeight

Field Value

int

Remarks

Filtering weight applied to pixels detected as edges. Lower values mean less filtering (more preservation) of edge pixels, while higher values apply more noise reduction even to edges, potentially softening them.

Default: 4, Range: [1, 16] - 1-2: Maximum edge preservation, minimal filtering - 3-6: Standard edge filtering (default range) - 6-10: Moderate edge filtering - 10-16: Heavy edge filtering, soft results

Note: The limited range [1-16] ensures edges are always preserved to some degree.

GaussianThresholdUV

Gaussian threshold UV.

public int GaussianThresholdUV

Field Value

int

Remarks

Threshold for Gaussian filtering applied to the chrominance (UV) channels. Controls color noise reduction. Can typically be more aggressive than Y filtering since the human eye is less sensitive to color detail.

Default: 12, Range: [0, 255] Typically set to 60-80% of GaussianThresholdY value.

GaussianThresholdY

Gaussian threshold Y.

public int GaussianThresholdY

Field Value

int

Remarks

Threshold for Gaussian filtering applied to the luminance (Y) channel. Controls how much spatial smoothing is applied to brightness information. Higher values provide more aggressive noise reduction but may reduce detail.

Default: 16, Range: [0, 255] - 0-8: Minimal luminance filtering - 8-24: Standard filtering (default range) - 24-48: Strong luminance smoothing - 48+: Very aggressive, may lose detail

HistoryWeight

History weight.

public int HistoryWeight

Field Value

int

Remarks

Controls how much influence previous frames have on the current frame's noise reduction. Higher values create stronger temporal smoothing by averaging more frames together, reducing temporal noise but potentially causing motion blur or ghosting artifacts.

Default: 6, Range: [0, 16] - 0-2: Minimal temporal filtering, no motion blur - 3-8: Standard temporal smoothing (default range) - 8-12: Strong temporal averaging - 12-16: Maximum temporal smoothing, risk of ghosting

For static content, higher values work well. For high-motion content, use lower values to avoid motion artifacts.

NonEdgePixelWeight

Non-edge pixel weight.

public int NonEdgePixelWeight

Field Value

int

Remarks

Filtering weight applied to pixels in smooth areas (non-edges). Higher values provide stronger noise reduction in flat areas where noise is most visible, while lower values preserve more texture and fine detail.

Default: 128, Range: [0, 255] - 0-64: Light noise reduction, preserves texture - 64-160: Standard noise reduction (default range) - 160-220: Strong noise reduction - 220-255: Maximum noise reduction, very smooth

NumberOfMotionPixelsThreshold

Number of motion pixels threshold.

public int NumberOfMotionPixelsThreshold

Field Value

int

Remarks

Default 16 - range [0, 255].

StrongEdgeThreshold

Strong edge threshold.

public int StrongEdgeThreshold

Field Value

int

Remarks

Defines the minimum gradient magnitude for a pixel to be classified as a strong edge. Edges above this threshold receive special processing to preserve sharpness and detail. Lower values preserve more edges but may also preserve noise near edges.

Default: 0, Range: [0, 16] - 0-4: Maximum edge preservation (default range) - 4-8: Standard edge preservation - 8-12: More aggressive filtering - 12-16: Heavy filtering, significant softening

Note: The relatively small range [0-16] provides fine-grained control over edge detection.

TemporalDifferenceThreshold

Temporal difference threshold.

public int TemporalDifferenceThreshold

Field Value

int

Remarks

Controls the sensitivity to changes between frames. This threshold determines when pixel differences between consecutive frames are considered as motion rather than noise. Lower values make the algorithm more sensitive to motion.

Typical values: - 5-10: Very sensitive, preserves all motion - 10-20: Standard sensitivity for most content - 20-30: Less sensitive, better noise reduction - 30+: May cause motion blur in fast scenes

Methods

CopyFrom(VideoEffectDenoiseCAST)

Copy from effect.

public void CopyFrom(VideoEffectDenoiseCAST src)

Parameters

src VideoEffectDenoiseCAST

Source VideoEffectDenoiseCAST object containing the settings to copy.

Remarks

Transfers all parameter values from a high-level VideoEffectDenoiseCAST object to this low-level structure. This is useful when configuring the fast image processing pipeline based on user-configured effects.