Skip to main content

How to configure face detection?

Products: Video Capture SDK .Net

Face detection is a technology that identifies and locates human faces in digital images. It's widely used in security systems, camera software, and for analyzing facial expressions.

1. Configure your video source: webcam, IP camera, etc. Set preview or capture mode to use

2. Set face tracking settings

VideoCapture1.Face_Tracking = new FaceTrackingSettings
{
ColorMode = CamshiftMode.RGB,
Highlight = true,
MinimumWindowSize = 25,
ScalingMode = ObjectDetectorScalingMode.GreaterToSmaller,
SearchMode = ObjectDetectorSearchMode.Single
};

3. Add the OnFaceDetected event to catch faces and fill the text box with coordinates

public delegate void FaceDelegate(AFFaceDetectionEventArgs e);

public void FaceDelegateMethod(AFFaceDetectionEventArgs e)
{
edFaceTrackingFaces.Text = string.Empty;

foreach (var faceRectangle in e.FaceRectangles)
{
edFaceTrackingFaces.Text += "(" + faceRectangle.Left + ", " + faceRectangle.Top + "), ("
+ faceRectangle.Width + ", " + faceRectangle.Height + ")" + Environment.NewLine;
}
}

4. Start preview or capture, depending on step 1

async VideoCapture1.StartAsync();

Required redists

How can the required redists be installed or deployed to the user's PC?


Visit our GitHub page to get more code samples.