Class CVMotionCellsEventArgs
- Namespace
- VisioForge.Core.Types.Events
- Assembly
- VisioForge.Core.dll
Provides data for events that indicate motion detection based on a grid of cells. This class encapsulates information about which cells have detected motion, along with timing details.
public class CVMotionCellsEventArgs : EventArgsInheritance
Inherited Members
Examples
// Assume an event handler is registered for a motion cells event.
public void OnMotionCellsDetected(object sender, CVMotionCellsEventArgs e)
{
if (e.IsMotion)
{
Console.WriteLine($"Motion detected in cells: {e.Cells}");
if (e.StartedTime.HasValue)
{
Console.WriteLine($" Motion started at: {e.StartedTime.Value}");
}
Console.WriteLine($" Current time: {e.CurrentTime}");
}
else
{
Console.WriteLine($"No motion detected at {e.CurrentTime}");
if (e.FinishedTime.HasValue)
{
Console.WriteLine($" Motion finished at: {e.FinishedTime.Value}");
}
}
}
Remarks
This event argument is typically used in surveillance or activity monitoring applications where motion is tracked across defined regions of a video frame. The VisioForge.Core.Types.Events.CVMotionCellsEventArgs.Cells property provides a string representation of the motion grid, while VisioForge.Core.Types.Events.CVMotionCellsEventArgs.StartedTime, VisioForge.Core.Types.Events.CVMotionCellsEventArgs.FinishedTime, and VisioForge.Core.Types.Events.CVMotionCellsEventArgs.CurrentTime provide context about the duration and timing of the detected motion. The Cells string represents a grid overlaid on the video frame, with each character indicating motion status for that region. IsMotion indicates whether motion is currently active in the frame. StartedTime marks when a new motion sequence began, useful for measuring motion duration. FinishedTime marks when motion ceased, enabling post-motion actions and duration calculations. CurrentTime provides the frame timestamp for temporal correlation with other events. Grid-based motion detection allows zone-specific monitoring and reduces false positives from irrelevant areas. Applications can define custom response strategies based on which zones show activity. Motion events can trigger recording, alerts, lighting, or other automated responses. Consider implementing motion persistence thresholds to filter brief transient movements. These events are raised on background processing threads, requiring thread-safe handling and UI marshaling.
Constructors
CVMotionCellsEventArgs(string, TimeSpan?, TimeSpan?, TimeSpan?, bool)
Initializes a new instance of the VisioForge.Core.Types.Events.CVMotionCellsEventArgs class.
public CVMotionCellsEventArgs(string cells, TimeSpan? startedTime, TimeSpan? finishedTime, TimeSpan? currentTime, bool isMotion)Parameters
cellsstring-
A string representing the motion cells.
startedTimeTimeSpan?-
The time when motion started (can be null).
finishedTimeTimeSpan?-
The time when motion finished (can be null).
currentTimeTimeSpan?-
The current time of the frame.
isMotionbool-
A boolean indicating if motion is detected.
Properties
Cells
Gets a string representation of the motion cells, typically a grid where each character represents a cell's motion state.
public string Cells { get; }Property Value
CurrentTime
Gets the current timestamp of the frame being processed.
public TimeSpan? CurrentTime { get; }Property Value
FinishedTime
Gets the timestamp when motion ceased in the current sequence. This value is available when motion finishes.
public TimeSpan? FinishedTime { get; }Property Value
IsMotion
Gets a value indicating whether motion is currently detected.
public bool IsMotion { get; }Property Value
StartedTime
Gets the timestamp when motion was first detected in the current sequence. This value is available when motion starts.
public TimeSpan? StartedTime { get; }Property Value
Methods
ToString()
Returns a string that represents the current VisioForge.Core.Types.Events.CVMotionCellsEventArgs instance. The string provides a summary of the motion detection status, including cell information and relevant timestamps.
public override string ToString()