InteractiveSegmenter

public final class InteractiveSegmenter implements AutoCloseable


Performs interactive segmentation on images in two steps:

  1. Set an image with `setImage`.
  2. Segment with `segment` one or more times efficiently providing various strokes, allowing the user to fine tune the produced segmentation mask.

Summary

Public methods

void
static InteractiveSegmenter

Creates an InteractiveSegmenter instance.

MPImage
segment(List<Stroke> strokes)

Performs segmentation using the provided strokes.

void

Sets the image to be segmented.

Public methods

close

public void close()

createFromOptions

public static InteractiveSegmenter createFromOptions(Context context, InteractiveSegmenterOptions options)

Creates an InteractiveSegmenter instance.

Parameters
Context context

an Android Context.

InteractiveSegmenterOptions options

an InteractiveSegmenterOptions instance.

Throws
com.google.mediapipe.framework.MediaPipeException

if there is an error during creation.

segment

public MPImage segment(List<Stroke> strokes)

Performs segmentation using the provided strokes.

Parameters
List<Stroke> strokes

The List of Strokes containing the user selected points/strokes.

Returns
MPImage

An MPImage representing the segmentation mask.

Throws
com.google.mediapipe.framework.MediaPipeException

if there is an error during segmentation.

setImage

public void setImage(MPImage image)

Sets the image to be segmented.

Throws
com.google.mediapipe.framework.MediaPipeException

if the graph cannot be created.