# ImageSegmenterOptions

    struct ImageSegmenterOptions: Sendable

Options for configuring an `ImageSegmenter` task.

Not `Equatable` or `Hashable` because `liveStreamResultHandler` is a closure.
- `
  ### [init(baseOptions:runningMode:displayNamesLocale:outputConfidenceMasks:outputCategoryMask:liveStreamResultHandler:)](https://developers.google.com/edge/api/mediapipe/swift/vision/Structs/ImageSegmenterOptions.md.txt#/s:20MediaPipeTasksVision21ImageSegmenterOptionsV04baseG011runningMode18displayNamesLocale21outputConfidenceMasks0N12CategoryMask23liveStreamResultHandlerAC0abC6Common04BaseG0V_AJ0d7RunningJ0OSSS2bys0U0OyAA0efU0Vs5Error_pG_SitYbcSgtcfc)

  ` Creates options for single-image segmentation that output confidence masks only.

  #### Declaration

  Swift

      init(baseOptions: BaseOptions = BaseOptions(), runningMode: VisionRunningMode = .image, displayNamesLocale: String = "en", outputConfidenceMasks: Bool = true, outputCategoryMask: Bool = false, liveStreamResultHandler: ImageSegmenterOptions.LiveStreamResultHandler? = nil)

- `
  ### [baseOptions](https://developers.google.com/edge/api/mediapipe/swift/vision/Structs/ImageSegmenterOptions.md.txt#/s:20MediaPipeTasksVision21ImageSegmenterOptionsV04baseG00abC6Common04BaseG0Vvp)

  ` Base options for model loading and hardware acceleration delegation.

  #### Declaration

  Swift

      var baseOptions: BaseOptions

- `
  ### [displayNamesLocale](https://developers.google.com/edge/api/mediapipe/swift/vision/Structs/ImageSegmenterOptions.md.txt#/s:20MediaPipeTasksVision21ImageSegmenterOptionsV18displayNamesLocaleSSvp)

  ` Locale used for display names from the TFLite Model Metadata.

  #### Declaration

  Swift

      var displayNamesLocale: String

- `
  ### [liveStreamResultHandler](https://developers.google.com/edge/api/mediapipe/swift/vision/Structs/ImageSegmenterOptions.md.txt#/s:20MediaPipeTasksVision21ImageSegmenterOptionsV23liveStreamResultHandlerys0J0OyAA0efJ0Vs5Error_pG_SitYbcSgvp)

  ` Handler for `.liveStream` results. Must be `nil` in `.image` and `.video` modes.

  #### Declaration

  Swift

      var liveStreamResultHandler: ImageSegmenterOptions.LiveStreamResultHandler?

- `
  ### [outputCategoryMask](https://developers.google.com/edge/api/mediapipe/swift/vision/Structs/ImageSegmenterOptions.md.txt#/s:20MediaPipeTasksVision21ImageSegmenterOptionsV18outputCategoryMaskSbvp)

  ` Whether to output a `UInt8` category mask.

  #### Declaration

  Swift

      var outputCategoryMask: Bool

- `
  ### [outputConfidenceMasks](https://developers.google.com/edge/api/mediapipe/swift/vision/Structs/ImageSegmenterOptions.md.txt#/s:20MediaPipeTasksVision21ImageSegmenterOptionsV21outputConfidenceMasksSbvp)

  ` Whether to output per-category `Float32` confidence masks.

  #### Declaration

  Swift

      var outputConfidenceMasks: Bool

- `
  ### [runningMode](https://developers.google.com/edge/api/mediapipe/swift/vision/Structs/ImageSegmenterOptions.md.txt#/s:20MediaPipeTasksVision21ImageSegmenterOptionsV11runningMode0abC6Common0d7RunningI0Ovp)

  ` Execution mode of the segmenter. `.liveStream` requires `liveStreamResultHandler`.

  #### Declaration

  Swift

      var runningMode: VisionRunningMode

- `
  ### [LiveStreamResultHandler](https://developers.google.com/edge/api/mediapipe/swift/vision/Structs/ImageSegmenterOptions.md.txt#/s:20MediaPipeTasksVision21ImageSegmenterOptionsV23LiveStreamResultHandlera)

  ` Receives asynchronous `.liveStream` segmentation results (or errors) with their input timestamp on a private serial queue.

  #### Declaration

  Swift

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