C++ EKYC Example¶
Initialize EKYC module
oneML::face::EKYC ekyc;
Initialize EKYC module from existing FaceDetector and FaceEmbedder
oneML::face::FaceDetector face_detector;
oneML::face::FaceEmbedder face_embedder;
oneML::face::EKYC ekyc(face_detector, face_embedder);
Initialize EKYC module with licensing
oneML::LicenseManager license_manager;
license_manager.set_key("LICENSE_KEY_VALUE_HERE");
license_manager.activate_key();
oneML::face::EKYC ekyc(license_manager);
Initialize EKYC module with licensing from existing FaceDetector and FaceEmbedder
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::FaceEmbedder face_embedder(license_manager);
oneML::face::EKYC ekyc(face_detector, face_embedder, 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 path1 = "path/to/image1";
std::string path2 = "path/to/image2";
oneML::Image img1, img2;
utils.read_image_cv(path1, img1);
utils.read_image_cv(path2, img2);
oneML::face::EKYCResult result;
oneML::face::EKYCOps ops{true}; // perform all checks
ekyc.run(img1, img2, ops, ops, result);
Get result
oneML::face::Pose pose1;
oneML::face::Pose pose2;
oneML::face::BBox bbox1;
oneML::face::BBox bbox2;
float score1;
float score2;
oneML::face::FaceLandmark5 landmarks1;
oneML::face::FaceLandmark5 landmarks2;
auto status = result.get_return_status();
std::cout << "Status: " << status << std::endl;
std::cout << "Same: " << result.is_same_person() << std::endl;
std::cout << "Distance: " << result.get_distance() << std::endl;
result.get_bboxes(bbox1, bbox2);
result.get_bbox_scores(score1, score2);
result.get_landmarks(landmarks1, landmarks2);
result.get_face_poses(pose1, pose2);
std::cout << "Face 1" << std::endl;
std::cout << "BBox: " << bbox1 << std::endl;
std::cout << "BBox Score: " << score1 << std::endl;
std::cout << "Pose: " << pose1 << std::endl;
std::cout << "Landmarks: " << landmarks1 << std::endl;
std::cout << "Face 2" << std::endl;
std::cout << "BBox: " << bbox2 << std::endl;
std::cout << "BBox Score: " << score2 << std::endl;
std::cout << "Pose: " << pose2 << std::endl;
std::cout << "Landmarks: " << landmarks2 << std::endl;