3.1 SilentLivenessApi
public final class SilentLivenessApi
Last updated
public final class SilentLivenessApi
Last updated
Initialization method.
Set whether to perform eyebrow occlusion detection during liveness detection, false by default.
Set whether to perform blurriness detection during liveness detection, false by default. The threshold is 1.4 by default.
Set whether to perform brightness detection during liveness detection, false by default. The low light threshold is 1.899 by default. The bright light threshold is 4.997 by default.
Set the threshold used to judge the eye-opening during liveness detection.
Set whether to perform occlusion detection during liveness detection, true by default.
Set the threshold for liveness detection, 0.88 by default.
The maximum detection time allowed for each module, the default value is 10s, the unit is in seconds.
Set the judgment condition for the face distance.
Liveness detector configuration. Input image for detection.
Ready to start detection. Call before inputData
and after init
.
Release resources after calling init
. The resources must be released through release
.
Stop the current detection, and reset the detection status. This method is used to retry after failure. If stop
is called after init
succeeded and before release
), detection can be restarted directly by start
.
Obtain the setting whether eyebrow occlusion detection switch status. Should be called after init
to get the correct result. Otherwise, it will return false, and the correct settings for the eyebrow occlusion cannot be obtained.
Obtain the setting whether blurriness detection switch status. Should be called after init
to get the correct result. Otherwise, it will return false, and the correct settings for the blurriness cannot be obtained.
Obtain the setting whether brightness detection switch status. Should be called after init
to get the correct result. Otherwise, it will return false, and the correct settings for the brightness cannot be obtained.
Obtain the setting whether occlusion detection switch status. Should be called after init
to get the correct result. Otherwise, it will return false, and the correct settings for the occlusion cannot be obtained.
Obtain the threshold of liveness detection. Should be called after init
to get the correct result. Otherwise, it will return -1.0.
Obtain the detection timeout time. Should be called after init
to get the correct result. Otherwise, it will return -1, indicating that the correct timeout setting can not be obtained.
Obtain the shortest detection time that can pass the liveness detection. Should be called after init
to get the correct result. Otherwise, it will return -1.
Obtain the minimum number of detection frames that can pass the liveness detection. Should be called after init
to get the correct result. Otherwise, it will return -1.
Obtain the farthest face distance threshold in the judgment condition. Should be called after init
to get the correct result. Otherwise, it will return -1.
Obtain the closest face distance threshold in the judgment condition. Should be called after init
to get the correct result. Otherwise, it will return -1.
Get the current SDK version number.
Get the version number of the current internal library. After init
succeeded, call this method to get the correct version number of the internal library.
Parameter
Type
Description
context
Context
Application information context
licenseFilePath
String
Storage path of the license file on the device
detectionModelFilePath
String
Storage path of the face detection model file on the device
qualityModelFilePath
String
Storage path of the quality model file on the device
alignmentModelFilePath
String
Storage path of the alignment model file on the device
frameSelectorModelFilePath
String
Storage path of the frame selector model file on the device
antiSpoofingModelFilePath
String
Storage path of anti-spoofing model files on the device
listener
OnLivenessListener
OnLivernessListener (Liveness detection status listener, when set to empty, it cannot be initialized.)
Return value
Description
None
None
Parameter
Type
Description
enable
boolean
Set whether to perform eyebrow occlusion detection during liveness detection, false by default.
Return value
Description
None
None
Parameter
Type
Description
enable
boolean
Set whether to perform blurriness detection during liveness detection, false by default.
threshold
float
The threshold of blurriness detection between [0, 5], the result score higher than the threshold means blurry.
Return value
Description
None
None
Parameter
Type
Description
enable
boolean
Set whether to perform brightness detection during liveness detection, false by default.
lowLightThreshold
float
The threshold used to judge whether it is too dark. The value range is [0,6]. If the detection result score is smaller than the threshold, it is considered too dark. The default threshold is 1.899. When it is set to 0, it means that the dark brightness detection is turned off.
brightThreshold
float
The threshold used to judge whether it is too bright. The value range is [0,6]. If the detection result score is larger than the threshold, it is considered too bright. The default threshold is 4.997. When it is set to 6, it means that the bright brightness detection is turned off.
Return value
Description
None
None
Parameter
Type
Description
threshold
float
The threshold used to judge the eye-opening. The value range is [0,1]. If the detection result score is larger than the threshold, it is considered eye-opening. The suggested threshold is 0.47. When it is set to 0, it means that the eye-opening detection is turned off.
Return value
Description
None
None
Parameter
Type
Description
enable
boolean
Set whether to perform occlusion detection during liveness detection, true by default.
Return value
Description
None
None
Parameter
Type
Description
threshold
float
threshold for liveness detection
Return value
Description
None
None
Parameter
Type
Description
timeout
int
Set the timeout time in seconds, which is the maximum detection time allowed for each detection. The default timeout time is 10s. If the value is less than 0, STID_E_INVALID_ARGUMENTS error is reported, if it is 0, no timeout is allowed, if it is greater than 0, timeout is set to this value.
Return value
Description
None
None
Parameter
Type
Description
farRate
float
The ratio of face height/width to the short edge of the image. The value can be set between [0.0 - 1.0]. The closer the parameter is to 0, the farther the face is away from the screen. The default value is 0.4. When set to 0, there will be no distance prompt.
closeRate
float
The ratio of face height/width to the short edge of the image. The value can be set between [0.0 - 1.0]. The closer the parameter is to 1, the closer the face is to the screen. The default value is 0.8. When set to 0, there will be no distance prompt.
Return value
Description
None
None
Parameter
Type
Description
image
byte[]
Image frame data to be detected
format
`PixelFormat
Image frame data type
previewSize
Size
Image size
containerRect
Rect
Preview view size
frontCameraOrNot
boolean
Whether it is a front camera. True is yes, false is no.
cameraOrientation
int
Camera image orientation
Return value
Description
None
None
Parameter
Description
None
None
Return value
Description
None
None
Parameter
Description
None
None
Return value
Description
None
None
Parameter
Description
None
None
Return value
Description
None
None
Parameter
Description
None
None
Return value
Description
boolean
True indicates eyebrow occlusion detection is turned on, false indicates eyebrow occlusion detection is turned off.
Parameter
Description
None
None
Return value
Description
boolean
True indicates blurriness detection is turned on, false indicates blurriness detection is turned off.
Parameter
Description
None
None
Return value
Description
boolean
True indicates brightness detection is turned on, false indicates brightness detection is turned off.
Parameter
Description
None
None
Return value
Description
boolean
True indicates occlusion detection is turned on, false indicates occlusion detection is turned off.
Parameter
Description
None
None
Return value
Description
float
The threshold for liveness detection.
Parameter
Description
None
None
Return value
Description
int
Detection timeout time (in seconds)
Parameter
Description
None
None
Return value
Description
int
The shortest time for passing the liveness detection (in seconds)
Parameter
Description
None
None
Return value
Description
int
Minimum number of detection frames
Parameter
Description
None
None
Return value
Description
float
Farthest distance threshold
Parameter
Description
None
None
Return value
Description
float
Closest distance threshold
Parameter
Description
None
None
Return value
Description
String
Current SDK version number
Parameter
Description
None
None
Return value
Description
String
Get the version of the current internal library