InteractiveSegmenter

public final class InteractiveSegmenter

Performs interactive segmentation on images using either InteractiveSegmenter.RegionOfInterest hints or split-mode encoder/decoder Stroke interactions.

Nested Classes

class InteractiveSegmenter.InteractiveSegmenterOptions Options for setting up an InteractiveSegmenter. 
class InteractiveSegmenter.RegionOfInterest The Region-Of-Interest (ROI) to interact with in an interactive segmentation inference. 

Public Methods

static InteractiveSegmenter
createFromBuffer(Context context, ByteBuffer modelBuffer)
Creates an InteractiveSegmenter instance from a model buffer and default options.
static InteractiveSegmenter
createFromFile(Context context, String modelPath)
Creates an InteractiveSegmenter instance from a model file and default options.
static InteractiveSegmenter
createFromFile(Context context, File modelFile)
Creates an InteractiveSegmenter instance from a model File and default options.
static InteractiveSegmenter
void
setImage(MPImage image)
Sets and encodes the image for split-mode interactive segmentation (runs the encoder once per image).
MPImage
segment(List<Stroke> strokes)
Performs lightweight decoder segmentation on the previously set image using the provided user strokes.
ImageSegmenterResult
segment(MPImage image, InteractiveSegmenter.RegionOfInterest roi)
Performs interactive segmentation on the provided single image with a RegionOfInterest.
ImageSegmenterResult
segment(MPImage image, InteractiveSegmenter.RegionOfInterest roi, ImageProcessingOptions imageProcessingOptions)
Performs interactive segmentation on the provided single image with RegionOfInterest and ImageProcessingOptions.
void
segmentWithResultListener(MPImage image, InteractiveSegmenter.RegionOfInterest roi, ImageProcessingOptions imageProcessingOptions)
Performs interactive segmentation and provides the result to the configured ResultListener.
void
close()
Closes and cleans up the MediaPipe InteractiveSegmenter task.

Inherited Methods

Public Methods

public static InteractiveSegmenter createFromBuffer (Context context, ByteBuffer modelBuffer)

Creates an InteractiveSegmenter instance from a model buffer and default options.

public static InteractiveSegmenter createFromFile (Context context, String modelPath)

Creates an InteractiveSegmenter instance from a model file and default options.

public static InteractiveSegmenter createFromFile (Context context, File modelFile)

Creates an InteractiveSegmenter instance from a model File and default options.

public static InteractiveSegmenter createFromOptions (Context context, InteractiveSegmenter.InteractiveSegmenterOptions segmenterOptions)

public void setImage (MPImage image)

Sets and encodes the image for split-mode interactive segmentation (runs the encoder once per image).

Parameters
imagethe MPImage to encode.

public MPImage segment (List<Stroke> strokes)

Performs lightweight decoder segmentation on the previously set image using the provided user strokes.

Parameters
strokeslist of user-drawn Stroke objects.

public ImageSegmenterResult segment (MPImage image, InteractiveSegmenter.RegionOfInterest roi)

Performs interactive segmentation on the provided single image with a RegionOfInterest.

public ImageSegmenterResult segment (MPImage image, InteractiveSegmenter.RegionOfInterest roi, ImageProcessingOptions imageProcessingOptions)

Performs interactive segmentation on the provided single image with RegionOfInterest and ImageProcessingOptions.

public void segmentWithResultListener (MPImage image, InteractiveSegmenter.RegionOfInterest roi, ImageProcessingOptions imageProcessingOptions)

Performs interactive segmentation and provides the result to the configured ResultListener.

public void close ()

Closes and cleans up the MediaPipe InteractiveSegmenter task.