<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/vision/interactive_segmenter.py#L159-L259) |

A task to perform interactive segmentation on images.

    mp.tasks.vision.InteractiveSegmenter(
        lib: serial_dispatcher.SerialDispatcher, handle: ctypes.c_void_p
    )

## Methods

### `close`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/vision/interactive_segmenter.py#L241-L247)

    close()

Closes the InteractiveSegmenter.

### `create_from_options`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/vision/interactive_segmenter.py#L174-L193)

    @classmethod
    create_from_options(
        options: InteractiveSegmenterOptions
    ) -> InteractiveSegmenter

Creates the `InteractiveSegmenter` object from `options`.

<br />

<br />

<br />

| Args ||
|---|---|
| `options` | Options for the interactive segmenter task. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| `InteractiveSegmenter` object. ||

<br />

### `segment`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/vision/interactive_segmenter.py#L200-L239)

    segment(
        strokes: List[Stroke]
    ) -> image_module.Image

Performs segmentation on the previously set image.

### `set_image`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/vision/interactive_segmenter.py#L195-L198)

    set_image(
        image: image_module.Image
    ) -> None

Sets the image to be segmented.

### `__enter__`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/vision/interactive_segmenter.py#L249-L251)

    __enter__()

Returns `self` upon entering the runtime context.

### `__exit__`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/vision/interactive_segmenter.py#L253-L256)

    __exit__(
        exc_type, exc_value, traceback
    )

Shuts down the MediaPipe task instance on exit of the context manager.