Class MotionDetectionExSettings
- Assembly
- VisioForge.Core.dll
Provides comprehensive configuration settings for advanced motion detection in video processing pipelines.
public class MotionDetectionExSettingsInheritance
Inherited Members
Examples
// Configure for security surveillance with object tracking
var securitySettings = new MotionDetectionExSettings
{
ProcessorType = MotionProcessorType.BlobCountingObjects,
DetectorType = MotionDetectorType.SimpleBackgroundModeling,
DifferenceThreshold = 20,
SuppressNoise = true,
HighlightMotionRegions = true,
HighlightColor = SKColors.Red,
MinObjectsHeight = 50,
MinObjectsWidth = 50
};
// Configure for activity heatmap visualization
var heatmapSettings = new MotionDetectionExSettings
{
ProcessorType = MotionProcessorType.GridMotionAreaProcessing,
DetectorType = MotionDetectorType.TwoFramesDifference,
GridWidth = 32,
GridHeight = 24,
HighlightMotionGrid = true,
MotionAmountToHighlight = 0.1f
};
Remarks
The VisioForge.Core.Types.VideoProcessing.MotionDetectionExSettings class offers extensive control over motion detection algorithms and visualization options. It supports multiple detection methods and processing techniques suitable for various applications including: - Security and surveillance systems - Traffic monitoring - Industrial automation - Sports analysis - Wildlife observation
The class provides two main configuration aspects: 1. Detection configuration: Controls how motion is detected (detector type, sensitivity, noise suppression) 2. Visualization configuration: Controls how detected motion is displayed (highlighting, grids, colors)
Performance considerations: - Different detector types have varying computational requirements - Enabling visualization features adds processing overhead - Grid-based processing is more efficient for large areas - Object counting requires more CPU than simple motion detection
Constructors
MotionDetectionExSettings()
Initializes a new instance of the VisioForge.Core.Types.VideoProcessing.MotionDetectionExSettings class with default values.
public MotionDetectionExSettings()Remarks
Default configuration provides a balanced setup suitable for general motion detection: - Processor: MotionAreaHighlighting (visualizes all motion) - Detector: TwoFramesDifference (fast, simple detection) - Threshold: 15 (moderate sensitivity) - Noise suppression: Enabled - Color: Red highlighting
The default settings are optimized for: - Indoor surveillance with moderate lighting - Detection of human-sized objects - Real-time processing with visual feedback - Balance between sensitivity and false positives
For specific applications, adjust the settings after initialization: - Security: Increase sensitivity, enable object tracking - Analytics: Use grid processing, disable visualization - Outdoor: Increase threshold, enable edge preservation
Properties
DetectorType
Gets or sets the motion detector algorithm used to identify changes between frames.
public MotionDetectorType DetectorType { get; set; }Property Value
Remarks
Each detector type has different characteristics: - VisioForge.Core.Types.VideoProcessing.MotionDetectorType.TwoFramesDifference: Fast, detects all movement including camera shake - VisioForge.Core.Types.VideoProcessing.MotionDetectorType.SimpleBackgroundModeling: Adapts to gradual changes, good for static cameras - VisioForge.Core.Types.VideoProcessing.MotionDetectorType.CustomFrameDifference: Compares against a reference frame
Selection guidelines: - Use TwoFramesDifference for quick motion detection or moving cameras - Use SimpleBackgroundModeling for fixed surveillance cameras - Use CustomFrameDifference when you have a known background reference
DifferenceThreshold
Gets or sets the pixel difference threshold for motion detection, ranging from 1 to 255.
public int DifferenceThreshold { get; set; }Property Value
Remarks
This threshold determines the sensitivity of motion detection. A pixel is considered to have motion if the difference between frames exceeds this value. The difference is typically calculated as the absolute difference in grayscale or color values.
Threshold selection guidelines: - Lower values (1-10): Very sensitive, detects subtle changes, more prone to noise - Medium values (10-30): Balanced detection, suitable for most applications - Higher values (30-50): Less sensitive, detects only significant movement - Very high values (50+): Only detects dramatic changes, good for high-noise environments
Factors affecting threshold selection: - Lighting conditions: Poor lighting requires lower thresholds - Camera quality: Lower quality cameras need higher thresholds to reduce noise - Scene complexity: Busy scenes may need higher thresholds - Application requirements: Security systems often use lower thresholds
GridHeight
Gets or sets the number of rows in the motion detection grid.
public int GridHeight { get; set; }Property Value
Remarks
The grid divides the video frame into cells for area-based motion analysis. Each cell independently tracks motion levels, enabling: - Zone-based motion detection - Activity heatmap generation - Directional motion analysis - Region-specific sensitivity settings
Grid resolution considerations: - Higher values (32-64): Fine-grained analysis, more CPU usage - Medium values (16-24): Balanced detail and performance - Lower values (4-8): Coarse analysis, better performance
For a 1920x1080 video: - 16 rows = 67.5 pixels per cell height - 32 rows = 33.75 pixels per cell height - 8 rows = 135 pixels per cell height
Note: This property only applies when VisioForge.Core.Types.VideoProcessing.MotionDetectionExSettings.ProcessorType is set to VisioForge.Core.Types.VideoProcessing.MotionProcessorType.GridMotionAreaProcessing.
GridWidth
Gets or sets the number of columns in the motion detection grid.
public int GridWidth { get; set; }Property Value
Remarks
Works with VisioForge.Core.Types.VideoProcessing.MotionDetectionExSettings.GridHeight to define the grid resolution. The total number of cells is GridWidth × GridHeight, which affects both analysis precision and processing performance.
Typical grid configurations: - Security monitoring: 16x12 or 20x15 (moderate detail) - Traffic analysis: 32x24 (higher detail for vehicle tracking) - Crowd monitoring: 8x6 (general activity levels) - Sports analysis: 40x30 (precise movement tracking)
The grid aspect ratio should generally match the video aspect ratio for uniform cell sizes. For 16:9 video, use ratios like 16x9, 32x18, etc.
Note: This property only applies when VisioForge.Core.Types.VideoProcessing.MotionDetectionExSettings.ProcessorType is set to VisioForge.Core.Types.VideoProcessing.MotionProcessorType.GridMotionAreaProcessing.
HighlightColor
Gets or sets the color used to highlight detected motion regions in the video output.
public SKColor HighlightColor { get; set; }Property Value
Remarks
This color is used differently depending on the processor type: - For area highlighting: Overlays or tints motion pixels with this color - For border highlighting: Draws borders around motion regions - For object detection: Draws bounding boxes around detected objects - For grid processing: Colors active grid cells
Color selection considerations: - High contrast colors (red, yellow) for security applications - Subtle colors (light blue, green) for analysis displays - Consider the typical background colors in your video content - Semi-transparent colors can be used for overlay effects
The alpha channel of the color may be used to control transparency, depending on the specific processor implementation.
HighlightMotionGrid
Gets or sets a value indicating whether grid cells with motion are visually highlighted.
public bool HighlightMotionGrid { get; set; }Property Value
Remarks
When enabled, grid cells that detect motion above the threshold specified by VisioForge.Core.Types.VideoProcessing.MotionDetectionExSettings.MotionAmountToHighlight are colored using VisioForge.Core.Types.VideoProcessing.MotionDetectionExSettings.HighlightColor. This creates a visual heatmap showing motion distribution across the frame.
Visualization options typically include: - Solid color fill for active cells - Transparency based on motion intensity - Grid lines to show cell boundaries - Gradient coloring for motion levels
Disable highlighting when: - Only motion data/statistics are needed - Implementing custom visualization - Maximizing processing performance - Running headless analysis
Note: This property only applies when VisioForge.Core.Types.VideoProcessing.MotionDetectionExSettings.ProcessorType is set to VisioForge.Core.Types.VideoProcessing.MotionProcessorType.GridMotionAreaProcessing.
HighlightMotionRegions
public bool HighlightMotionRegions { get; set; }Property Value
KeepObjectsEdges
Gets or sets a value indicating whether object edges are restored after noise suppression.
public bool KeepObjectsEdges { get; set; }Property Value
Remarks
When enabled, applies a 3x3 dilation morphological filter after noise suppression to restore object boundaries that may have been eroded. This helps maintain the original size and shape of detected objects while still benefiting from noise reduction.
This property is particularly useful when: - Accurate object size measurement is required - Object boundaries need to be precisely defined - Visual quality of highlighted regions is important - Tracking object contours or shapes
Performance impact: - Adds additional processing step (dilation filter) - Increases processing time by approximately 10-15% - Only applies when VisioForge.Core.Types.VideoProcessing.MotionDetectionExSettings.SuppressNoise is enabled
Note: This property is only applicable for SimpleBackgroundModeling and CustomFrameDifference detector types.
MinObjectsHeight
Gets or sets the minimum height in pixels for an object to be detected and tracked.
public int MinObjectsHeight { get; set; }Property Value
Remarks
This property filters out objects smaller than the specified height, helping to: - Eliminate noise and small artifacts from detection - Focus on objects of interest (people, vehicles, etc.) - Improve processing performance by ignoring irrelevant motion - Reduce false positives from environmental factors
Typical values for common scenarios: - People detection (640x480): 40-80 pixels - Vehicle detection (1920x1080): 100-200 pixels - Small object tracking: 5-20 pixels - Wildlife monitoring: Varies greatly by species and distance
The optimal value depends on: - Camera resolution and field of view - Distance from camera to objects - Type and size of objects being tracked - Acceptable trade-off between sensitivity and false positives
Note: This property only applies when VisioForge.Core.Types.VideoProcessing.MotionDetectionExSettings.ProcessorType is set to VisioForge.Core.Types.VideoProcessing.MotionProcessorType.BlobCountingObjects.
MinObjectsWidth
Gets or sets the minimum width in pixels for an object to be detected and tracked.
public int MinObjectsWidth { get; set; }Property Value
Remarks
Works in conjunction with VisioForge.Core.Types.VideoProcessing.MotionDetectionExSettings.MinObjectsHeight to define the minimum bounding box size for valid objects. Objects must meet both width and height requirements to be detected.
Common width requirements by application: - Pedestrian detection: 20-60 pixels (depending on resolution) - Vehicle detection: 50-150 pixels - Face detection in crowds: 30-50 pixels - Hand gesture recognition: 40-80 pixels
Setting appropriate minimum dimensions helps: - Filter out noise and shadows - Prevent detection of irrelevant small movements - Focus computational resources on significant objects - Maintain consistent detection quality
Note: This property only applies when VisioForge.Core.Types.VideoProcessing.MotionDetectionExSettings.ProcessorType is set to VisioForge.Core.Types.VideoProcessing.MotionProcessorType.BlobCountingObjects.
MotionAmountToHighlight
Gets or sets the motion level threshold for highlighting grid cells.
public float MotionAmountToHighlight { get; set; }Property Value
Remarks
This threshold represents the percentage of pixels within a grid cell that must show motion for the cell to be highlighted. The value is normalized: - 0.0 = No motion required (all cells highlighted) - 0.15 = 15% of cell pixels must show motion (default) - 0.5 = 50% of cell pixels must show motion - 1.0 = All pixels must show motion (rarely achieved)
Threshold selection guidelines: - Low values (0.05-0.15): Sensitive detection, shows subtle activity - Medium values (0.15-0.30): Balanced, filters minor disturbances - High values (0.30-0.50): Only significant motion, reduces noise - Very high (0.50+): Only massive changes, like full object movement
The optimal value depends on: - Grid resolution (smaller cells need lower thresholds) - Scene characteristics (busy vs. quiet environments) - Application requirements (security vs. analytics)
Note: This property only applies when VisioForge.Core.Types.VideoProcessing.MotionDetectionExSettings.ProcessorType is set to VisioForge.Core.Types.VideoProcessing.MotionProcessorType.GridMotionAreaProcessing and VisioForge.Core.Types.VideoProcessing.MotionDetectionExSettings.HighlightMotionGrid is enabled.
ProcessorType
Gets or sets the motion processor type that determines how detected motion is analyzed and visualized.
public MotionProcessorType ProcessorType { get; set; }Property Value
Remarks
The processor type affects both the analysis method and visualization output: - VisioForge.Core.Types.VideoProcessing.MotionProcessorType.None: Detection only, no visualization - VisioForge.Core.Types.VideoProcessing.MotionProcessorType.MotionAreaHighlighting: Highlights all motion pixels - VisioForge.Core.Types.VideoProcessing.MotionProcessorType.MotionBorderHighlighting: Highlights only motion boundaries - VisioForge.Core.Types.VideoProcessing.MotionProcessorType.BlobCountingObjects: Identifies and tracks individual objects - VisioForge.Core.Types.VideoProcessing.MotionProcessorType.GridMotionAreaProcessing: Divides frame into grid for area analysis
Choose the processor based on your application needs: - Use BlobCountingObjects for people counting or object tracking - Use GridMotionAreaProcessing for activity heatmaps or zone monitoring - Use MotionAreaHighlighting for general motion visualization
SuppressNoise
Gets or sets a value indicating whether noise suppression filtering is applied to reduce false positives.
public bool SuppressNoise { get; set; }Property Value
Remarks
When enabled, applies a 3x3 erosion morphological filter to remove isolated pixels that are likely to be noise rather than actual motion. This significantly reduces false positives caused by: - Camera sensor noise - Compression artifacts - Small environmental changes (dust, insects) - Electrical interference
Side effects of noise suppression: - May remove small but legitimate moving objects - Can erode the edges of larger objects - Slightly reduces processing speed
Use in conjunction with VisioForge.Core.Types.VideoProcessing.MotionDetectionExSettings.KeepObjectsEdges to restore object boundaries after noise suppression if edge precision is important.