Links

De-enrollment

Example for how to de-enroll an existing user.
The de-enrollment verifies the validity of the face features captured by the selected camera device and deletes the user entity from the Keyless Network.
To de-enroll a user we must first perform the enrollment (see Enrollment).

Synchronous de-enrollment

We will perform de-enrollment using a simple blocking call.
/// USER SESSION HAS BEEN INITIALIZED
/// USER HAS BEEN ENROLLED
// This is an enrollment output, load it here before de-enrollment
std::vector<unsigned char> user_key = loadUserKey();
try
{
// Perform de-enrollment using previously selected and configured camera device
session->deEnroll(*device_selector, *user_key, nullptr);
/// USER SUCCESFULLY DE-ENROLLED
// Optionally we can check succesful de-enrollment
if (!session->isEnrolled()) {
/// USER SUCCESFULLY DE-ENROLLED
}
}
catch (const keyless::IException& e)
{
std::cerr << e.message() << std::endl;
}

Asynchronous de-enrollment

To perform the de-enrollment we call the deEnrollAsync()method with our implementation of IDeEnrollmentCallbacks interface which will report the execution end.
class KeylessDeEnrollmentCallbacks : public keyless::IDeEnrollmentCallbacks
{
private:
void KEYLESS_SDK_CALL onFailure(const keyless::IException& exception) noexcept override
{
// De-enrollment has ended with failure here, save details from `exception`
}
void KEYLESS_SDK_CALL onSuccess() noexcept override
{
// De-enrollmenthas ended with success here
}
keyless::IStatusCallbacks* KEYLESS_SDK_CALL getStatusCallbacks() noexcept override
{
return nullptr; // see "Status Updates" below
}
};
We will also retrieve the IControl interface allowing us to stop the running execution.
/// USER SESSION HAS BEEN INITIALIZED
/// USER HAS BEEN ENROLLED
try
{
// declare our asynchronous callbacks
KeylessDeEnrollmentCallbacks callbacks;
// Perform enrollment
keyless::IControl& control = session->deEnrollAsync(callbacks);
/// DE-ENROLLMENT IN PROGRESS, WAIT FOR RESULT VIA CALLBACKS
// we can optionally interrupt the running execution with this call
control.stop();
}
catch (const keyless::IException& e)
{
std::cerr << e.message() << std::endl;
}

Status updates

We may provide both deEnroll() and deEnrollAsync() methods with our implementation of IStatusCallbacks interface which will report enrollment progress.
class KeylessWndStatusCallbacks : public keyless::IStatusCallbacks
{
private:
void KEYLESS_SDK_CALL onFrameCapture(const keyless::IFrame& frame) noexcept override
{
// New frame capture from the camera, save it to be displayed to user
}
void KEYLESS_SDK_CALL onSessionStatus(keyless::SessionStatus status, const keyless::IException& e) noexcept override
{
// Overall execution status has changed
}
void KEYLESS_SDK_CALL onLivenessStatus(keyless::LivenessStatus status) noexcept override
{
// Liveness detection status has changed
}
void KEYLESS_SDK_CALL onRecognitionStatus(keyless::FaceRecognitionStatus status) noexcept override
{
// Face recognition status has changed
}
}