C++ Face Pad Example

C++ PadRGB Example

Initialize pad RGB model

oneML::face::FacePad pad_rgb(oneML::face::PadType::Rgb);

Initialize pad RGB model with licensing

oneML::LicenseManager license_manager;
license_manager.set_key("LICENSE_KEY_VALUE_HERE");
license_manager.activate_key();
oneML::face::FacePad pad_rgb(oneML::face::PadType::Rgb, license_manager);

Initialize oneML’s Utils

oneML::Utils utils;

Initialize oneML’s Utils with licensing

oneML::Utils utils(license_manager);

Create oneML’s MultiImage input and outputs object

oneML::MultiImage inputs{img1, img2, ...  img4};
std::vector<oneML::face::FacePadResult> outputs;

Create oneML’s Image input and output object

oneML::Image img;
utils.read_image_cv(path, img);
oneML::face::FacePadResult output;

Run the model

pad_rgb.classify(inputs, outputs);

or

pad_rgb.classify(img, output);

And get the output

float spoof_prob = output.get_spoof_prob();
bool is_spoof = output.is_spoof();
int status = output.get_return_status();

C++ PadPaper Example

Initialize pad paper model

oneML::face::FacePad pad_paper(oneML::face::PadType::Paper);

Initialize pad paper model with licensing

oneML::LicenseManager license_manager;
license_manager.set_key("LICENSE_KEY_VALUE_HERE");
license_manager.activate_key();
oneML::face::FacePad pad_paper(oneML::face::PadType::Paper, license_manager);

Initialize oneML’s Utils

oneML::Utils utils;

Initialize oneML’s Utils with licensing

oneML::Utils utils(license_manager);

Create oneML’s MultiImage input and outputs object

oneML::MultiImage inputs{img1, img2, ...  img4};
std::vector<oneML::face::FacePadResult> outputs;

Create oneML’s Image input and output object

oneML::Image img;
utils.read_image_cv(path, img);
oneML::face::FacePadResult output;

Run the model

pad_paper.classify(inputs, outputs);

or

pad_paper.classify(img, output);

And get the output

float spoof_prob = output.get_spoof_prob();
bool is_spoof = output.is_spoof();
int status = output.get_return_status();