IDLFaceDetectionManager.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. //
  2. // IDLFaceDetectionManager.h
  3. // IDLFaceSDK
  4. //
  5. // Created by Tong,Shasha on 2017/5/18.
  6. // Copyright © 2017年 Baidu. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <UIKit/UIKit.h>
  10. #import <CoreGraphics/CoreGraphics.h>
  11. @class FaceInfo;
  12. #define TIME_THRESHOLD_FOR_ANOTHER_SESSION 2.0
  13. typedef NS_ENUM(NSUInteger, DetectRemindCode) {
  14. DetectRemindCodeOK = 0, //成功
  15. DetectRemindCodeBeyondPreviewFrame, //出框
  16. DetectRemindCodeNoFaceDetected, //没有检测到人脸
  17. DetectRemindCodeMuchIllumination,
  18. DetectRemindCodePoorIllumination, //光照不足
  19. DetectRemindCodeImageBlured, //图像模糊
  20. DetectRemindCodeTooFar, //太远
  21. DetectRemindCodeTooClose, //太近
  22. DetectRemindCodePitchOutofDownRange, //头部偏低
  23. DetectRemindCodePitchOutofUpRange, //头部偏高
  24. DetectRemindCodeYawOutofLeftRange, //头部偏左
  25. DetectRemindCodeYawOutofRightRange, //头部偏右
  26. DetectRemindCodeOcclusionLeftEye, //左眼有遮挡
  27. DetectRemindCodeOcclusionRightEye, //右眼有遮挡
  28. DetectRemindCodeOcclusionNose, //鼻子有遮挡
  29. DetectRemindCodeOcclusionMouth, //嘴巴有遮挡
  30. DetectRemindCodeOcclusionLeftContour, //左脸颊有遮挡
  31. DetectRemindCodeOcclusionRightContour, //右脸颊有遮挡
  32. DetectRemindCodeOcclusionChinCoutour, //下颚有遮挡
  33. DetectRemindCodeTimeout, //超时
  34. DetectRemindCodeVerifyInitError, //鉴权失败
  35. // DetectRemindCodeVerifyDecryptError,
  36. // DetectRemindCodeVerifyInfoFormatError,
  37. // DetectRemindCodeVerifyExpired,
  38. // DetectRemindCodeVerifyMissRequiredInfo,
  39. // DetectRemindCodeVerifyInfoCheckError,
  40. // DetectRemindCodeVerifyLocalFileError,
  41. // DetectRemindCodeVerifyRemoteDataError,
  42. // DetectRemindCodeDataHitLast
  43. DetectRemindCodeConditionMeet,
  44. DetectRemindCodeDataHitOne
  45. };
  46. typedef NS_ENUM(NSUInteger, TrackDetectRemindCode) {
  47. TrackDetectRemindCodeOK = 0, //成功
  48. TrackDetectRemindCodeImageBlured, //图像模糊
  49. TrackDetectRemindCodePoorIllumination, // 光照不足
  50. TrackDetectRemindCodeNoFaceDetected, //没有检测到人脸
  51. TrackDetectRemindCodeOcclusionLeftEye, //左眼有遮挡
  52. TrackDetectRemindCodeOcclusionRightEye, //右眼有遮挡
  53. TrackDetectRemindCodeOcclusionNose, //鼻子有遮挡
  54. TrackDetectRemindCodeOcclusionMouth, //嘴巴有遮挡
  55. TrackDetectRemindCodeOcclusionLeftContour, //左脸颊有遮挡
  56. TrackDetectRemindCodeOcclusionRightContour, //右脸颊有遮挡
  57. TrackDetectRemindCodeOcclusionChinCoutour, //下颚有遮挡
  58. TrackDetectRemindCodeTooClose, //太近
  59. TrackDetectRemindCodeTooFar, //太远
  60. TrackDetectRemindCodeBeyondPreviewFrame //出框
  61. };
  62. typedef void (^DetectStrategyCompletion) (FaceInfo * faceinfo,NSDictionary * images, DetectRemindCode remindCode);
  63. //typedef void (^TrackDetectStrategyCompletion) (NSArray * faceArray, TrackDetectRemindCode remindCode);
  64. @interface IDLFaceDetectionManager : NSObject
  65. @property (nonatomic, assign) BOOL enableSound;
  66. + (instancetype)sharedInstance;
  67. /**
  68. * 人脸采集,成功之后返回扣图图片,原始图片
  69. * @param image 镜头拿到的图片
  70. * @param detectRect 预览的Rect
  71. * @param previewRect 检测的Rect
  72. * return completion 回调信息
  73. */
  74. - (void)detectStratrgyWithNormalImage:(UIImage *)image previewRect:(CGRect)previewRect detectRect:(CGRect)detectRect completionHandler:(DetectStrategyCompletion)completion;
  75. - (void)reset;
  76. -(void)startInitial;
  77. @end