DFLivenessSDK Class Introduction

DFLivenessSDK(Context context)

The constructor function.

Parameter Description
Context Application context
Return Description
None None
boolean createHandle()

Create SDK handle.

Parameter Description
None None
Return Description
boolean True: create successful, false: create failed
boolean createHandle(String licenseName)

Create SDK handle with customized license name.

Parameter Description
licenseName License name
Return Description
boolean True: create successful, false: create failed
void setThreshold(DFLivenessKey key, float value)

Set liveness parameters.

Parameter Description
key The parameter key value, reference to: DFLivenessKey
value The value of key
Return Description
None None
void start(int config, DFLivenessSDK.DFLivenessMotion[] motions)

Start liveness detection.

Parameter Description
config Default format for output type:
output type reference to:DFLivenessSDK.DFLivenessOutputType
motions Silent detection list, reference to: DFLivenessMotion
Return Description
None None
static String getSDKVersion()

Return the SDK version.

Parameter Description
None None
Return Description
SDK version None
DFLivenessSDK.DFStatus detect(byte[] image, int width, int height, int rotateAngle, DFLivenessSDK.DFLivenessMotion motion)

Detect silent liveness in image.

Parameter Description
image Input image data.
width Image width
height Image height
rotateAngle Image orientation
motion The current action to be detected, reference to DFLivenessMotion, It MUST be HOLD_STILL or NONE
Return Description
DFStatus structure Reference to DFStatus
DFLivenessSDK.DFRect getFaceRect() throws Exception

Get face rectangle in the image, An exception is thrown when the call fails.

Parameter Description
None None
Return Description
DFLivenessSDK.DFRect Face rectangle
void end()

End liveness detection.

Parameter Description
None None
Return Description
None None
byte[] getLivenessResult() throws Exception

Get liveness detection result. An exception is thrown when the call fails.

Parameter Description
None None
Return Description
byte[] The encrypted liveness detection result
DFLivenessSDK.DFLivenessImageResult[] getImageResult() throws Exception

Get images from liveness detection. An exception is thrown when the call fails.

Parameter Description
None None
Return Description
DFLivenessSDK.DFLivenessImageResult[] DFLivenessSDK.DFLivenessImageResult contains imageBytes which is jpeg image buffer,length which is the length of imageBytes,motion which is the motion of imageBytes
void destroy()

Destroy the handle and recover the memory.

Parameter Description
None None
Return Description
None None

Internal Class Introduction

DFLivenessOutputType

Silent output type.

Type Description
WRAPPER_OUTPUT_TYPE_MULTI_IMAGE SDK will return several images, the images' number equals to the number of motions

DFLivenessMotion: liveness detection motion

Support liveness motion type.

Type Description
HOLD_STILL Hold still

DFDetectStatus

Liveness detection status, it uses to check current detection status.

Type Description
PASSED The detection is passed
DETECTING Detecting
INTERNAL_ERROR Detect error
TRACKING_MISSED Face lossing

DFStatus

Liveness detect result status.

int getDetectStatus()

Gets the status of the detect results.

Parameter Description
None None
Return Description
int Reference to DFDetectStatus
boolean isPassed()

Whether the current detection passes or not.

Parameter Description
None None
Return Description
boolean True: detection passes, false: detection fails
boolean isHasFace()

Whether there is a face in the image or not.

Parameter Description
None None
Return Description
boolean True: there is a face, false: there isn't a face
boolean isFaceValid()

Whether face is valid or not.

Parameter Description
None None
Return Description
boolean True: face is valid, false: face is invalid

DFLivenessKey

Liveness parameters key.

type description
KEY_HOLD_STILL_FRAME The interval number frames which HOLD_STILL motion do checking face position, default is 3
KEY_HOLD_STILL_POS The IOU value which calculate the current face with the initial face position. default is 0.95
KEY_SILENT_TIME_INTERVAL The time interval to detect one frame, default is 20(unit: millisecond)
KEY_SILENT_DETECT_NUMBER The number of groups of silent liveness
KEY_SILENT_FACE_RET_MAX_RATE The max percentage of face in the detect box
KEY_SILENT_FACE_OFFSET_RATE The max offset from the face to the center of the detect box

results matching ""

    No results matching ""