MediaPipeTasksVision Framework Reference

ImageEmbedderOptions

struct ImageEmbedderOptions: Sendable

Configuration for an ImageEmbedder instance.

Not Equatable or Hashable because liveStreamResultHandler is a closure.

  • Creates configuration with model, running mode, embedder settings, and optional stream handler.

    Declaration

    Swift

    init(baseOptions: BaseOptions = BaseOptions(), runningMode: VisionRunningMode = .image, l2Normalize: Bool = false, quantize: Bool = false, liveStreamResultHandler: ImageEmbedderOptions.LiveStreamResultHandler? = nil)
  • Model asset and hardware accelerator settings.

    Declaration

    Swift

    var baseOptions: BaseOptions
  • Whether to normalize returned feature vectors with L2 norm.

    Declaration

    Swift

    var l2Normalize: Bool
  • Asynchronous handler required for .liveStream and disallowed for .image or .video.

    Declaration

    Swift

    var liveStreamResultHandler: ImageEmbedderOptions.LiveStreamResultHandler?
  • Whether to scalar-quantize returned embeddings to bytes.

    Declaration

    Swift

    var quantize: Bool
  • Execution mode selecting single image, sequential video, or asynchronous livestream.

    Declaration

    Swift

    var runningMode: VisionRunningMode
  • Asynchronous handler receiving live-stream output and frame timestamp in milliseconds.

    Declaration

    Swift

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