feat: 自定义插件的更新
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// QualityUtil.h
|
||||
// IDLFaceSDK
|
||||
//
|
||||
// Created by Tong,Shasha on 2017/5/24.
|
||||
// Copyright © 2017年 Baidu. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
|
||||
@interface BDFaceQualityUtil : NSObject
|
||||
+ (CGRect)getFaceRect:(NSArray *) trackingPoints withCount:(NSUInteger) count;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// Util.h
|
||||
// IDLFaceSDK
|
||||
//
|
||||
// Created by Tong,Shasha on 2017/5/24.
|
||||
// Copyright © 2017年 Baidu. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#define FACESDK_BUNDLE_Name @"com.baidu.idl.face.faceSDK.bundle"
|
||||
#define FACESDK_BUNDLE [[NSBundle alloc] initWithPath:[[NSBundle mainBundle] pathForResource:FACESDK_BUNDLE_Name ofType:nil]]
|
||||
|
||||
@interface BDFaceUtil : NSObject
|
||||
|
||||
+ (CGRect)convertRectFrom:(CGRect)imageRect image:(UIImage *)image previewRect:(CGRect)previewRect;
|
||||
|
||||
+ (NSString *)iphoneType;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,441 @@
|
||||
//
|
||||
// FaceSDKManager.h
|
||||
// IDLFaceSDK
|
||||
//
|
||||
// Created by Tong,Shasha on 2017/5/15.
|
||||
// Copyright © 2017年 Baidu. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
|
||||
typedef NS_ENUM(NSInteger, FaceLivenessActionType) {
|
||||
FaceLivenessActionTypeLiveEye = 0,
|
||||
FaceLivenessActionTypeLiveMouth = 1,
|
||||
FaceLivenessActionTypeLiveYawRight = 2,
|
||||
FaceLivenessActionTypeLiveYawLeft = 3,
|
||||
FaceLivenessActionTypeLivePitchUp = 4,
|
||||
FaceLivenessActionTypeLivePitchDown = 5,
|
||||
FaceLivenessActionTypeLiveYaw = 6,
|
||||
FaceLivenessActionTypeNoAction = 7,
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSUInteger, ResultCode) {
|
||||
ResultCodeOK,
|
||||
ResultCodePitchOutofDownRange, //头部偏低
|
||||
ResultCodePitchOutofUpRange, //头部偏高
|
||||
ResultCodeYawOutofLeftRange, //头部偏左
|
||||
ResultCodeYawOutofRightRange, //头部偏右
|
||||
ResultCodeTooBrightIllumination, // 光线过亮
|
||||
ResultCodePoorIllumination, //光照不足
|
||||
ResultCodeNoFaceDetected, //没有检测到人脸
|
||||
ResultCodeDataNotReady,
|
||||
ResultCodeDataHitOne, //采集到一张照片
|
||||
ResultCodeDataHitLast, //采集到最后一张照片
|
||||
ResultCodeImageBlured, //图像模糊
|
||||
ResultCodeOcclusionLeftEye, //左眼有遮挡
|
||||
ResultCodeOcclusionRightEye, //右眼有遮挡
|
||||
ResultCodeOcclusionNose, //鼻子有遮挡
|
||||
ResultCodeOcclusionMouth, //嘴巴有遮挡
|
||||
ResultCodeOcclusionLeftContour, //左脸颊有遮挡
|
||||
ResultCodeOcclusionRightContour, //右脸颊有遮挡
|
||||
ResultCodeOcclusionChinCoutour, //下颚有遮挡
|
||||
ResultCodeVerifyInitError, //鉴权失败
|
||||
ResultCodeVerifyDecryptError,
|
||||
ResultCodeVerifyInfoFormatError,
|
||||
ResultCodeVerifyExpired,
|
||||
ResultCodeVerifyMissRequiredInfo,
|
||||
ResultCodeVerifyInfoCheckError,
|
||||
ResultCodeVerifyLocalFileError,
|
||||
ResultCodeVerifyRemoteDataError,
|
||||
ResultCodeLeftEyeClosed,
|
||||
ResultCodeRightEyeClosed,
|
||||
ResultCodeUnknowType //未知类型
|
||||
};
|
||||
|
||||
|
||||
typedef NS_ENUM(NSUInteger, TrackResultCode) {
|
||||
TrackResultCodeOK,
|
||||
TrackResultCodeImageBlured, // 图像模糊
|
||||
TrackResultCodePoorIllumination, // 光照不行
|
||||
TrackResultCodeNoFaceDetected, //没有检测到人脸
|
||||
TrackResultCodeOcclusionLeftEye, //左眼有遮挡
|
||||
TrackResultCodeOcclusionRightEye, //右眼有遮挡
|
||||
TrackResultCodeOcclusionNose, //鼻子有遮挡
|
||||
TrackResultCodeOcclusionMouth, //嘴巴有遮挡
|
||||
TrackResultCodeOcclusionLeftContour, //左脸颊有遮挡
|
||||
TrackResultCodeOcclusionRightContour, //右脸颊有遮挡
|
||||
TrackResultCodeOcclusionChinCoutour, //下颚有遮挡
|
||||
TrackResultCodeVerifyInitError, //鉴权失败
|
||||
TrackResultCodeVerifyDecryptError,
|
||||
TrackResultCodeVerifyInfoFormatError,
|
||||
TrackResultCodeVerifyExpired,
|
||||
TrackResultCodeVerifyMissRequiredInfo,
|
||||
TrackResultCodeVerifyInfoCheckError,
|
||||
TrackResultCodeVerifyLocalFileError,
|
||||
TrackResultCodeVerifyRemoteDataError,
|
||||
TrackResultCodeUnknowType //未知类型
|
||||
};
|
||||
|
||||
|
||||
@class FaceInfo;
|
||||
@class FaceLivenessState;
|
||||
@class FaceCropImageInfo;
|
||||
|
||||
@interface FaceSDKManager : NSObject
|
||||
/* 超时时间 */
|
||||
@property (nonatomic, assign) CGFloat conditionTimeout;
|
||||
/* 语音超时*/
|
||||
@property (nonatomic, assign) CGFloat intervalOfVoiceRemind;
|
||||
/* 输出图像个数 */
|
||||
@property (nonatomic, assign) int imageNum;
|
||||
/* 图像加密类型,默认0 */
|
||||
@property (nonatomic, assign) int imageEncrypteType;
|
||||
/* 图像加密类型,默认0 */
|
||||
@property (nonatomic, assign) float minRectScale;
|
||||
/* 图片计数器,用来计当前图片的数量*/
|
||||
@property (nonatomic, assign) int currentNum;
|
||||
|
||||
+ (instancetype)sharedInstance;
|
||||
|
||||
/**
|
||||
* 获取版本号
|
||||
*/
|
||||
- (NSString *)getVersion;
|
||||
|
||||
/**
|
||||
* 重置计数器
|
||||
*/
|
||||
- (void)reset;
|
||||
|
||||
/**
|
||||
* 获取设备zid 公安验证上传
|
||||
*/
|
||||
- (NSString *)getZtoken;
|
||||
|
||||
/**
|
||||
* SDK鉴权方法-文件授权
|
||||
* SDK鉴权方法 必须在使用其他方法之前设置,否则会导致SDK不可用
|
||||
*
|
||||
* @param licenseID 授权ID
|
||||
* @param licensePath 本地鉴权文件路径
|
||||
* @param remoteAuthorize 是否远程更新过期鉴权文件
|
||||
*/
|
||||
- (void)setLicenseID:(NSString *)licenseID andLocalLicenceFile:(NSString *)licensePath andRemoteAuthorize:(BOOL)remoteAuthorize;
|
||||
|
||||
/**
|
||||
* 初始化采集功能
|
||||
*/
|
||||
- (int) initCollect;
|
||||
|
||||
/**
|
||||
* 卸载采集功能
|
||||
*/
|
||||
- (int)uninitCollect;
|
||||
|
||||
/**
|
||||
* 判断授权是否通过,true 表示通过,false 表示不通过
|
||||
*/
|
||||
- (BOOL)canWork;
|
||||
|
||||
/**
|
||||
* 设置预测库耗能模式
|
||||
* 默认 LITE_POWER_NO_BIND
|
||||
*/
|
||||
- (void)setLitePower:(int)litePower;
|
||||
|
||||
/**
|
||||
* 需要检测的最大人脸数目
|
||||
* 默认1
|
||||
*/
|
||||
- (void)setMaxDetectNum:(int)detectNum ;
|
||||
|
||||
/**
|
||||
* 需要检测的最小人脸大小
|
||||
* 默认40
|
||||
*/
|
||||
- (void)setMinFaceSize:(int)width;
|
||||
|
||||
/**
|
||||
* 人脸置信度阈值(检测分值大于该阈值认为是人脸
|
||||
* RGB
|
||||
* 默认 0.5f
|
||||
*/
|
||||
- (void)setNotFaceThreshold:(CGFloat)thr ;
|
||||
|
||||
/**
|
||||
* 质量检测遮挡阈值
|
||||
* 默认0.5
|
||||
*/
|
||||
- (void)setOccluThreshold:(CGFloat)thr ;
|
||||
|
||||
/**
|
||||
* 质量检测遮挡阈值-左眼遮挡置信度
|
||||
* 默认0.31
|
||||
*/
|
||||
-(void)setOccluLeftEyeThreshold:(CGFloat)thr ;
|
||||
|
||||
/**
|
||||
* 质量检测遮挡阈值- 右眼遮挡置信度
|
||||
* 默认0.31
|
||||
*/
|
||||
-(void)setOccluRightEyeThreshold:(CGFloat)thr ;
|
||||
|
||||
/**
|
||||
* 质量检测遮挡阈值-鼻子遮挡置信度
|
||||
* 默认0.27
|
||||
*/
|
||||
-(void)setOccluNoseThreshold:(CGFloat)thr ;
|
||||
|
||||
/**
|
||||
* 质量检测遮挡阈值-嘴巴遮挡置信度
|
||||
* 默认0.2
|
||||
*/
|
||||
-(void)setOccluMouthThreshold:(CGFloat)thr ;
|
||||
|
||||
/**
|
||||
* 质量检测遮挡阈值-左脸遮挡置信度
|
||||
* 默认0.48
|
||||
*/
|
||||
-(void)setOccluLeftCheekThreshold:(CGFloat)thr ;
|
||||
|
||||
/**
|
||||
* 质量检测遮挡阈值-右脸遮挡置信度
|
||||
* 默认0.48
|
||||
*/
|
||||
-(void)setOccluRightCheekThreshold:(CGFloat)thr ;
|
||||
|
||||
/**
|
||||
* 质量检测遮挡阈值-下巴遮挡置信度
|
||||
* 默认0.4
|
||||
*/
|
||||
-(void)setOccluChinThreshold:(CGFloat)thr ;
|
||||
|
||||
|
||||
/**
|
||||
* 最大光照阈值
|
||||
*/
|
||||
- (void)setMaxIllumThreshold:(CGFloat)thr;
|
||||
|
||||
/**
|
||||
* 最小光照阈值
|
||||
*/
|
||||
- (void)setMinIllumThreshold:(CGFloat)thr ;
|
||||
|
||||
/**
|
||||
* 质量检测模糊阈值
|
||||
* 默认0.5
|
||||
*/
|
||||
- (void)setBlurThreshold:(CGFloat)thr ;
|
||||
|
||||
/**
|
||||
* 姿态检测阈值
|
||||
* 默认pitch=12,yaw=12,row=10
|
||||
*/
|
||||
- (void)setEulurAngleThrPitch:(float)pitch yaw:(float)yaw roll:(float)roll ;
|
||||
|
||||
/**
|
||||
* 输出图像个数
|
||||
* 默认3
|
||||
*/
|
||||
- (void)setMaxCropImageNum:(int)imageNum ;
|
||||
|
||||
/**
|
||||
* 输出图像宽,设置为有效值(大于0)则对图像进行缩放,否则输出原图抠图结果
|
||||
* 默认 480
|
||||
*/
|
||||
- (void)setCropFaceSizeWidth:(CGFloat)width ;
|
||||
|
||||
/**
|
||||
* 输出图像高,设置为有效值(大于0)则对图像进行缩放,否则输出原图抠图结果
|
||||
* 默认 680
|
||||
*/
|
||||
- (void)setCropFaceSizeHeight:(CGFloat)height ;
|
||||
|
||||
/**
|
||||
* 输出图像,下巴扩展,大于等于0,0:不进行扩展
|
||||
* 默认0.1
|
||||
*/
|
||||
- (void)setCropChinExtend:(CGFloat)chinExtend ;
|
||||
|
||||
/**
|
||||
* 输出图像,额头扩展,大于等于0,0:不进行扩展
|
||||
* 默认0.2
|
||||
*/
|
||||
- (void)setCropForeheadExtend:(CGFloat)foreheadExtend ;
|
||||
|
||||
/**
|
||||
* 输出图像,人脸框与背景比例,大于等于1,1:不进行扩展
|
||||
* 默认1.5f
|
||||
*/
|
||||
- (void)setCropEnlargeRatio:(float)cropEnlargeRatio;
|
||||
|
||||
/**
|
||||
* 动作超时配置
|
||||
*/
|
||||
- (void)setConditionTimeout:(CGFloat)timeout ;
|
||||
|
||||
/**
|
||||
* 语音间隔提醒配置
|
||||
*/
|
||||
- (void)setIntervalOfVoiceRemind:(CGFloat)timeout;
|
||||
|
||||
/**
|
||||
* 是否开启静默活体,默认false
|
||||
*/
|
||||
// - (void)setIsCheckSilentLive:(BOOL)isCheck;
|
||||
|
||||
/**
|
||||
* 静默活体阈值配置,默认0.8。
|
||||
* 大于阈值返回图片,低于阈值返回未检测到人脸
|
||||
*/
|
||||
// - (void)setSilentLiveThreshold:(CGFloat)thr ;
|
||||
|
||||
/**
|
||||
* 设置原始图片缩放比例,默认1不缩放,scale 阈值0~1
|
||||
*/
|
||||
- (void)setImageWithScale:(CGFloat)scale;
|
||||
|
||||
/**
|
||||
* 设置图片加密类型,type=0 基于base64 加密;type=1 基于百度安全算法加密
|
||||
*/
|
||||
- (void)setImageEncrypteWithType:(int) type;
|
||||
|
||||
/**
|
||||
* 人脸过远框比例 默认:0.4
|
||||
*/
|
||||
- (void)setMinRect:(float) minRectScale;
|
||||
/**
|
||||
* 采集动作验证
|
||||
* @param image 检测的图片
|
||||
* @param isOriginal 是否返回原始图片
|
||||
* @param completion 判断采集是否完成,人脸信息状态是否正常
|
||||
*/
|
||||
- (void)detectWithImage:(UIImage *)image isRreturnOriginalValue:(BOOL) isOriginal completion:(void (^)(FaceInfo *faceinfo, ResultCode resultCode))completion;
|
||||
|
||||
/**
|
||||
* 动作活体动作验证
|
||||
* @param image 检测的图片
|
||||
* @param actionLiveType 当前要求做的动作
|
||||
* @param completion 判断当前动作是否完成,人脸信息状态是否正常
|
||||
*/
|
||||
- (void)livenessWithImage:(UIImage *)image withAction:(FaceLivenessActionType)actionLiveType completion:(void (^)(FaceInfo *faceinfo, FaceLivenessState *state, ResultCode resultCode))completion;
|
||||
|
||||
@end
|
||||
|
||||
@interface FaceLivenessState : NSObject
|
||||
/**
|
||||
* 动作活体-眨眨眼
|
||||
*/
|
||||
@property(nonatomic, assign) BOOL isLiveEye;
|
||||
/**
|
||||
* 动作活体-张张嘴
|
||||
*/
|
||||
@property(nonatomic, assign) BOOL isLiveMouth;
|
||||
/**
|
||||
* 动作活体-向左转头
|
||||
*/
|
||||
@property(nonatomic, assign) BOOL isLiveYawLeft;
|
||||
/**
|
||||
* 动作活体-向右转头
|
||||
*/
|
||||
@property(nonatomic, assign) BOOL isLiveYawRight;
|
||||
/**
|
||||
* 动作活体-抬头
|
||||
*/
|
||||
@property(nonatomic, assign) BOOL isLivePitchUp;
|
||||
/**
|
||||
* 动作活体-低头
|
||||
*/
|
||||
@property(nonatomic, assign) BOOL isLivePitchDown;
|
||||
@end
|
||||
|
||||
@interface FaceCropImageInfo : NSObject
|
||||
/**
|
||||
* 基于质量检测,姿态角度,对图片得分
|
||||
*/
|
||||
@property (nonatomic, assign) float qualityScore;
|
||||
/**
|
||||
* 离线RGB 静默活体得分
|
||||
*/
|
||||
@property (nonatomic,assign) float silentliveScore;
|
||||
/**
|
||||
* 采集到的矫正,调整宽高图片,会有宽高
|
||||
*/
|
||||
@property (nonatomic ,strong) UIImage *cropImageWithBlack;
|
||||
/**
|
||||
* 加密采集到的矫正,调整宽高图片,会有宽高
|
||||
*/
|
||||
@property (nonatomic ,strong) NSString *cropImageWithBlackEncryptStr;
|
||||
/**
|
||||
* 原始图片
|
||||
*/
|
||||
@property (nonatomic ,strong) UIImage *originalImage;
|
||||
/**
|
||||
* 加密原始图片
|
||||
*/
|
||||
@property (nonatomic ,strong) NSString *originalImageEncryptStr;
|
||||
/**
|
||||
* 排序规则
|
||||
*/
|
||||
- (NSComparisonResult)compareWithImageInfo:(FaceCropImageInfo *)info;
|
||||
@end
|
||||
|
||||
@interface FaceInfo : NSObject
|
||||
/**
|
||||
* 人脸在图片中的位置
|
||||
*/
|
||||
@property (nonatomic, assign) CGRect faceRect;
|
||||
/**
|
||||
* 人脸track 中的faceid
|
||||
*/
|
||||
@property (nonatomic, assign) NSInteger faceId;
|
||||
/**
|
||||
* 人脸72关键点
|
||||
*/
|
||||
@property (nonatomic, strong) NSArray * landMarks;
|
||||
/**
|
||||
* 人脸角度
|
||||
*/
|
||||
@property (nonatomic, assign) float angle;
|
||||
/**
|
||||
* 人脸质量-光照置信度,通过quality 方法调用获取
|
||||
*/
|
||||
@property (nonatomic,assign) float illum;
|
||||
|
||||
/**
|
||||
* 人脸质量-模糊置信度,通过quality 方法调用获取
|
||||
*/
|
||||
@property (nonatomic,assign) float blur;
|
||||
/**
|
||||
* 人脸上下偏转角,通过headpose 方法调用获取
|
||||
*/
|
||||
@property (nonatomic, assign) float pitch;
|
||||
|
||||
/**
|
||||
* 人脸左右偏转角,通过headpose 方法调用获取
|
||||
*/
|
||||
@property (nonatomic, assign) float yaw;
|
||||
|
||||
/**
|
||||
* 人脸平行平面内的头部旋转角,通过headpose 方法调用获取
|
||||
*/
|
||||
@property (nonatomic, assign) float roll;
|
||||
|
||||
/**
|
||||
* 离线RGB 静默活体得分
|
||||
*/
|
||||
@property (nonatomic,assign) float silentliveScore;
|
||||
|
||||
/**
|
||||
* 人脸检测得分
|
||||
*/
|
||||
@property (nonatomic, assign) CGFloat score;
|
||||
|
||||
/**
|
||||
* 输出图片结构体,包含图片质量分数,裁剪没有黑边的图片,裁剪有黑边的图片,未裁剪图片,原始图
|
||||
*/
|
||||
@property (nonatomic, strong) FaceCropImageInfo * cropImageInfo;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,93 @@
|
||||
//
|
||||
// IDLFaceDetectionManager.h
|
||||
// IDLFaceSDK
|
||||
//
|
||||
// Created by Tong,Shasha on 2017/5/18.
|
||||
// Copyright © 2017年 Baidu. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
|
||||
@class FaceInfo;
|
||||
|
||||
#define TIME_THRESHOLD_FOR_ANOTHER_SESSION 2.0
|
||||
|
||||
typedef NS_ENUM(NSUInteger, DetectRemindCode) {
|
||||
DetectRemindCodeOK = 0, //成功
|
||||
DetectRemindCodeBeyondPreviewFrame, //出框
|
||||
DetectRemindCodeNoFaceDetected, //没有检测到人脸
|
||||
DetectRemindCodeMuchIllumination,
|
||||
DetectRemindCodePoorIllumination, //光照不足
|
||||
DetectRemindCodeImageBlured, //图像模糊
|
||||
DetectRemindCodeTooFar, //太远
|
||||
DetectRemindCodeTooClose, //太近
|
||||
DetectRemindCodePitchOutofDownRange, //头部偏低
|
||||
DetectRemindCodePitchOutofUpRange, //头部偏高
|
||||
DetectRemindCodeYawOutofLeftRange, //头部偏左
|
||||
DetectRemindCodeYawOutofRightRange, //头部偏右
|
||||
DetectRemindCodeOcclusionLeftEye, //左眼有遮挡
|
||||
DetectRemindCodeOcclusionRightEye, //右眼有遮挡
|
||||
DetectRemindCodeOcclusionNose, //鼻子有遮挡
|
||||
DetectRemindCodeOcclusionMouth, //嘴巴有遮挡
|
||||
DetectRemindCodeOcclusionLeftContour, //左脸颊有遮挡
|
||||
DetectRemindCodeOcclusionRightContour, //右脸颊有遮挡
|
||||
DetectRemindCodeOcclusionChinCoutour, //下颚有遮挡
|
||||
DetectRemindCodeTimeout, //超时
|
||||
DetectRemindCodeVerifyInitError, //鉴权失败
|
||||
// DetectRemindCodeVerifyDecryptError,
|
||||
// DetectRemindCodeVerifyInfoFormatError,
|
||||
// DetectRemindCodeVerifyExpired,
|
||||
// DetectRemindCodeVerifyMissRequiredInfo,
|
||||
// DetectRemindCodeVerifyInfoCheckError,
|
||||
// DetectRemindCodeVerifyLocalFileError,
|
||||
// DetectRemindCodeVerifyRemoteDataError,
|
||||
// DetectRemindCodeDataHitLast
|
||||
DetectRemindCodeConditionMeet,
|
||||
DetectRemindCodeDataHitOne
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSUInteger, TrackDetectRemindCode) {
|
||||
TrackDetectRemindCodeOK = 0, //成功
|
||||
TrackDetectRemindCodeImageBlured, //图像模糊
|
||||
TrackDetectRemindCodePoorIllumination, // 光照不足
|
||||
TrackDetectRemindCodeNoFaceDetected, //没有检测到人脸
|
||||
TrackDetectRemindCodeOcclusionLeftEye, //左眼有遮挡
|
||||
TrackDetectRemindCodeOcclusionRightEye, //右眼有遮挡
|
||||
TrackDetectRemindCodeOcclusionNose, //鼻子有遮挡
|
||||
TrackDetectRemindCodeOcclusionMouth, //嘴巴有遮挡
|
||||
TrackDetectRemindCodeOcclusionLeftContour, //左脸颊有遮挡
|
||||
TrackDetectRemindCodeOcclusionRightContour, //右脸颊有遮挡
|
||||
TrackDetectRemindCodeOcclusionChinCoutour, //下颚有遮挡
|
||||
TrackDetectRemindCodeTooClose, //太近
|
||||
TrackDetectRemindCodeTooFar, //太远
|
||||
TrackDetectRemindCodeBeyondPreviewFrame //出框
|
||||
|
||||
};
|
||||
|
||||
typedef void (^DetectStrategyCompletion) (FaceInfo * faceinfo,NSDictionary * images, DetectRemindCode remindCode);
|
||||
|
||||
//typedef void (^TrackDetectStrategyCompletion) (NSArray * faceArray, TrackDetectRemindCode remindCode);
|
||||
|
||||
@interface IDLFaceDetectionManager : NSObject
|
||||
|
||||
@property (nonatomic, assign) BOOL enableSound;
|
||||
|
||||
+ (instancetype)sharedInstance;
|
||||
|
||||
/**
|
||||
* 人脸采集,成功之后返回扣图图片,原始图片
|
||||
* @param image 镜头拿到的图片
|
||||
* @param detectRect 预览的Rect
|
||||
* @param previewRect 检测的Rect
|
||||
* return completion 回调信息
|
||||
*/
|
||||
- (void)detectStratrgyWithNormalImage:(UIImage *)image previewRect:(CGRect)previewRect detectRect:(CGRect)detectRect completionHandler:(DetectStrategyCompletion)completion;
|
||||
|
||||
|
||||
- (void)reset;
|
||||
|
||||
-(void)startInitial;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,114 @@
|
||||
//
|
||||
// IDLFaceLivenessManager.h
|
||||
// IDLFaceSDK
|
||||
//
|
||||
// Created by Tong,Shasha on 2017/5/18.
|
||||
// Copyright © 2017年 Baidu. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
@class FaceInfo;
|
||||
@class FaceLivenessState;
|
||||
|
||||
#define TIME_THRESHOLD_FOR_ANOTHER_SESSION 2.0
|
||||
|
||||
typedef NS_ENUM(NSInteger, LivenessActionType) {
|
||||
LivenessActionTypeLiveEye = 0,
|
||||
LivenessActionTypeLiveMouth = 1,
|
||||
LivenessActionTypeLiveYawRight = 2,
|
||||
LivenessActionTypeLiveYawLeft = 3,
|
||||
LivenessActionTypeLivePitchUp = 4,
|
||||
LivenessActionTypeLivePitchDown = 5,
|
||||
LivenessActionTypeLiveYaw = 6,
|
||||
LivenessActionTypeNoAction = 7,
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSUInteger, LivenessRemindCode) {
|
||||
LivenessRemindCodeOK = 0, //成功
|
||||
LivenessRemindCodeBeyondPreviewFrame, //出框
|
||||
LivenessRemindCodeNoFaceDetected, //没有检测到人脸
|
||||
LivenessRemindCodeMuchIllumination,
|
||||
LivenessRemindCodePoorIllumination, //光照不足
|
||||
LivenessRemindCodeImageBlured, //图像模糊
|
||||
LivenessRemindCodeTooFar, //太远
|
||||
LivenessRemindCodeTooClose, //太近
|
||||
LivenessRemindCodePitchOutofDownRange, //头部偏低
|
||||
LivenessRemindCodePitchOutofUpRange, //头部偏高
|
||||
LivenessRemindCodeYawOutofLeftRange, //头部偏左
|
||||
LivenessRemindCodeYawOutofRightRange, //头部偏右
|
||||
LivenessRemindCodeOcclusionLeftEye, //左眼有遮挡
|
||||
LivenessRemindCodeOcclusionRightEye, //右眼有遮挡
|
||||
LivenessRemindCodeOcclusionNose, //鼻子有遮挡
|
||||
LivenessRemindCodeOcclusionMouth, //嘴巴有遮挡
|
||||
LivenessRemindCodeOcclusionLeftContour, //左脸颊有遮挡
|
||||
LivenessRemindCodeOcclusionRightContour, //右脸颊有遮挡
|
||||
LivenessRemindCodeOcclusionChinCoutour, //下颚有遮挡
|
||||
LivenessRemindCodeTimeout, //超时
|
||||
LivenessRemindCodeLiveEye, //眨眨眼
|
||||
LivenessRemindCodeLiveMouth, //张大嘴
|
||||
LivenessRemindCodeLiveYawLeft, //向右摇头
|
||||
LivenessRemindCodeLiveYawRight, //向左摇头
|
||||
LivenessRemindCodeLivePitchUp, //向上抬头
|
||||
LivenessRemindCodeLivePitchDown, //向下低头
|
||||
LivenessRemindCodeLiveYaw, //摇摇头
|
||||
LivenessRemindCodeSingleLivenessFinished, //完成一个活体动作
|
||||
LivenessRemindActionCodeTimeout, // 当前活体动作超时
|
||||
LivenessRemindCodeLeftEyeClosed,
|
||||
LivenessRemindCodeRightEyeClosed,
|
||||
LivenessRemindCodeVerifyInitError, //鉴权失败
|
||||
// LivenessRemindCodeVerifyDecryptError,
|
||||
// LivenessRemindCodeVerifyInfoFormatError,
|
||||
// LivenessRemindCodeVerifyExpired,
|
||||
// LivenessRemindCodeVerifyMissRequiredInfo,
|
||||
// LivenessRemindCodeVerifyInfoCheckError,
|
||||
// LivenessRemindCodeVerifyLocalFileError,
|
||||
// LivenessRemindCodeVerifyRemoteDataError,
|
||||
LivenessRemindCodeConditionMeet,
|
||||
LivenessRemindCodeFaceIdChanged, // faceid 发生变化
|
||||
LivenessRemindCodeDataHitOne
|
||||
// LivenessRemindCodeDataHitLast,
|
||||
};
|
||||
|
||||
typedef void (^LivenessStrategyCompletion) (NSDictionary * images, FaceInfo *faceInfo, LivenessRemindCode remindCode);
|
||||
typedef void (^LivenessNormalCompletion) (NSDictionary * images, FaceInfo *faceInfo, LivenessRemindCode remindCode);
|
||||
|
||||
/**
|
||||
* 活体检测过程中,返回活体总数,当前成功个数,当前活体类型
|
||||
*/
|
||||
typedef void (^LivenessProcess) (float numberOfLiveness, float numberOfSuccess, LivenessActionType currenActionType);
|
||||
|
||||
|
||||
@interface IDLFaceLivenessManager : NSObject
|
||||
@property (nonatomic, assign) BOOL enableSound;
|
||||
|
||||
+ (instancetype)sharedInstance;
|
||||
|
||||
/**
|
||||
* 人脸活体验证,成功之后返回扣图图片,原始图片
|
||||
* @param image 镜头拿到的图片
|
||||
* @param detectRect 预览的Rect
|
||||
* @param previewRect 检测的Rect
|
||||
* return completion 回调信息
|
||||
*/
|
||||
-(void) livenessNormalWithImage:(UIImage *)image previewRect:(CGRect)previewRect detectRect:(CGRect)detectRect completionHandler:(LivenessNormalCompletion)completion;
|
||||
|
||||
/**
|
||||
* 活体检测过程中,返回活体总数,当前成功个数,当前活体类型
|
||||
*/
|
||||
-(void) livenessProcessHandler:(LivenessProcess) process;
|
||||
|
||||
- (void)reset;
|
||||
|
||||
-(void)startInitial;
|
||||
|
||||
/**
|
||||
* 返回无黑边的方法
|
||||
* @param array 活体动作数组
|
||||
* @param order 是否顺序执行
|
||||
* @param numberOfLiveness 活体动作个数
|
||||
*/
|
||||
- (void)livenesswithList:(NSArray *)array order:(BOOL)order numberOfLiveness:(NSInteger)numberOfLiveness;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// IDLFaceSDK.h
|
||||
// IDLFaceSDK
|
||||
//
|
||||
// Created by Tong,Shasha on 2017/5/15.
|
||||
// Copyright © 2017年 Baidu. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
//! Project version number for IDLFaceSDK.
|
||||
FOUNDATION_EXPORT double IDLFaceSDKVersionNumber;
|
||||
|
||||
//! Project version string for IDLFaceSDK.
|
||||
FOUNDATION_EXPORT const unsigned char IDLFaceSDKVersionString[];
|
||||
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <IDLFaceSDK/PublicHeader.h>
|
||||
|
||||
|
||||
#import "FaceSDKManager.h"
|
||||
#import "IDLFaceLivenessManager.h"
|
||||
#import "IDLFaceDetectionManager.h"
|
||||
#import "BDFaceUtil.h"
|
||||
#import "BDFaceQualityUtil.h"
|
||||
BIN
LinxiaBaiduLiveLibs/IDLFaceSDK.framework/IDLFaceSDK
Executable file
BIN
LinxiaBaiduLiveLibs/IDLFaceSDK.framework/IDLFaceSDK
Executable file
Binary file not shown.
BIN
LinxiaBaiduLiveLibs/IDLFaceSDK.framework/Info.plist
Normal file
BIN
LinxiaBaiduLiveLibs/IDLFaceSDK.framework/Info.plist
Normal file
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
framework module IDLFaceSDK {
|
||||
umbrella header "IDLFaceSDK.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>files</key>
|
||||
<dict>
|
||||
<key>Headers/BDFaceQualityUtil.h</key>
|
||||
<data>
|
||||
fcj/C6f2qlP6eZ5+RCJmWMtAPQ0=
|
||||
</data>
|
||||
<key>Headers/BDFaceUtil.h</key>
|
||||
<data>
|
||||
VECTCE+71SOsF5RLPGnwLx2SOQg=
|
||||
</data>
|
||||
<key>Headers/FaceSDKManager.h</key>
|
||||
<data>
|
||||
HtK3UhOfFgE7zgaseOG5WK5QEg4=
|
||||
</data>
|
||||
<key>Headers/IDLFaceDetectionManager.h</key>
|
||||
<data>
|
||||
3FgLOS0NvbMFpGRtqvEJlav7MuI=
|
||||
</data>
|
||||
<key>Headers/IDLFaceLivenessManager.h</key>
|
||||
<data>
|
||||
VbXN+PK0Q7IfahU2MI0U5SaPHIQ=
|
||||
</data>
|
||||
<key>Headers/IDLFaceSDK.h</key>
|
||||
<data>
|
||||
4jVunSoXEW6EIui6HmQGQ/B7GgU=
|
||||
</data>
|
||||
<key>Info.plist</key>
|
||||
<data>
|
||||
gB1gmw3UfXQHkHkeV5Y7sb7bpDA=
|
||||
</data>
|
||||
<key>Modules/module.modulemap</key>
|
||||
<data>
|
||||
uTVmiSBEgQ4Qw0TMMpcn7pr7ssU=
|
||||
</data>
|
||||
</dict>
|
||||
<key>files2</key>
|
||||
<dict>
|
||||
<key>Headers/BDFaceQualityUtil.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
fcj/C6f2qlP6eZ5+RCJmWMtAPQ0=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
4FebuT7rY9k2JVw4SLUakj7+ixAkjWnoHD+MaQDJSYo=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/BDFaceUtil.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
VECTCE+71SOsF5RLPGnwLx2SOQg=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
Hxb8esap8atN28mAw/uztk+/wyRFRJl5Kv7KIYs0naM=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/FaceSDKManager.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
HtK3UhOfFgE7zgaseOG5WK5QEg4=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
9xcXJTgHFJL+bQRkxB+pP+i/R4m53mKGg3BtzOl0bvw=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/IDLFaceDetectionManager.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
3FgLOS0NvbMFpGRtqvEJlav7MuI=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
5kMvOke/ASfe/WAEL97lR3CVaA99NKplFzR7rU4+nvA=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/IDLFaceLivenessManager.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
VbXN+PK0Q7IfahU2MI0U5SaPHIQ=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
/Hk63uC19rBPuUOElYDIMMETOhhWGNf16+qpnjOWbBc=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/IDLFaceSDK.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
4jVunSoXEW6EIui6HmQGQ/B7GgU=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
lgQ9lUWcrFfTCL6Di9EwgliVBVZwbncZINzCfW4idDE=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Modules/module.modulemap</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
uTVmiSBEgQ4Qw0TMMpcn7pr7ssU=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
2UWkZrJMmZYFFeU4C525GWZ73nY7N7bcJ+9yd1WwEos=
|
||||
</data>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>rules</key>
|
||||
<dict>
|
||||
<key>^.*</key>
|
||||
<true/>
|
||||
<key>^.*\.lproj/</key>
|
||||
<dict>
|
||||
<key>optional</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1000</real>
|
||||
</dict>
|
||||
<key>^.*\.lproj/locversion.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1100</real>
|
||||
</dict>
|
||||
<key>^Base\.lproj/</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>1010</real>
|
||||
</dict>
|
||||
<key>^version.plist$</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>rules2</key>
|
||||
<dict>
|
||||
<key>.*\.dSYM($|/)</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>11</real>
|
||||
</dict>
|
||||
<key>^(.*/)?\.DS_Store$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>2000</real>
|
||||
</dict>
|
||||
<key>^.*</key>
|
||||
<true/>
|
||||
<key>^.*\.lproj/</key>
|
||||
<dict>
|
||||
<key>optional</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1000</real>
|
||||
</dict>
|
||||
<key>^.*\.lproj/locversion.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1100</real>
|
||||
</dict>
|
||||
<key>^Base\.lproj/</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>1010</real>
|
||||
</dict>
|
||||
<key>^Info\.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^PkgInfo$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^embedded\.provisionprofile$</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^version\.plist$</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
Reference in New Issue
Block a user