FIRVisionFaceDetectorOptions.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #import <CoreGraphics/CoreGraphics.h>
  2. #import <Foundation/Foundation.h>
  3. NS_ASSUME_NONNULL_BEGIN
  4. /**
  5. * @enum VisionFaceDetectorClassificationMode
  6. * Classification mode for face detection.
  7. */
  8. typedef NS_ENUM(NSUInteger, FIRVisionFaceDetectorClassificationMode) {
  9. /**
  10. * Face classification mode indicating that the detector performs no classification.
  11. */
  12. FIRVisionFaceDetectorClassificationModeNone = 1,
  13. /**
  14. * Face classification mode indicating that the detector performs all classifications.
  15. */
  16. FIRVisionFaceDetectorClassificationModeAll,
  17. } NS_SWIFT_NAME(VisionFaceDetectorClassificationMode);
  18. /**
  19. * @enum VisionFaceDetectorPerformanceMode
  20. * Performance preference for accuracy or speed of face detection.
  21. */
  22. typedef NS_ENUM(NSUInteger, FIRVisionFaceDetectorPerformanceMode) {
  23. /**
  24. * Face detection performance mode that runs faster, but may detect fewer faces and/or return
  25. * results with lower accuracy.
  26. */
  27. FIRVisionFaceDetectorPerformanceModeFast = 1,
  28. /**
  29. * Face detection performance mode that runs slower, but may detect more faces and/or return
  30. * results with higher accuracy.
  31. */
  32. FIRVisionFaceDetectorPerformanceModeAccurate,
  33. } NS_SWIFT_NAME(VisionFaceDetectorPerformanceMode);
  34. /**
  35. * @enum VisionFaceDetectorLandmarkMode
  36. * Landmark detection mode for face detection.
  37. */
  38. typedef NS_ENUM(NSUInteger, FIRVisionFaceDetectorLandmarkMode) {
  39. /**
  40. * Face landmark mode indicating that the detector performs no landmark detection.
  41. */
  42. FIRVisionFaceDetectorLandmarkModeNone = 1,
  43. /**
  44. * Face landmark mode indicating that the detector performs landmark detection.
  45. */
  46. FIRVisionFaceDetectorLandmarkModeAll,
  47. } NS_SWIFT_NAME(VisionFaceDetectorLandmarkMode);
  48. /**
  49. * @enum VisionFaceDetectorContourMode
  50. * Contour detection mode for face detection.
  51. */
  52. typedef NS_ENUM(NSUInteger, FIRVisionFaceDetectorContourMode) {
  53. /**
  54. * Face contour mode indicating that the detector performs no contour detection.
  55. */
  56. FIRVisionFaceDetectorContourModeNone = 1,
  57. /**
  58. * Face contour mode indicating that the detector performs contour detection.
  59. */
  60. FIRVisionFaceDetectorContourModeAll,
  61. } NS_SWIFT_NAME(VisionFaceDetectorContourMode);
  62. /**
  63. * Options for specifying a face detector.
  64. */
  65. NS_SWIFT_NAME(VisionFaceDetectorOptions)
  66. @interface FIRVisionFaceDetectorOptions : NSObject
  67. /**
  68. * The face detector classification mode for characterizing attributes such as smiling. Defaults to
  69. * `.none`.
  70. */
  71. @property(nonatomic) FIRVisionFaceDetectorClassificationMode classificationMode;
  72. /**
  73. * The face detector performance mode that determines the accuracy of the results and the speed of
  74. * the detection. Defaults to `.fast`.
  75. */
  76. @property(nonatomic) FIRVisionFaceDetectorPerformanceMode performanceMode;
  77. /**
  78. * The face detector landmark mode that determines the type of landmark results returned by
  79. * detection. Defaults to `.none`.
  80. */
  81. @property(nonatomic) FIRVisionFaceDetectorLandmarkMode landmarkMode;
  82. /**
  83. * The face detector contour mode that determines the type of contour results returned by detection.
  84. * Defaults to `.none`.
  85. *
  86. * <p>The following detection results are returned when setting this mode to `.all`:
  87. *
  88. * <p>`performanceMode` set to `.fast`, and both `classificationMode` and `landmarkMode` set to
  89. * `.none`, then only the prominent face will be returned with detected contours.
  90. *
  91. * <p>`performanceMode` set to `.accurate`, or if `classificationMode` or `landmarkMode` is set to
  92. * `.all`, then all detected faces will be returned, but only the prominent face will have
  93. * detecteted contours.
  94. */
  95. @property(nonatomic) FIRVisionFaceDetectorContourMode contourMode;
  96. /**
  97. * The smallest desired face size. The size is expressed as a proportion of the width of the head to
  98. * the image width. For example, if a value of 0.1 is specified, then the smallest face to search
  99. * for is roughly 10% of the width of the image being searched. Defaults to 0.1. This option does
  100. * not apply to contour detection.
  101. */
  102. @property(nonatomic) CGFloat minFaceSize;
  103. /**
  104. * Whether the face tracking feature is enabled for face detection. Defaults to NO. When
  105. * `performanceMode` is set to `.fast`, and both `classificationMode` and `landmarkMode` set to
  106. * `.none`, this option will be ignored and tracking will be disabled.
  107. */
  108. @property(nonatomic, getter=isTrackingEnabled) BOOL trackingEnabled;
  109. @end
  110. NS_ASSUME_NONNULL_END