MLKitFaceDetection Framework Reference

FaceDetectorOptions

class FaceDetectorOptions : NSObject

Options for specifying a face detector.

  • The face detector classification mode for characterizing attributes such as smiling. The default is .none.

    Declaration

    Swift

    var classificationMode: FaceDetectorClassificationMode { get set }
  • The face detector performance mode that determines the accuracy of the results and the speed of the detection. The default is .fast.

    Declaration

    Swift

    var performanceMode: FaceDetectorPerformanceMode { get set }
  • The face detector landmark mode that determines the type of landmark results returned by detection. The default is .none.

    Declaration

    Swift

    var landmarkMode: FaceDetectorLandmarkMode { get set }
  • The face detector contour mode that determines the type of contour results returned by detection. The default is .none.

    The following detection results are returned when setting this mode to .all:

    performanceMode set to .fast, and both classificationMode and landmarkMode set to .none, then only the prominent face will be returned with detected contours.

    performanceMode set to .accurate, or if classificationMode or landmarkMode is set to .all, then all detected faces will be returned, but only the prominent face will have detecteted contours.

    Declaration

    Swift

    var contourMode: FaceDetectorContourMode { get set }
  • The smallest desired face size. The size is expressed as a proportion of the width of the head to the image width. For example, if a value of 0.1 is specified, then the smallest face to search for is roughly 10% of the width of the image being searched. The default is 0.1. This option does not apply to contour detection.

    Declaration

    Swift

    var minFaceSize: CGFloat { get set }
  • Whether the face tracking feature is enabled for face detection. The default is NO. When performanceMode is set to .fast, and both classificationMode and landmarkMode set to .none, this option will be ignored and tracking will be disabled.

    Declaration

    Swift

    var isTrackingEnabled: Bool { get set }