C++ LivenessPAD Example

Initialize LivenessPAD module

oneML::face::LivenessPAD liveness_pad;

Initialize LivenessPAD module from existing FaceDetector

oneML::face::FaceDetector face_detector;
oneML::face::LivenessPAD liveness_pad(face_detector);

Initialize LivenessPAD module with licensing

oneML::LicenseManager license_manager;
license_manager.set_key("LICENSE_KEY_VALUE_HERE");
license_manager.activate_key();
oneML::face::LivenessPAD liveness_pad(license_manager);

Initialize LivenessPAD module with licensing from existing FaceDetector

oneML::LicenseManager license_manager;
license_manager.set_key("LICENSE_KEY_VALUE_HERE");
license_manager.activate_key();

oneML::face::FaceDetector face_detector(license_manager);
oneML::face::LivenessPAD liveness_pad(face_detector, license_manager);

Initialize oneML’s Utils

oneML::Utils utils;

Initialize oneML’s Utils with licensing

oneML::Utils utils(license_manager);

Run the module

std::string path = "path/to/image";
oneML::Image img;
utils.read_image_cv(path, img);

oneML::face::LivenessPADResult result;
oneML::face::LivenessPADOps ops{true}; // perform all checks
liveness_pad.run(img, ops, result);

Get result

auto status = result.get_return_status();
std::cout << "Status: " << status << std::endl;
std::cout << "Liveness: " << result.get_liveness() << std::endl;
std::cout << "Liveness Score: " << result.get_liveness_score() << std::endl;