A Segmentation
client for identifying pixels in a supplied image as being part of the foreground or the
background.
Segmenter segmenter = Segmentation.getClient(segmenterOptions);
To perform segmentation of an image, you first need to create an instance of
InputImage
from a Bitmap
,
ByteBuffer
, etc. See
InputImage
documentation for more details. For example, the code below creates a InputImage
from a Bitmap
.
InputImage image = InputImage.fromBitmap(bitmap, rotationDegrees);
Then the code below can segment the supplied InputImage
and
asynchronously return a SegmentationMask
.
Task<SegmentationMask> task = segmenter.process(image);
task.addOnSuccessListener(...).addOnFailureListener(...);
Public Method Summary
abstract void |
close()
Closes the detector and releases its resources.
|
abstract Task<SegmentationMask> | |
abstract Task<SegmentationMask> |
Inherited Method Summary
Public Methods
public abstract void close ()
Closes the detector and releases its resources.
public abstract Task<SegmentationMask> process (MlImage image)
Performs segmentation on an input image.
This is an experimental API in beta version.
Create an MlImage
object using one of MlImage
's
builder methods. See MlImage
documentation for more details.
Returns
- a
Task
that asynchronously returns aSegmentationMask
.
public abstract Task<SegmentationMask> process (InputImage image)
Performs segmentation on an input image.
Create an InputImage
object using one of InputImage
's
factory methods. See InputImage
documentation for more details.
Returns
- a
Task
that asynchronously returns aSegmentationMask
.