MLKitFaceDetection Framework Reference

  • This document provides global type definitions for face detection functionalities within the ML Kit framework.

  • The types define structures and enumerations for facial contours, landmarks, detection callbacks, and modes for classification, performance, landmark detection, and contour detection.

  • These type definitions are crucial for developers to understand and interact with the face detection features offered by the framework.

  • Developers can utilize these type definitions to customize face detection based on performance, accuracy, and the desired level of detail regarding landmarks and contours.

Type Definitions

The following type definitions are available globally.

  • The facial contours.

    Declaration

    Swift

    struct FaceContourType : _ObjectiveCBridgeable, Hashable, Equatable, _SwiftNewtypeWrapper, RawRepresentable
  • A block containing an array of faces or nil if there’s an error.

    Declaration

    Swift

    typealias FaceDetectionCallback = ([MLKFace]?, Error?) -> Void

    Parameters

    faces

    Array of faces detected in the image or nil if there was an error.

    error

    The error or nil.

  • @enum FaceDetectorClassificationMode Classification mode for face detection.

    Declaration

    Swift

    struct FaceDetectorClassificationMode : _ObjectiveCBridgeable, Hashable, Equatable, _SwiftNewtypeWrapper, RawRepresentable
  • @enum FaceDetectorPerformanceMode Performance preference for accuracy or speed of face detection.

    Declaration

    Swift

    struct FaceDetectorPerformanceMode : _ObjectiveCBridgeable, Hashable, Equatable, _SwiftNewtypeWrapper, RawRepresentable
  • @enum FaceDetectorLandmarkMode Landmark detection mode for face detection.

    Declaration

    Swift

    struct FaceDetectorLandmarkMode : _ObjectiveCBridgeable, Hashable, Equatable, _SwiftNewtypeWrapper, RawRepresentable
  • @enum FaceDetectorContourMode Contour detection mode for face detection.

    Declaration

    Swift

    struct FaceDetectorContourMode : _ObjectiveCBridgeable, Hashable, Equatable, _SwiftNewtypeWrapper, RawRepresentable
  • The facial landmarks.

    Declaration

    Swift

    struct FaceLandmarkType : _ObjectiveCBridgeable, Hashable, Equatable, _SwiftNewtypeWrapper, RawRepresentable