LFLivenessEnumType

LFLivenessEnumType类说明了活体检测所用到的枚举类型。

typedef NS_ENUM(NSInteger, LivefaceErrorType)

活体检测失败类型。

类型 说明
LIVENES_INIT_FAILD 算法SDK初始化失败
LIVENESS_CAMERA_ERROR 相机权限获取失败
LIVENESS_FACE_CHANGED 人脸变更
LIVENESS_TIMEOUT 检测动作超时
LIVENESS_WILL_RESIGN_ACTIVE 应用即将被挂起(进入后台)
LIVENESS_INTERNAL_ERROR 内部错误
LIVENESS_BUNDLEID_ERROR 包名错误
LIVENESS_AUTH_EXPIRE 账号过期

示例代码:

- (void)livenessDidFailWithErrorType:(LivefaceErrorType)iErrorType detectionType:(LivefaceDetectionType)iDetectionType detectionIndex:(int)iDetectionIndex data:(NSData *)data lfImages:(NSArray *)arrLFImage lfVideoData:(NSData *)lfVideoData
{
    LFMultipleLivenessError iLFMultipleError = 0;
    switch (iErrorType) {
        case LIVENESS_INIT_FAILD:
        {
            iLFMultipleError = LFMultipleLivenessInitFaild;
        }
            break;

        case LIVENESS_CAMERA_ERROR:
        {
            iLFMultipleError = LFMultipleLivenessCameraError;
        }
            break;

        case LIVENESS_FACE_CHANGED:
        {
            iLFMultipleError = LFMultipleLivenessFaceChanged;
        }
            break;

        case LIVENESS_INTERNAL_ERROR:
        {
            iLFMultipleError = LFMultipleLivenessInternalError;
        }
            break;

        case LIVENESS_TIMEOUT:
        {
            iLFMultipleError = LFMultipleLivenessTimeOut;
        }
            break;


        case LIVENESS_WILL_RESIGN_ACTIVE:
        {
            iLFMultipleError = LFMultipleLivenessWillResignActive;
        }
            break;
        case LIVENESS_BUNDLEID_ERROR:
        {
            iLFMultipleError = LFMultipleLivenessBundleIDError;
        }
            break;
        case LIVENESS_AUTH_EXPIRE:
        {
            iLFMultipleError = LFMultipleLivenessAuthExpire;
        }
            break;
        case LIVENESS_LICENSE_ERROR:
        {
            iLFMultipleError = LFMultipleLivenessLicenseError;
        }
            break;
        case LINENESS_MODEL_EXPIRE:{
            iLFMultipleError = LFMultipleLivenessModelError;
        }
            break;
        case LINENESS_MODEL_SOURCE:{
            iLFMultipleError = LFMultipleLivenessSourceError;
        }
            break;
        case LINENESS_OTHER_ERROR:{
            iLFMultipleError = LFMultipleLivenessOtherError;
        }
            break;
        default:
            break;
    }

typedef NS_ENUM(NSInteger, LivefaceDetectionType)

检测模块类型。枚举类型定义了眨眼、点头、张嘴、摇头四种。

类型 说明
LIVE_NONE 未定义类型
LIVE_BLINK 眨眼检测
LIVE_NOD 上下点头检测
LIVE_MOUTH 张嘴检测
LIVE_YAW 左右转头检测

示例代码:

- (void)livenessDidStartDetectionWithDetectionType:(LivefaceDetectionType)iDetectionType detectionIndex:(int)iDetectionIndex{
        可以拿到返回数据类型
}

typedef NS_ENUM(NSUInteger, LivefaceOrientation)

人脸方向。枚举类型定义了上、下、左、右四个方向。

类型 说明
LIVE_FACE_UP 人脸向上,即人脸朝向正常
LIVE_FACE_LEFT 人脸向左,即人脸被逆时针旋转了90度
LIVE_FACE_DOWN 人脸向下,即人脸被逆时针旋转了180度
LIVE_FACE_RIGHT 人脸向右,即人脸被逆时针旋转了270度

示例代码:

[self.detector trackAndDetectWithCMSampleBuffer:sampleBuffer faceOrientation:LIVE_FACE_LEFT];

typedef NS_ENUM(NSUInteger, LivefaceComplexity)

活体检测复杂度。

类型 说明
LIVE_COMPLEXITY_EASY 简单, 人脸变更时不会回调 LIVENESS_FACE_CHANGED 错误, 活体阈值低
LIVE_COMPLEXITY_NORMAL 正常, 人脸变更时会回调 LIVENESS_FACE_CHANGED 错误, 活体阈值较低
LIVE_COMPLEXITY_HARD 困难, 人脸变更时会回调 LIVENESS_FACE_CHANGED 错误, 活体阈值较高
LIVE_COMPLEXITY_HELL 地狱, 人脸变更时会回调 LIVENESS_FACE_CHANGED 错误, 活体阈值最高

示例代码:

[livefaceVC setOutputType:iOutputType complexity:iComplexity];

results matching ""

    No results matching ""