Class MotionDetectionSettings
- Assembly
- VisioForge.Core.dll
Provides configuration settings for motion detection in video streams with color channel analysis and frame processing options.
public class MotionDetectionSettingsInheritance
Inherited Members
Remarks
The VisioForge.Core.Types.VideoProcessing.MotionDetectionSettings class enables motion detection by analyzing pixel differences between video frames. It offers flexible configuration for color channel analysis, motion visualization, and adaptive frame dropping based on motion levels.
Key features: - Selective color channel comparison (RGB or grayscale) - Motion highlighting with configurable colors - Frame dropping optimization for low-motion scenes - Grid-based motion matrix analysis - Adjustable sensitivity thresholds
This class provides a simpler interface compared to VisioForge.Core.Types.VideoProcessing.MotionDetectionExSettings, focusing on basic motion detection with color-based analysis.
Constructors
MotionDetectionSettings()
Initializes a new instance of the VisioForge.Core.Types.VideoProcessing.MotionDetectionSettings class with optimized default values.
public MotionDetectionSettings()Remarks
Default configuration provides a balanced setup for general motion detection: - Motion detection: Disabled (must be explicitly enabled) - Comparison mode: Grayscale (efficient and effective) - Highlight color: Green (moderate visibility) - Thresholds: Moderate sensitivity (25 for highlighting, 5 for dropping) - Matrix: 8×8 grid (adequate for most applications) - Frame interval: 0 (compare consecutive frames)
This configuration is optimized for: - Indoor surveillance with moderate lighting - Real-time processing requirements - Balance between sensitivity and false positives - General-purpose motion detection scenarios
Adjust settings after initialization based on your specific requirements: - Outdoor scenes: Increase thresholds to handle lighting changes - High-resolution video: Increase matrix dimensions for better detail - Performance-critical: Increase frame interval or enable frame dropping - Color-specific detection: Disable grayscale and enable specific RGB channels
Properties
Compare_Blue
Gets or sets a value indicating whether the blue color channel is analyzed for motion detection.
public bool Compare_Blue { get; set; }Property Value
Remarks
When enabled, pixel differences in the blue channel contribute to overall motion detection. This is useful for detecting objects with predominantly blue colors or in scenes where blue channel changes are significant indicators of motion.
Compare_Green
Gets or sets a value indicating whether the green color channel is analyzed for motion detection.
public bool Compare_Green { get; set; }Property Value
Remarks
The green channel typically contains the most luminance information in digital images and can be particularly effective for motion detection. Enabling this channel alone can provide good motion detection while reducing computational overhead.
Compare_Greyscale
Gets or sets a value indicating whether grayscale (luminance) comparison is used instead of RGB channels.
public bool Compare_Greyscale { get; set; }Property Value
Remarks
Grayscale comparison is computationally more efficient than multi-channel RGB comparison and often provides equally good results for motion detection. It analyzes only the luminance (brightness) changes between frames.
When true, the Compare_Red, Compare_Green, and Compare_Blue settings are ignored. When false, at least one RGB channel should be enabled for motion detection to work.
Compare_Red
Gets or sets a value indicating whether the red color channel is analyzed for motion detection.
public bool Compare_Red { get; set; }Property Value
Remarks
Including the red channel can improve detection of objects with warm colors or in scenes where red channel information is distinctive. Can be combined with other channels for more comprehensive motion analysis.
DropFrames_Enabled
Gets or sets a value indicating whether frames with motion below the threshold should be dropped from processing.
public bool DropFrames_Enabled { get; set; }Property Value
Remarks
Frame dropping optimization skips processing or encoding of frames that contain minimal motion, reducing computational load and output file size. This is particularly useful for: - Static surveillance scenes with infrequent activity - Time-lapse recording with motion triggers - Bandwidth-limited streaming applications
The motion level is compared against VisioForge.Core.Types.VideoProcessing.MotionDetectionSettings.DropFrames_Threshold to determine whether a frame should be processed or dropped. Dropped frames are typically replaced with duplicates of the previous frame or skipped entirely depending on the application.
DropFrames_Threshold
Gets or sets the motion level threshold for frame dropping decisions.
public int DropFrames_Threshold { get; set; }Property Value
Remarks
Frames with motion levels below this threshold will be dropped when VisioForge.Core.Types.VideoProcessing.MotionDetectionSettings.DropFrames_Enabled is true. Higher values result in more aggressive frame dropping, while lower values preserve more frames with subtle motion.
Typical threshold values: - 1-5: Very sensitive, drops only completely static frames - 5-15: Moderate, suitable for most surveillance applications - 15-30: Aggressive, drops frames with minor motion - 30+: Very aggressive, keeps only frames with significant activity
Enabled
Gets or sets a value indicating whether motion detection is enabled for video processing.
public bool Enabled { get; set; }Property Value
Remarks
When disabled, no motion detection processing occurs, and all related features (highlighting, frame dropping, matrix analysis) are bypassed. This improves performance when motion detection is not needed.
FrameInterval
Gets or sets the interval between reference frames used for motion comparison.
public int FrameInterval { get; set; }Property Value
Remarks
Increasing the frame interval reduces computational overhead by comparing frames that are further apart in time. This can help detect slower motion that might be missed when comparing only consecutive frames.
Frame interval effects: - 0: Compare every frame (highest sensitivity, most CPU usage) - 1: Compare every other frame (moderate sensitivity) - 2-5: Compare every 3-6 frames (reduced CPU, may miss fast motion) - 10+: Long interval for very slow motion or time-lapse scenarios
Highlight_Color
Gets or sets the color channel used for highlighting detected motion in video frames.
public MotionCHLColor Highlight_Color { get; set; }Property Value
Remarks
The selected color channel is enhanced in pixels where motion is detected, creating a visual overlay that makes movement easily visible. Color choice affects visibility: - Red: High contrast, ideal for alerts and security applications - Green: Balanced visibility, easier on eyes for extended viewing - Blue: Subtle highlighting, suitable for low-light scenarios
Highlight_Enabled
Gets or sets a value indicating whether motion areas are visually highlighted in the output video.
public bool Highlight_Enabled { get; set; }Property Value
Remarks
When enabled, pixels that exceed the motion threshold are tinted with the color specified by VisioForge.Core.Types.VideoProcessing.MotionDetectionSettings.Highlight_Color. This provides immediate visual feedback about detected motion areas without requiring separate processing of motion data.
Highlight_Threshold
Gets or sets the pixel difference threshold for motion highlighting.
public int Highlight_Threshold { get; set; }Property Value
Remarks
This threshold determines how much a pixel must change between frames to be highlighted as motion. It works independently from frame dropping threshold and can be tuned separately for visualization purposes.
Threshold guidelines: - 10-20: Sensitive, highlights subtle movements and shadows - 20-40: Moderate, suitable for general surveillance - 40-60: Conservative, highlights only significant motion - 60+: Very conservative, highlights only major changes
Matrix_Height
Gets or sets the number of rows in the motion analysis matrix grid.
public int Matrix_Height { get; set; }Property Value
Remarks
The motion matrix divides the video frame into a grid where each cell tracks motion levels independently. This enables zone-based analysis and provides structured motion data for applications like: - Regional activity monitoring - Motion heatmap generation - Zone-specific alerts - Traffic flow analysis
Higher values provide more detailed spatial resolution but increase memory usage and processing overhead.
Matrix_Width
Gets or sets the number of columns in the motion analysis matrix grid.
public int Matrix_Width { get; set; }Property Value
Remarks
Works with VisioForge.Core.Types.VideoProcessing.MotionDetectionSettings.Matrix_Height to define the grid resolution. The total number of cells is Matrix_Width × Matrix_Height, with each cell maintaining independent motion statistics.
For best results, the aspect ratio of the matrix should roughly match the video aspect ratio. For 16:9 video, consider ratios like 16:9, 8:6, etc.