Detector for finding
FirebaseVisionCloudLabel
s in a supplied image.
A cloud label detector is created via
getVisionCloudLabelDetector(FirebaseVisionCloudDetectorOptions)
, or
getVisionCloudLabelDetector()
if you wish to use the default options. For example,
the code below creates a label detector with default options.
FirebaseVisionCloudLabelDetector cloudLabelDetector =
FirebaseVision.getInstance().getVisionCloudLabelDetector();
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<FirebaseVisionCloudLabel>> task = cloudLabelDetector.detectInImage(image);
task.addOnSuccessListener(...).addOnFailureListener(...);
Public Method Summary
void |
close()
|
Task<List<FirebaseVisionCloudLabel>> |
Inherited Method Summary
Public Methods
public void close ()
Throws
IOException |
---|
public Task<List<FirebaseVisionCloudLabel>> detectInImage (FirebaseVisionImage image)
Detects labels from supplied image.
For best efficiency, create a
FirebaseVisionImage
object using one of the following ways:
fromMediaImage(Image, int)
with aJPEG
formatted image fromandroid.hardware.camera2
.fromBitmap(android.graphics.Bitmap)
.
FirebaseVisionImage
factory methods will work as well, but possibly slightly
slower.
Returns
- A
Task
that asynchronously returns aList
of detectedFirebaseVisionCloudLabel
s. An empty list is returned by theTask
if nothing is found.