Class AFFaceDetectionEventArgs
- Namespace
- VisioForge.Core.Types.Events
- Assembly
- VisioForge.Core.dll
Provides data for the OnFaceDetected event, containing information about detected faces in a video frame.
public class AFFaceDetectionEventArgs : EventArgsInheritance
Inherited Members
Remarks
This class is used to pass details about face detection results, including the bounding rectangles of faces, the raw video frame data, and its properties. It supports platform-specific rectangle and pixel format types. The VisioForge.Core.Types.Events.AFFaceDetectionEventArgs.UpdateData property allows the event handler to signal if the frame data has been modified and needs to be saved or re-rendered. FaceRectangles array contains bounding boxes for all detected faces in the current frame. Buffer provides direct access to raw video frame data for custom processing or rendering. BufferLen indicates buffer size in bytes, essential for safe memory operations. Width and Height define frame dimensions for coordinate mapping and rendering. PixelFormat identifies color space (RGB, RGBA, YUV, etc.) for proper data interpretation. Platform-specific types (System.Drawing on Windows, custom types on other platforms) ensure optimal integration. Applications can overlay visual feedback (rectangles, labels) or extract face regions for recognition processing. Face detection typically uses Cascade classifiers, HOG+SVM, or deep learning models (MTCNN, RetinaFace). Set UpdateData to true if you modify the buffer to ensure changes are propagated to output or display. Multiple faces generate multiple rectangles in the FaceRectangles array. Events are raised on processing threads, requiring thread-safe handling for UI updates.
Constructors
AFFaceDetectionEventArgs(Rect[], nint, int, int, int, PixelFormatX, TimeSpan, TimeSpan, ref bool)
Initializes a new instance of the VisioForge.Core.Types.Events.AFFaceDetectionEventArgs class.
public AFFaceDetectionEventArgs(Rect[] faceRectangles, nint buffer, int bufferLen, int width, int height, PixelFormatX pixelFormat, TimeSpan startTime, TimeSpan stopTime, ref bool updateData)Parameters
faceRectanglesRect[]-
An array of bounding rectangles for the detected faces.
buffernint-
A pointer to the raw video frame data.
bufferLenint-
The length of the raw video frame data buffer in bytes.
widthint-
The width of the video frame.
heightint-
The height of the video frame.
pixelFormatPixelFormatX-
The pixel format of the video frame.
startTimeTimeSpan-
The start time of the video frame.
stopTimeTimeSpan-
The stop time of the video frame.
updateDatabool-
A reference to a boolean flag indicating if the data has been updated.
Properties
Buffer
Gets a pointer to the raw video frame data buffer where faces were detected.
public nint Buffer { get; }Property Value
BufferLen
Gets the length of the raw video frame data buffer in bytes.
public int BufferLen { get; }Property Value
FaceRectangles
Gets an array of VisioForge.Core.Types.Rect objects, each representing the bounding box of a detected face. This property is available on non-Windows platforms.
public Rect[] FaceRectangles { get; }Property Value
- Rect[]
Height
Gets the height of the video frame in pixels.
public int Height { get; }Property Value
PixelFormat
Gets the pixel format of the video frame as a VisioForge.Core.Types.X.PixelFormatX. This property is available on non-Windows platforms.
public PixelFormatX PixelFormat { get; }Property Value
StartTime
Gets the start time of the video frame within the media stream.
public TimeSpan StartTime { get; }Property Value
StopTime
Gets the stop time of the video frame within the media stream.
public TimeSpan StopTime { get; }Property Value
UpdateData
Gets or sets a value indicating whether the video frame data has been updated by the event handler.
Set this to true if you modify the VisioForge.Core.Types.Events.AFFaceDetectionEventArgs.Buffer data and want the changes to be reflected (e.g., saved to a file or rendered).
public bool UpdateData { get; set; }Property Value
Width
Gets the width of the video frame in pixels.
public int Width { get; }