Table of Contents

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, IDisposable

Inheritance

Implements

IFaceDetector
IVideoProcessor

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

options FaceDetectorOptions

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

string

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

int

Methods

Dispose(bool)

Releases unmanaged and - optionally - managed resources.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources; false to 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

faces CVFace[]

Array of detected faces.

timestamp TimeSpan

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

frame VideoFrameX

The VisioForge.Core.Types.X.VideoFrameX to process.

ProcessFrame(VideoFrame)

Processes a standard video frame for face detection.

public void ProcessFrame(VideoFrame frame)

Parameters

frame VideoFrame

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

context BaseContext

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> FacesDetected

Event Type

EventHandler<CVFaceDetectedEventArgs>

See Also

IFaceDetector