C# Liveness PAD Example¶
Initialize LivenessPAD module
using OneML.Face;
LivenessPAD livenessPad = new LivenessPAD();
Initialize LivenessPAD module with licensing
using OneML.Face;
LicenseManager licenseManager = new LicenseManager();
licenseManager.SetKey("LICENSE_KEY_VALUE_HERE");
licenseManager.ActivateKey();
LivenessPAD livenessPad = new LivenessPAD(licenseManager);
Initialize oneML’s Utils
Utils utils = new Utils();
Initialize oneML’s Utils with licensing
Utils utils = new Utils(licenseManager);
Read input as oneML’s Image
Image image = utils.ReadImageCV(path);
Run the module
// run both image blur check and face pad check
LivenessPADOps ops = new LivenessPADOps(true);
LivenessPADResult result = livenessPad.Run(image, ops);
And get the output
bool liveness = result.GetLiveness();
float livenessScore = result.GetLivenessScore();
int status = result.GetReturnStatus();
Cleanup
livenessPad.Dispose();
utils.Dispose();
or wrap the application with
using (LivenessPAD livenessPad = new LivenessPAD())
{
// use livenessPad here
}