Getting Started
1. Recognition presets
Exist several recognition presets that suitable for different use cases:
- Realtime - realtime preset, fast, suitable for real-time video processing
- Balanced - balance between processing speed and faces match accuracy
- Accurate - slow, but most accurate, suitable for systems where face match accuracy is more important
Recognition preset can be configured at service initialization with Settings.RecognitionPreset
property.
2. Basic sample of using SDK
Initialization and Configuration
- The first step is to create a
Settings
object and then set theLicense
field.
Note
To obtain a license please email to support@idscan.net.
The second step is to create a
FaceService
object by passing in to constructor theSettings
object created in the previous step.Now you are ready to make use of the library.
Warning
IFaceService
implements the IDisposable
interface. So the SDK must be initialized only once at startup and disposed at the end.
Basic Sample
using System;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using IDScanNet.Faces.SDK;
namespace Sample
{
class Program
{
public static async Task Main(string[] args)
{
Console.WriteLine("Hello World!");
// path to license file
var licenseFilePath = Path.Combine(AppContext.BaseDirectory,"idscannet.facesdk.license");
var settings = new Settings
{
License = File.ReadAllBytes(licenseFilePath),
RecognitionPreset = RecognitionPreset.Realtime
};
// create and initialize face service
using var service = new FaceService(settings);
var image1 = File.ReadAllBytes("image1.jpg");
var image2 = File.ReadAllBytes("image2.jpg");
// detect face from given image1
using var faceSample1 = await service.DetectSingleAsync(image1);
// detect face from given image2
using var faceSample2 = await service.DetectSingleAsync(image2);
// compute face templates
using var template1 = await service.ComputeTemplateAsync(faceSample1);
using var template2 = await service.ComputeTemplateAsync(faceSample2);
// compare two templates
var matchResult = await service.MatchAsync(template1, template2);
Console.WriteLine($"Match result: {matchResult.Score*100f} %");
}
}
}
A sample project can be found on Github (https://github.com/IDScanNet/IDScanNet.Faces.SDK.Samples)