AI-generated Key Takeaways
-
Segmenter identifies foreground or background pixels in an image.
-
To perform segmentation, you first create an InputImage instance.
-
The
processmethod performs segmentation and returns a SegmentationMask asynchronously. -
The
closemethod closes the detector and releases its resources.
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);
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
Taskthat 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
Taskthat asynchronously returns aSegmentationMask.