Related products: Video Capture SDK .Net

How to configure face detection in Video Capture SDK .Net

1. Configure your video source: webcam, IP camera or something else. Set 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 OnFaceDetected event to catch faces and fill 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 from step 1

VideoCapture1.Start();

VisioForge © 2006-2019

  • GitHub-Mark-64px
  • Twitter Социальные Иконка
  • VisioForge Facebook page
  • YouTube channel