Java Liveness PAD Example

Initialize LivenessPAD module

import org.sertiscorp.oneml.face.*;
LivenessPAD livenessPad = new LivenessPAD();

Initialize LivenessPAD module with licensing

import org.sertiscorp.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(filePath);

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

int status = result.getReturnStatus();
boolean liveness = result.getLiveness();
float livenessScore = result.getLivenessScore();

Cleanup

livenessPad.delete();
utils.delete();