MediaPipeTasksVision Framework Reference

FaceLandmarkerOptions

struct FaceLandmarkerOptions: Sendable

Options for configuring a FaceLandmarker task (not Equatable because liveStreamResultHandler is a closure).

  • Creates options for single-image detection of one face with 0.5 confidence thresholds.

    Declaration

    Swift

    init(baseOptions: BaseOptions = BaseOptions(), runningMode: VisionRunningMode = .image, numFaces: Int = 1, minFaceDetectionConfidence: Float = 0.5, minFacePresenceConfidence: Float = 0.5, minTrackingConfidence: Float = 0.5, outputFaceBlendshapes: Bool = false, outputFacialTransformationMatrixes: Bool = false, liveStreamResultHandler: FaceLandmarkerOptions.LiveStreamResultHandler? = nil)
  • Base options for model loading and hardware acceleration delegation.

    Declaration

    Swift

    var baseOptions: BaseOptions
  • Handler for .liveStream results. Must be nil in .image and .video modes.

    Declaration

    Swift

    var liveStreamResultHandler: FaceLandmarkerOptions.LiveStreamResultHandler?
  • Minimum confidence score for face detection to be considered successful.

    Declaration

    Swift

    var minFaceDetectionConfidence: Float
  • Minimum confidence score of the face presence score in face landmark detection.

    Declaration

    Swift

    var minFacePresenceConfidence: Float
  • Minimum confidence score for face tracking to be considered successful.

    Declaration

    Swift

    var minTrackingConfidence: Float
  • Maximum number of faces to detect.

    Declaration

    Swift

    var numFaces: Int
  • Whether to output face blendshape scores for rendering 3D face models.

    Declaration

    Swift

    var outputFaceBlendshapes: Bool
  • Whether to output 4x4 facial transformation matrixes from the canonical face model.

    Declaration

    Swift

    var outputFacialTransformationMatrixes: Bool
  • Execution mode of the landmarker. .liveStream requires liveStreamResultHandler.

    Declaration

    Swift

    var runningMode: VisionRunningMode
  • Receives .liveStream results (or errors) and input timestamps on a private serial queue.

    Declaration

    Swift

    typealias LiveStreamResultHandler = @Sendable (Result<FaceLandmarkerResult, any Error>, Int) -> Void