类介绍

DFSilentLivenessDetector

DFSilentLivenessDetector 用于构造对输入图像数据进行检测的对象。

初始化

/**
 *  初始化方法
 *
 *  @param strBundlePath        资源文件路径
 *  @param strLicensePath       授权文件路径
 *
 *  @return detector检测对象
 */
- (instancetype)initWithResourcesBundlePath:(NSString *)strBundlePath
                     licensePath:(NSString *)strLicensePath;

参数设置

/**
 *  设置参数
 *
 *  @param delegate     回调代理
 *  @param queue        回调队列
 */
- (void)setDelegate:(id <DFSilentLivenessDetectorDelegate>)delegate
      callBackQueue:(dispatch_queue_t)queue;
/**
 设置参数

 @param threshold 通过的阈值
 @param groupCount 需要检测通过的组数
 */
- (void)setThreshold:(float)threshold groupCount:(NSInteger)groupCount;
/**
 设置参数

 @param region 人脸检测区域
 @param faceMaxSizeRatio 待检测人脸大小占相机返回buffer图片的最大比例
 */
- (void)setFaceDetectedRegion:(CGRect)region faceMaxSizeRatio:(float)faceMaxSizeRatio;

检测

/**
 *  持续检测
 *
 *  @param sampleBuffer    相机回调sampleBuffer
 *  @param faceOrientation 人脸方向
 */
- (void)trackAndDetectWithCMSampleBuffer:(CMSampleBufferRef)sampleBuffer
                         faceOrientation:(LivefaceOrientation)faceOrientation;

开始检测

/**
 *  开始检测
 */
- (void)startDetection;

取消检测

/**
 *  取消检测
 */
- (void)cancelDetection;

版本号

/**
 *  获取版本号
 *
 *  @return SDK Version
 */
+ (NSString *)getSDKVersion;

DFSilentLivenessDetectorDelegate

检测回调

/**
 *  静默活体检测回调
 */
@protocol DFSilentLivenessDetectorDelegate <NSObject>

@optional

开始检测
/**
 *  开始检测
 */
- (void)livenessDidStart;
每帧图像检测的回调
/**
 每帧图像检测回调

 @param faceCount 人脸数
 @param faceRectStatus 人脸状态
 */
- (void)livenessDectectingFaceCount:(int)faceCount faceRectStatus:(LivefaceRectStatus)faceRectStatus;

@required

静默活体检测成功
/**
 *  成功回调
 *
 *  @param data    检测成功后的加密数据
 *  @param DFImage 图片
 *  @param successScore 最后成功帧得分(废弃)
 */
- (void)livenessDidSuccessfulGetData:(NSData *)data
                            dfImages:(NSArray *)arrDFImage
                        successScore:(float)successScore;
静默活体检测失败
/**
 *  失败回调
 *
 *  @param iErrorType 失败类型
 */
- (void)livenessDidFailWithErrorType:(LivefaceErrorType)iErrorType;
静默活体取消回调
/**
 *  取消回调
 */
- (void)livenessDidCancel;

LivefaceErrorType

错误类型枚举

类型 说明
LIVENESS_INIT_FAILD 初始化错误
LIVENESS_CAMERA_ERROR 相机权限错误
LIVENESS_WILL_RESIGN_ACTIVE 应用退入后台错误
LIVENESS_INTERNAL_ERROR 内部错误
LIVENESS_BUNDLEID_ERROR 包名错误
LIVENESS_AUTH_EXPIRE 授权文件过期错误

LivefaceDetectionType

检测类型枚举

类型 说明
LIVE_HOLDSTILL 静默活体

LivefaceOrientation

人脸方向枚举

类型 说明
LIVE_FACE_UP
LIVE_FACE_LEFT
LIVE_FACE_DOWN
LIVE_FACE_RIGHT

LivefaceOutputType

输出类型枚举

类型 说明
LIVE_OUTPUT_MULTI_IMAGE 多图

LivefaceRectStatus

人脸状态枚举

类型 说明
LivefaceRectStatusNone
LivefaceRectStatusSuccess 成功
LivefaceRectStatusLarge 过大

results matching ""

    No results matching ""