AI-generated Key Takeaways
-
ImageLabeling
is the entry point for image labeling tasks in ML Kit, providing access to anImageLabeler
instance. -
You create an
ImageLabeler
usingImageLabeling.getClient()
with specified options. -
To detect labels, you process an
InputImage
(created from a Bitmap, ByteBuffer, etc.) with theImageLabeler
. -
Remember to call
ImageLabeler.close()
when finished to release resources.
Entry point to get an ImageLabeler
for finding ImageLabel
s in
a supplied image.
An image labeler is created via
getClient(ImageLabelerOptionsBase)
.
Example:
ImageLabeler imageLabeler = ImageLabeling.getClient(options);
To perform label detection in 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 an InputImage
from a Bitmap
.
InputImage image = InputImage.fromBitmap(bitmap, rotationDegrees);
Then the code below can detect labels in the supplied InputImage
.
Task<List<ImageLabel>> task = imageLabeler.process(image);
task.addOnSuccessListener(...).addOnFailureListener(...);
Public Method Summary
static ImageLabeler |
getClient(ImageLabelerOptionsBase
options)
Gets an new instance of
ImageLabeler
that labels a supplied image.
|
Inherited Method Summary
Public Methods
public static ImageLabeler getClient (ImageLabelerOptionsBase options)
Gets an new instance of ImageLabeler
that labels a supplied image.
To release the resources associated with a ImageLabeler
,
you need to ensure that ImageLabeler.close()
is called on the resulting ImageLabeler
instance once it will no longer be used.
Parameters
options | the options for the image labeler. It should be one of the concrete options
like
ImageLabelerOptions or
CustomImageLabelerOptions . |
---|