MGFaceQualityManager.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. //
  2. // MGFaceQualityManager.h
  3. // MGLivenessDetection
  4. //
  5. // Created by 张英堂 on 16/3/28.
  6. // Copyright © 2016Year megvii. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <UIKit/UIKit.h>
  10. #import "LivenessDetector.h"
  11. /*
  12. * 每一帧检测出现的错误类型
  13. */
  14. typedef NS_ENUM(NSInteger, MGFaceQualityErrorType) {
  15. MGFaceQualityErrorNone = 0, //没有错误
  16. MGFaceQualityErrorFaceNotFound, //没有人脸
  17. MGFaceQualityErrorFacePosDeviated, //yaw或pitch角度过大
  18. MGFaceQualityErrorFaceNonIntegrity, //人脸的有效面积比过小
  19. MGFaceQualityErrorFaceTooDark, //人脸亮度过小
  20. MGFaceQualityErrorFaceTooBright, //人脸亮度过大
  21. MGFaceQualityErrorFaceTooSmall, //人脸宽度过小
  22. MGFaceQualityErrorFaceTooLarge, //人脸宽度过大
  23. MGFaceQualityErrorFaceTooBlurry, //运动模糊度过大
  24. MGFaceQualityErrorFaceOutOfRect, //人脸偏移过大
  25. MGFaceQualityErrorFrameNeedHolding, //需要连续一定帧数合格
  26. };
  27. @interface MGFaceQualityManager : NSObject
  28. /**
  29. * 初始化方法,必须使用该方法初始化
  30. *
  31. * @param faceCenter 人脸中心位置,相对值(0.5,0.5)
  32. *
  33. * @return 实例化对象
  34. */
  35. - (instancetype)initWithFaceCenter:(CGPoint)faceCenter;
  36. /**
  37. * 默认值 3
  38. */
  39. @property (nonatomic, assign) NSUInteger needHolding;
  40. /**
  41. * 默认值 0.17
  42. */
  43. @property (nonatomic, assign) float yawThreshold;
  44. /**
  45. * 默认值 0.17
  46. */
  47. @property (nonatomic, assign) float pitchThreshold;
  48. /**
  49. * 人脸有效面积比 默认值 0.99
  50. */
  51. @property (nonatomic, assign) float integrityThreshold;
  52. /**
  53. * 人脸亮度 最大值默认值 230
  54. */
  55. @property (nonatomic, assign) float maxBrightnessThreshold;
  56. /**
  57. * 人脸亮度 最小值默认值 70
  58. */
  59. @property (nonatomic, assign) float minBrightnessThreshold;
  60. /**
  61. * 运动模糊最大值 默认值 0.20
  62. */
  63. @property (nonatomic, assign) float motionBlurThreshold;
  64. /**
  65. * 高斯模糊最大值 默认值 0.15
  66. */
  67. @property (nonatomic, assign) float gaussianBlurThreshold;
  68. /**
  69. * 视频图像中的人脸宽度,绝对值 默认 150
  70. */
  71. @property (nonatomic, assign) float faceWidthThreshold;
  72. /**
  73. * 视频图像中的人脸宽度,相对值 默认值 0. 4
  74. */
  75. @property (nonatomic, assign) float faceMaxSizeRatioThreshold;
  76. /**
  77. * 检测每一帧错误,并且返回出错的原因
  78. *
  79. * @param frame 活体的每一帧结果
  80. *
  81. * @return 返回结果 检测的错误类型,多个错误并存
  82. */
  83. - (NSArray *)feedFrame:(MGLivenessDetectionFrame *)frame;
  84. @end