Passive Liveness Detection From Image

Declaration

func passiveLivenessDetectionFromImage(
    image: UIImage, 
    success: SybrinBiometrics.passiveLivenessDetectionSuccessCallbackType? = nil, 
    failure: SybrinBiometrics.failureCallbackType? = nil
)

To view all the type aliases, go to the SybrinBiometrics class

Handling the success or failure callbacks are optional but recommended.

Calling the function

Parameters

Type

Description

UIImage

The image you would like to perform passive liveness detection on.

Please ensure that the image conform to our guidelines and that only one face is visible.

Handling callback responses

success

The success callback will be executed after the session has finished and the view controller has been dismissed.

Parameters:

Type

Description

An object containing the results of the passive liveness detection session.

Example:

success: { (model) in
    print("Passive liveness detection finished. You are \(model.isAlive ? "\(model.livenessConfidence * 100)% alive" : "\((1 - model.livenessConfidence) * 100)% not alive")
}

failure

The failure callback will be executed after the session has failed and the view controller has been dismissed.

Parameters:

Type

Description

String

A message describing the error.

If you would like to report a bug, contact us!

Example:

failure: { (message) in
    print("Passive liveness detection failed because \(message)")
}

Full Example

let image = UIImage(named: "MyImage")

SybrinBiometrics.shared.passiveLivenessDetectionFromImage(image: image) 
{ (model) in
    print("Passive liveness detection finished. You are \(model.isAlive ? "\(model.livenessConfidence * 100)% alive" : "\((1 - model.livenessConfidence) * 100)% not alive")
failure: { (message) in
    print("Passive liveness detection failed because \(message)")
}

Last updated