Class CVCarDetectedEventArgs
- Namespace
- VisioForge.Core.Types.Events
- Assembly
- VisioForge.Core.dll
Provides data for events that indicate the detection of cars in a video frame. This class encapsulates the number of cars detected and the time elapsed during the detection process.
public class CVCarDetectedEventArgs : EventArgsInheritance
Inherited Members
Examples
// Assume an event handler is registered for a car detection event.
public void OnCarDetected(object sender, CVCarDetectedEventArgs e)
{
Console.WriteLine($"Detected {e.CarsCount} cars in {e.ElapsedTime.TotalMilliseconds} ms.");
if (e.CarsCount > 0)
{
// Perform actions when cars are detected, e.g., log, trigger an alert.
}
}
Remarks
This event argument is typically used in computer vision applications for traffic monitoring, autonomous driving simulations, or object counting. Car detection uses trained machine learning models (often Haar cascades or deep learning models) to identify vehicle shapes in video frames. The CarsCount property provides the total number of distinct cars detected in the current frame. ElapsedTime indicates the processing time for the detection algorithm, useful for performance monitoring and optimization. Detection accuracy depends on camera angle, lighting conditions, vehicle occlusion, and model training quality. These events are typically raised for each processed frame in real-time video analysis scenarios. Applications can use car counting for traffic flow analysis, parking lot occupancy, or security monitoring. Consider implementing temporal filtering or tracking to reduce false positives from frame-to-frame variations. Performance optimization may involve frame skipping, region-of-interest processing, or lower resolution processing. Events are raised on background processing threads, requiring thread-safe handling and UI marshaling.
Constructors
CVCarDetectedEventArgs(int, TimeSpan)
Initializes a new instance of the VisioForge.Core.Types.Events.CVCarDetectedEventArgs class.
public CVCarDetectedEventArgs(int carsCount, TimeSpan elapsedTime)Parameters
Properties
CarsCount
Gets the number of cars detected in the current frame.
public int CarsCount { get; }Property Value
ElapsedTime
Gets the time elapsed to perform the car detection operation for the current frame.
public TimeSpan ElapsedTime { get; }