FaceAuth is a facial recognition library using neural networks that provides the simplest way to implement face authentication in your .NET project in just 4 lines of code.
To install, enter the command in the CLI
dotnet add package FaceAuth
using FaceAuth;
var auth = new FaceAuthProvider();
// Check and Initialize out camera
if (auth.CameraInitialize())
{
// Initialize FaceRecognizer model
auth.LoadFaceRecognizer();
//Register
auth.RegisterFace("The name of the person you are registering", 10);
// Recognize face
auth.Recognize();
}
else
{
Console.WriteLine("Your Camera Not Found!");
}
- For a big job, you need from 50-200 images of one person in different head positions.
- You can put auth.Recognize() in a loop of 10 iterations and get at least 1 true for successful authentication
// Recognize face
for (int i = 0; i < 10; i++)
{
if (auth.Recognize())
{
Console.WriteLine("Successful authentication");
return;
}
}
Console.WriteLine("Failed authentication");
- It is desirable to do Recognize() not in an infinite loop, for example, while observing the efficient authentication algorithm.
- It is recommended to make an anti-spam system to protect against hacking.
bool TryRecognize(FaceAuthProvider _auth, ref int _recognizeCount)
{
_recognizeCount++;
return _auth.Recognize();
}
int recognizeCount = 0;
for (int i = 0; i < 10; i++)
{
if (recognizeCount <= 5)
{
TryRecognize(auth, ref recognizeCount);
}
else
{
Console.WriteLine("You cant recognize more");
return;
}
}