Skip to content

Configuration#

Applies to LUNA ID for Android only.

LunaConfig#

LunaConfig is the main configuration class. It defines all parameters that control face detection, best shot selection, quality requirements, Liveness estimations, and other behaviors. Instances are created using the LunaConfig.create() method.

Detection parameters#

Parameter Type Default Range Description
detectorStep Int 7 [0..30] Specifies a number of frames between frames with full face detection.
skipFrames Int 18 [0..50] Specifies a number of frames to wait until a face is detected in the face recognition area before stopping video recording.
minimalTrackLength Int 1 [0..10] Specifies a minimum number of detections required to confirm a real face in a video track.
minFaceSize Int 50 [20..350] Specifies a minimum acceptable face size in pixels. Faces smaller than this are ignored.
Higher values improve performance by focusing on larger, more prominent faces and reducing noise from distant subjects.
Lower values allow detection of smaller faces but may increase processing time and false positives.

Best shot parameters#

Parameter Type Default Range Description
bestShotsCount Int 1 [1..10] Specifies a number of best shots to collect for a OneShotLiveness estimation.
bestShotInterval Long 500 [0..10000] Specifies a minimum time interval, in milliseconds, between best shots.
foundFaceDelayMs Long 0 - Specifies a delay, in milliseconds, to define for how long a user's face should be placed in the face detection bounding box before the best shot is taken.

Quality parameters#

Parameter Type Default Range Description
headPitch Float 25.0 [0..45] Specifies head tilt up or down in degrees.
headYaw Float 25.0 [0..45] Specifies head roll left or right in degrees.
headRoll Float 25.0 [0..45] Specifies head tilt left or right in degrees.
ags Float 0.5 [0.0..1.0] Specifies an AGS threshold for further descriptor extraction and matching.
blurThreshold Float 0.61 [0.01..1.0] Specifies a threshold that determines whether the image is blurred.
lightThreshold Float 0.57 [0.01..1.0] Specifies a threshold that determines whether the image is overexposed, that is, too light.
darknessThreshold Float 0.5 [0.01..1.0] Specifies a threshold that determines whether the image is underexposed, that is, too dark.
livenessQuality Float 0.5 [0.0..1.0] Specifies a OneShotLiveness estimation threshold lower which the system will consider the result as a presentation attack.

Liveness parameters#

Parameter Default value Description
livenessType: LivenessType LivenessType.None Specifies a OneShotLiveness estimation type.
LivenessType.None N/A Disables OneShotLiveness estimation.
LivenessType.Online N/A Enables Online OneShotLiveness estimation.
LivenessType.Offline N/A Enables Offline OneShotLiveness estimation.
livenessFormat: CompressFormat CompressFormat.JPEG Specifies an image format for OneShotLiveness estimation.
livenessCompressionQuality: Int 50 Specifies a quality of the image to be sent to OneShotLiveness estimation. Value 0 represents the maximum compression. Values range from 20 to 350.
livenessNetVersion: LivenessNetVersion LivenessNetVersion.MOBILE Specifies neural networks to be used for Offline OneShotLiveness estimation.
faceSimilarityThreshold: Float 0.5 Determines whether the face that was first detected in the face recognition area remains the same. Values range from 0.01 to 1.0.

Face acceptance parameters#

Parameter Type Default value Description
acceptOneEyed Boolean false Specifies whether frames that contain faces with one closed eye can be best shots. Requires the acceptOneEyed property to be enabled. For details, see Performing Dynamic Liveness estimation.
acceptEyesClosed Boolean false Specifies whether an image with two closed eyes will be considered the best shot. Requires the lunaid-common-arm-X.X.X.aar dependency.
acceptOccludedFaces Boolean true Specifies whether an image with an occluded face will be considered the best shot. Requires the lunaid-mask-X.X.X.aar dependency.
acceptMask Boolean true Specifies whether faces wearing medical masks are allowed in best shot selection.
glassesChecks Set<GlassesCheckType> empty set Specifies what images with glasses can be best shots.

Other parameters#

Parameter Type Default value Description
interactionDelayMs Long 0 Specifies a timeout between Dynamic Liveness estimation interactions, in milliseconds. This means that a new interaction will start after the preceding one ends after the timeout has passed.
usePrimaryFaceTracking Boolean true Specifies whether to track the face that was detected in the face recognition area first. Requires the lunaid-cnn60-X.X.X.aar dependency.
multipartBestShotsEnabled Boolean false Enables or disables collecting multiple best shots.
savingInteractionFrames Boolean false Enables or disables saving interaction frames.
strictlyMinSize Boolean false Specifies whether the minFaceSize parameter will be considered during face detection.
descriptorVersion Int V60 Determines the model version used for descriptor generation or comparison.
useDescriptors Boolean true Enables or disables descriptor-related functionality in LUNA ID.

Configuration creation example#

val config = LunaConfig.create( 
    livenessType = LivenessType.Offline, 
    bestShotsCount = 3, 
    headPitch = 20f, 
    headYaw = 20f, 
    acceptMask = false, 
    multipartBestShotsEnabled = true
)