InteractiveSegmenter
class InteractiveSegmenter: NSObjectClass that performs interactive segmentation on images using split mode.
This API optimizes performance by splitting the model into an encoder (feature extraction that runs once per image) and a decoder (lightweight heatmap generation that runs per user stroke).
-
Creates a new instance of
InteractiveSegmenterfrom the givenInteractiveSegmenterOptions.Declaration
Swift
init(options: InteractiveSegmenterOptions) throwsParameters
optionsThe options of type
InteractiveSegmenterOptionsto use for configuring theInteractiveSegmenter.Return Value
A new instance of
InteractiveSegmenterwith the given options.nilif there is an error in initializing the interactive segmenter. -
Performs segmentation on the previously set image using the provided user's strokes. This runs the decoder part of the split model.
Parameters
strokesAn array of
MPPStrokeobjects representing the user interaction.Return Value
An
MPImagethat contains the segmented mask. -
Sets the image to be segmented. This runs the encoder part of the split model. This method must be called before calling
segmentWithStrokes:error:.Declaration
Swift
func set(image: MPImage) throwsParameters
imageThe
MPImageon which segmentation is to be performed.Return Value
YESif the image was successfully set and encoded,NOotherwise.