Detector for finding FirebaseVisionLabel
s
in a supplied image.
A label detector is created via
getVisionLabelDetector(FirebaseVisionLabelDetectorOptions)
, or
getVisionLabelDetector()
if you wish to use the default options. For example, the
code below creates a label detector with default options.
FirebaseVisionLabelDetector labelDetector =
FirebaseVision.getInstance().getVisionLabelDetector();
To perform label detection in an image, you first need to create an instance of
FirebaseVisionImage
from a Bitmap
,
ByteBuffer
,
etc. See FirebaseVisionImage
documentation for more details. For example, the code below creates a FirebaseVisionImage
from a Bitmap
.
FirebaseVisionImage image = FirebaseVisionImage.fromBitmap(bitmap);
Then
the code below can detect labels in the supplied FirebaseVisionImage
.
Task
<List<FirebaseVisionLabel>> task = labelDetector.detectInImage(image);
task.addOnSuccessListener(...).addOnFailureListener(...);
Public Method Summary
void |
close()
Closes the
FirebaseVisionLabelDetector and releases its model resources.
|
Task<List<FirebaseVisionLabel>> |
Inherited Method Summary
Public Methods
public void close ()
Closes the
FirebaseVisionLabelDetector
and releases its model resources.
Throws
IOException |
---|
public Task<List<FirebaseVisionLabel>> detectInImage (FirebaseVisionImage image)
Detects image labels from supplied image.
For best efficiency, create a
FirebaseVisionImage
object from
fromBitmap(android.graphics.Bitmap)
. All other
FirebaseVisionImage
factory methods will work as well, but possibly slightly
slower.
Returns
- A
Task
that asynchronously returns aList
of detectedFirebaseVisionLabel
s.