Skip to main content
Version: 3.24.0 (latest)

Face tracking and face estimation

The bin directory contains the executable file demo:

The following dependencies are required to build and run C# demos:

To build the demo project in VisualStudio, follow the instructions below:

  1. Create an empty C# console application.
  2. Add the source files of the demo to the project.
  3. Add links to FacerecCSharpWrapper.dll and OpenCvSharp4.

demo

The sample demonstrates tracking, detection and cropping of faces, detection of anthropometric points and angles, as well as estimation of face quality, age and gender, emotions, and liveness (by processing an RGB image from your camera).

To make a quick run of the demo with default parameters on Windows, go to the bin/csharp_demo/demo folder and double-left-click run.bat.

Location of C# demo

Tracking results and information about each face are displayed in a window. The upper left corner shows Face SDK components, which you can turn on and off by left mouse click. This sample is similar to C++ demo. See the detailed description of the components in C++ demo.

run.bat <path_to_opencv_csharp>

where <path_to_opencv_csharp> is the path to the directory with the OpenCvCsharp library.

You can also run C# demo, specifying some parameters (for example, the path to your online license).

To build the demo, run the following commands:

cd examples/csharp_demos/demo
dotnet publish -o publish

Startup parameters: [--config_dir=<config_dir>] [--license_dir=<license_dir>] [--capturer_config=<capturer_config>]

Where:

  • config_dir – Path to the conf/facerec directory.
  • capturer_conf – Path to the Capturer config file (learn more about Capturer config files.
  • license_dir – Path to the directory with a license; provide this parameter if you need to change a default directory license.

Add the path to the directory that includes facerec.dll to the PATH environment variable.

set PATH=%PATH%; ..\...\..\bin
dotnet publish\csharp_demo.dll --config_dir=../../../conf/facerec --capturer_config=common_capturer_ssyv_fda_v2.xml

Error messages (if any) are printed in the console.

Source code: examples/csharp/demo