IDLFaceDetectionManager.h 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. DetectRemindCodePitchOutofDownRange = 1, //头部偏低
  16. DetectRemindCodePitchOutofUpRange = 2, //头部偏高
  17. DetectRemindCodeYawOutofLeftRange = 3, //头部偏左
  18. DetectRemindCodeYawOutofRightRange = 4, //头部偏右
  19. DetectRemindCodePoorIllumination = 5, //光照不足
  20. DetectRemindCodeNoFaceDetected = 6, //没有检测到人脸
  21. DetectRemindCodeDataHitOne,
  22. DetectRemindCodeDataHitLast,
  23. DetectRemindCodeImageBlured, //图像模糊
  24. DetectRemindCodeOcclusionLeftEye, //左眼有遮挡
  25. DetectRemindCodeOcclusionRightEye, //右眼有遮挡
  26. DetectRemindCodeOcclusionNose, //鼻子有遮挡
  27. DetectRemindCodeOcclusionMouth, //嘴巴有遮挡
  28. DetectRemindCodeOcclusionLeftContour, //左脸颊有遮挡
  29. DetectRemindCodeOcclusionRightContour, //右脸颊有遮挡
  30. DetectRemindCodeOcclusionChinCoutour, //下颚有遮挡
  31. DetectRemindCodeTooClose, //太近
  32. DetectRemindCodeTooFar, //太远
  33. DetectRemindCodeBeyondPreviewFrame, //出框
  34. DetectRemindCodeVerifyInitError, //鉴权失败
  35. DetectRemindCodeVerifyDecryptError,
  36. DetectRemindCodeVerifyInfoFormatError,
  37. DetectRemindCodeVerifyExpired,
  38. DetectRemindCodeVerifyMissRequiredInfo,
  39. DetectRemindCodeVerifyInfoCheckError,
  40. DetectRemindCodeVerifyLocalFileError,
  41. DetectRemindCodeVerifyRemoteDataError,
  42. DetectRemindCodeTimeout, //超时
  43. DetectRemindCodeConditionMeet
  44. };
  45. typedef NS_ENUM(NSUInteger, TrackDetectRemindCode) {
  46. TrackDetectRemindCodeOK = 0, //成功
  47. TrackDetectRemindCodeImageBlured, //图像模糊
  48. TrackDetectRemindCodePoorIllumination, // 光照不足
  49. TrackDetectRemindCodeNoFaceDetected, //没有检测到人脸
  50. TrackDetectRemindCodeOcclusionLeftEye, //左眼有遮挡
  51. TrackDetectRemindCodeOcclusionRightEye, //右眼有遮挡
  52. TrackDetectRemindCodeOcclusionNose, //鼻子有遮挡
  53. TrackDetectRemindCodeOcclusionMouth, //嘴巴有遮挡
  54. TrackDetectRemindCodeOcclusionLeftContour, //左脸颊有遮挡
  55. TrackDetectRemindCodeOcclusionRightContour, //右脸颊有遮挡
  56. TrackDetectRemindCodeOcclusionChinCoutour, //下颚有遮挡
  57. TrackDetectRemindCodeTooClose, //太近
  58. TrackDetectRemindCodeTooFar, //太远
  59. TrackDetectRemindCodeBeyondPreviewFrame //出框
  60. };
  61. typedef void (^DetectStrategyCompletion) (FaceInfo * faceinfo,NSDictionary * images, DetectRemindCode remindCode);
  62. typedef void (^TrackDetectStrategyCompletion) (FaceInfo * faceinfo, TrackDetectRemindCode remindCode);
  63. @interface IDLFaceDetectionManager : NSObject
  64. @property (nonatomic, assign) BOOL enableSound;
  65. + (instancetype)sharedInstance;
  66. /*带黑边的方法*/
  67. - (void)detectStratrgyWithQualityControlImage:(UIImage *)image previewRect:(CGRect)previewRect detectRect:(CGRect)detectRect completionHandler:(DetectStrategyCompletion)completion;
  68. /*不带黑边*/
  69. - (void)detectStratrgyWithNormalImage:(UIImage *)image previewRect:(CGRect)previewRect detectRect:(CGRect)detectRect completionHandler:(DetectStrategyCompletion)completion;
  70. - (void)detectMultiFacesImage:(UIImage *)image withMaxFaceCount:(NSInteger)maxFaceCount handler:(TrackDetectStrategyCompletion)completion;
  71. - (void)reset;
  72. -(void)startInitial;
  73. @end