Table of Contents

Class CVMotionCellsBlock

Namespace
VisioForge.Core.MediaBlocks.OpenCV
Assembly
VisioForge.Core.dll

OpenCV motion detection block for intelligent surveillance and movement analysis. This block divides the video frame into a grid of cells and detects motion within each cell, providing fine-grained motion analysis capabilities. Uses background subtraction and frame differencing algorithms to identify moving objects and track motion patterns. Essential for security systems, traffic monitoring, and automated surveillance applications. Provides configurable sensitivity, region-of-interest selection, and motion event notifications. Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.

public class CVMotionCellsBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals

Inheritance

Implements

Inherited Members

Extension Methods

Constructors

CVMotionCellsBlock(CVMotionCellsSettings)

Initializes a new instance of the VisioForge.Core.MediaBlocks.OpenCV.CVMotionCellsBlock class with the specified motion detection settings.

public CVMotionCellsBlock(CVMotionCellsSettings settings)

Parameters

settings CVMotionCellsSettings

The motion detection configuration settings containing algorithm parameters.

Properties

Input

Gets the input pad for connecting video sources to be processed.

public override MediaBlockPad Input { get; }

Property Value

MediaBlockPad

Inputs

Gets all input pads for this motion detection block.

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

Output

Gets the output pad for connecting to downstream processing blocks.

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets all output pads for this motion detection block.

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

Settings

Gets or sets the motion detection configuration settings. Defines cell grid parameters, sensitivity thresholds, and detection algorithms.

public CVMotionCellsSettings Settings { get; set; }

Property Value

CVMotionCellsSettings

Type

Gets the media block type identifier.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

Methods

Build()

Constructs and initializes the OpenCV motion detection element within the pipeline. This method creates the motion detection filter with the specified algorithm settings, establishes input and output pads, and prepares the block for surveillance processing.

public override bool Build()

Returns

bool

true if the motion detection element was successfully built and configured; false if initialization failed.

CleanUp()

Releases all resources and performs cleanup operations for this OpenCV motion detection block. This method disposes of the motion detection element, unsubscribes from events, and resets the build state.

public void CleanUp()

Dispose(bool)

Releases unmanaged and - optionally - managed resources.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

GetCore()

Gets the core BaseElement wrapper that provides additional functionality around the OpenCV motion detection element.

public BaseElement GetCore()

Returns

BaseElement

The BaseElement wrapper instance that encapsulates the motion detection functionality.

GetElement()

Gets the underlying GStreamer element that performs the motion detection operation.

public Element GetElement()

Returns

Element

The GStreamer Element instance representing the OpenCV motion detection filter.

IsAvailable()

Determines whether this media block is available. Correct NuGet SDK redist should be included into your project. Checks for OpenCV library availability and motion detection algorithm support.

public static bool IsAvailable()

Returns

bool

true if OpenCV motion detection functionality is available; otherwise, false.

ProcessBusMessage(Structure)

Processes GStreamer bus messages for motion detection events and notifications. This method handles internal communication and triggers motion detection events.

public void ProcessBusMessage(Structure data)

Parameters

data Structure

The GStreamer message data containing detection information.

IMediaBlockInternals.SetContext(MediaBlocksPipeline)

Associates this OpenCV motion detection block with a pipeline and initializes its internal context. This method is called internally when the block is added to a pipeline.

void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)

Parameters

pipeline MediaBlocksPipeline

The MediaBlocksPipeline instance that will manage this block.

MotionDetected

Event raised when motion is detected in the video stream. Provides motion cell coordinates, intensity levels, and detection metadata.

public event EventHandler<CVMotionCellsEventArgs> MotionDetected

Event Type

EventHandler<CVMotionCellsEventArgs>

See Also