Class FaceDetector
- Namespace
- VisioForge.Core.MLKit
- Assembly
- VisioForge.Core.MLKit.dll
Provides face detection functionality using Google ML Kit for Android platforms. Implements the VisioForge.Core.Types.VideoProcessing.IFaceDetector interface to process video frames and detect faces. This class handles the creation of ML Kit detectors, frame conversion, and asynchronous processing.
public class FaceDetector : IFaceDetector, IVideoProcessor, IDisposableInheritance
Implements
-
IFaceDetectorIVideoProcessor
Inherited Members
Constructors
FaceDetector()
Initializes a new instance of the VisioForge.Core.MLKit.FaceDetector class with default settings. Configures the detector with real-time options: all contours enabled and fast performance mode.
public FaceDetector()FaceDetector(FaceDetectorOptions)
Initializes a new instance of the VisioForge.Core.MLKit.FaceDetector class.
public FaceDetector(FaceDetectorOptions options)Parameters
optionsFaceDetectorOptions-
The options.
Properties
JSONFile
Gets or sets the file path for exporting face detection results in JSON Lines format.
public string JSONFile { get; set; }Property Value
SkipFrames
Gets or sets the number of frames to skip between face detection operations for performance optimization. Skipping frames reduces CPU usage by not processing every single video frame.
public int SkipFrames { get; set; }Property Value
Methods
Dispose(bool)
Releases unmanaged and - optionally - managed resources.
protected virtual void Dispose(bool disposing)Parameters
disposingbool-
trueto release both managed and unmanaged resources;falseto release only unmanaged resources.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()DoFacesDetected(CVFace[], TimeSpan)
Raises the FacesDetected event with the detected faces.
public void DoFacesDetected(CVFace[] faces, TimeSpan timestamp)Parameters
facesCVFace[]-
Array of detected faces.
timestampTimeSpan-
The timestamp when faces were detected.
GetSupportedFrameFormats()
Gets the supported video frame formats for face detection.
public VideoFormatX[] GetSupportedFrameFormats()Returns
- VideoFormatX[]
-
Array of supported video formats.
Exceptions
- NotImplementedException
-
This method is not implemented.
ProcessFrame(VideoFrameX)
Processes a video frame for face detection. Checks if the frame should be skipped and initiates asynchronous processing if suitable.
public void ProcessFrame(VideoFrameX frame)Parameters
frameVideoFrameX-
The VisioForge.Core.Types.X.VideoFrameX to process.
ProcessFrame(VideoFrame)
Processes a standard video frame for face detection.
public void ProcessFrame(VideoFrame frame)Parameters
frameVideoFrame-
The video frame to process.
Exceptions
- NotImplementedException
-
This method is not implemented for standard VideoFrame.
SetContext(BaseContext)
Sets the base context for the face detector.
public void SetContext(BaseContext context)Parameters
contextBaseContext-
The base context to set.
Exceptions
- NotImplementedException
-
This method is not implemented.
FacesDetected
Occurs when faces are detected in a video frame.
public event EventHandler<CVFaceDetectedEventArgs> FacesDetectedEvent Type
- EventHandler<CVFaceDetectedEventArgs>
See Also
-
IFaceDetector