Performing Dynamic Liveness estimation#
Dynamic Liveness estimation aims to determine whether a person is alive by interacting with a camera in your app.
Interaction types#
To perform the Dynamic Liveness estimation, you can implement the following user interaction types:
- Blinking.
- Head rotation to the left along the Y axis.
- Head rotation to the right along the Y axis.
- Head pitch up along the X axis.
- Head pitch down along the X axis.
The picture below shows head rotation angles.
In LUNA ID for Android#
By default, all user interactions with a camera are disabled.The Dynamic Liveness estimation does not start.
To enable the estimation, pass the Interactions
argument to LunaID.showCamera()
. For example:
public fun showCamera(
...
interactions: Interactions = Interactions()
)
Interactions
is a container for interaction parameters. You can add the following interactions to it:
Parameter | Description |
---|---|
YawLeftInteraction |
Enables user interaction via rotating the head to the left along the Y axis. |
YawRightInteraction |
Enables user interaction via rotating the head to the right along the Y axis. |
PitchUpInteraction |
Enables user interaction via pitching the head up along the X axis. |
PitchDownInteraction |
Enables user interaction via pitching the head down along the X axis. |
BlinkInteraction |
Enables user interaction via blinking. |
Important notes:
- You can specify each parameter only once.
- The interaction parameters will be launched in the order you specify them in your code.
Each interaction type has the timeoutMs
parameter. It determines the time during which this interaction must be completed.
The YawLeftInteraction
, YawRightInteraction
, PitchUpInteraction
, and PitchDownInteraction
interactions have the startAngleDeg
and endAngleDeg
parameters. The parameters determine the angle at which the user must rotate their head for the interaction to be considered successful.
If an interaction fails, the flow of getting the best shot finishes, and LunaID.allEvents()
receives the InteractionFailed
event.
In LUNA ID for iOS#
To implement user interactions with a camera, pass appropriate values for the livenessAPI
and configuration
parameters to the LMCameraBuilder.viewController
camera controller instance creation function:
let controller = LMCameraBuilder.viewController(delegate: self,
configuration: LCLunaConfiguration,
livenessAPI: livenessAPI)
Parameter | Description |
---|---|
configuration |
The parameter is represented by the LCLunaConfiguration structure. The LCLunaConfiguration → InteractionEnabled = true parameter is responsible for interaction with the camera. |
livenessAPI |
The API should be of type LunaWeb.LivenessAPIv6 . |
The API accepts the configuration
parameter, which contains all the necessary settings for checking Dynamic Liveness.
The interaction generator produces a random sequence of interactions. It selects only two interactions from the interaction types list.