C++ Face Id Example¶
Initialize faceID model
oneML::face::FaceEmbedder embedder;
oneML::face::FaceId face_id(embedder);
Initialize faceID model with licensing
oneML::LicenseManager license_manager;
license_manager.set_key("LICENSE_KEY_VALUE_HERE");
license_manager.activate_key();
oneML::face::FaceEmbedder embedder(license_manager);
oneML::face::FaceId face_id(embedder, license_manager);
Initialize oneML’s Utils
oneML::Utils utils;
Initialize oneML’s Utils with licensing
oneML::Utils utils(license_manager);
Create oneML’s Image input object
oneML::Image img1;
oneML::Image img2;
utils.read_image_cv(path1, img1);
utils.read_image_cv(path2, img2);
Run the model for verification
std::pair<oneML::ReturnStatus, bool> result = face_id.is_the_same_person(img1, img2);
Run the model for identification
oneML::face::FaceIdResult result;
face_id.predict(img, result);
And get the output
int status = result.get_return_status();
bool is_identifiable = result.is_identifiable();
std::string id = result.get_id();
float nearest_distance = result.get_nearest_node_distance();
float combined_distance = result.get_combined_distance();