DFLivenessSDK Class Description

DFActionLivenessDetector

DFActionLivenessDetector is the instance for detect input image data.

Init

/**
 *  Initialization method
 *
 *  @param dDurationPerModel    The maximum detection time allowed for each module. When the value is less than or equal to 0, the timeout period is not set.
 *  @param strBundlePath        Resource path
 *  @param strLicensePath       License path
 *
 *  @return detector instance
 */
- (instancetype)initWithDuration:(double)dDurationPerModel
             resourcesBundlePath:(NSString *)strBundlePath
                     licensePath:(NSString *)strLicensePath;

Parameter config

/**
 *  Detector configuration method
 *
 *  @param delegate     Callback delegate
 *  @param queue        Callback queue
 *  @param arrDetection Action sequence, such as @[@(LIVE_HOLDSTILL), @(LIVE_BLINK), @(LIVE_MOUTH), @(LIVE_NOD), @(LIVE_YAW)], refer to DFLivenessEnumType.h
 *  @param arrThreshold Threshold, such as @[@(0.7), @(0.7), @(0.7), @(0.7), @(0.7)]
 */
- (void)setDelegate:(id <DFActionLivenessDetectorDelegate>)delegate
      callBackQueue:(dispatch_queue_t)queue
  detectionSequence:(NSArray *)arrDetection
 detectionThreshold:(NSArray *)arrThreshold;
/**
 Setting configuration

 @param region face detected regon
 @param faceMaxSizeRatio face size ratio percentage
 */
- (void)setFaceDetectedRegion:(CGRect)region faceMaxSizeRatio:(float)faceMaxSizeRatio;
/**
 *
 *  @param iOutputType The output scheme after the successful detection, must be LIVE_OUTPUT_MULTI_IMAGE, Others do not support
 */
- (void)setOutputType:(LivefaceOutputType)iOutputType;

Detect

/**
 *  Continuous detection
 *
 *  @param sampleBuffer    sampleBuffer of camera
 *  @param faceOrientation face orientation
 */
- (void)trackAndDetectWithCMSampleBuffer:(CMSampleBufferRef)sampleBuffer
                         faceOrientation:(LivefaceOrientation)faceOrientation;

Start detection

/**
 *  Start detection
 */
- (void)startDetection;

Cancel detection

/**
 *  Cancel detection
 */
- (void)cancelDetection;

Version

/**
 *  Obtain the version of SDK
 *
 *  @return SDK Version
 */
+ (NSString *)getSDKVersion;

DFActionLivenessDetectorDelegate

Callback of detection

/**
 *  the callback of silent liveness detection
 */
@protocol DFActionLivenessDetectorDelegate <NSObject>

@optional

/**
 *  Callback method for each detection module
 *
 *  @param iDetectionType  The type of module that is currently being detecting
 *  @param iDetectionIndex The index of the module currently starting to be detected in the action sequence starts at 0.
 */
- (void)livenessDidStartDetectionWithDetectionType:(LivefaceDetectionType)iDetectionType
                                    detectionIndex:(int)iDetectionIndex;

/**
 *  Each frame of data is called back once, and the current module has been used for the time and the maximum processing time allowed by the current module
 *
 *  @param dPast             Current module detects elapsed time
 *  @param dDurationPerModel Current module detection total time
 */
- (void)livenessTimeDidPast:(double)dPast
           durationPerModel:(double)dDurationPerModel;

/** Frame rate */
- (void)videoFrameRate:(int)rate;

/**
 The number of faces per frame in silent live detection

 @param faceCount Face count
 @param faceRectStatus Face status
 @param iDetectionType  Detection module type
 */
- (void)livenessDectectingFaceCount:(int)faceCount faceRectStatus:(LivefaceRectStatus)faceRectStatus detectionType:(LivefaceDetectionType)iDetectionType;

@required

Action detecting successfully

/**
 *  Action detecting successfully callback
 *
 *  @param data       Pass back the encrypted binary data
 *  @param arrDFImage Return the DFImage array according to the specified output scheme. See DFImage.h for the DFImage property
 *  @param dfVideoData Return NSData video data according to the specified output scheme(nil)

 */
- (void)livenessDidSuccessfulGetData:(nullable NSData *)data
                            dfImages:(nullable NSArray *)arrDFImage
                         dfVideoData:(nullable NSData *)dfVideoData;

Action detecting failed callback

/**
 *  Action detecting failed callback
 *
 *  @param iErrorType      Type of failure
 *  @param iDetectionType  Detection module type on failure
 *  @param iDetectionIndex The index of the detection module in the action sequence when it fails, starting from 0
 *  @param data            Pass back the encrypted binary data
 *  @param arrDFImage      Return the DFImage array according to the specified output scheme. See DFImage.h for the DFImage property
 *  @param dfVideoData     Return NSData video data according to the specified output scheme(nil)
 */
- (void)livenessDidFailWithErrorType:(LivefaceErrorType)iErrorType
                       detectionType:(LivefaceDetectionType)iDetectionType
                      detectionIndex:(int)iDetectionIndex
                                data:(nullable NSData *)data
                            dfImages:(nullable NSArray *)arrDFImage
                         dfVideoData:(nullable NSData *)dfVideoData;

Action detecting cancelled callback

/**
 *  Action detecting canceled callback
 *
 *  @param iDetectionType  Detection module type when detection is canceled
 *  @param iDetectionIndex The index of the detection module in the action sequence when the detection is canceled, starting from 0
 */
- (void)livenessDidCancelWithDetectionType:(LivefaceDetectionType)iDetectionType
                            detectionIndex:(int)iDetectionIndex;

LivefaceErrorType

Error type enumeration

type description
LIVENESS_INIT_FAILD Init error
LIVENESS_CAMERA_ERROR Camera authority error
LIVENESS_FACE_CHANGED Face change error
LIVENESS_TIMEOUT Detection timeout error
LIVENESS_WILL_RESIGN_ACTIVE App enters background
LIVENESS_INTERNAL_ERROR Inner error
LIVENESS_BUNDLEID_ERROR BundleID error
LIVENESS_AUTH_EXPIRE License error
LIVENESS_SEQUENCE_ERROR Action sequence error (starting with silence and only one silent action) error
LIVENESS_FACE_MORE_THAN_ONE_ERROR Face more than one error

LivefaceDetectionType

Detection type enumeration

type description
LIVE_BLINK Blink detection
LIVE_MOUTH Open mouth detection
LIVE_YAW Left and right rotor detection
LIVE_NOD Up and down nodding detection
LIVE_HOLDSTILL Silent liveness detection

LivefaceOrientation

Face direction enumeration

type description
LIVE_FACE_UP Up
LIVE_FACE_LEFT Left
LIVE_FACE_DOWN Down
LIVE_FACE_RIGHT Right

LivefaceOutputType

Output type enumeration

type description
LIVE_OUTPUT_MULTI_IMAGE Multi image type

LivefaceRectStatus

Face state enumeration

type description
LivefaceRectStatusNone None
LivefaceRectStatusSuccess Success
LivefaceRectStatusLarge Face size is large

results matching ""

    No results matching ""