Detector for finding popular natural and man-made structures within an image.
A cloud landmark is created via
getVisionCloudLandmarkDetector(FirebaseVisionCloudDetectorOptions)
or
getVisionCloudLandmarkDetector()
if you wish to use the default
FirebaseVisionCloudDetectorOptions
. For example, the code below creates a cloud
landmark detector with default options.
FirebaseVisionCloudLandmarkDetector cloudLandmarkDetector =
FirebaseVision.getInstance().getVisionCloudLandmarkDetector();
To find landmark in an image, you first need to create an instance of
FirebaseVisionImage
from a Bitmap
,
ByteBuffer
, etc. See
detectInImage(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 landmarks in the supplied FirebaseVisionImage
.
Task
<List<FirebaseVisionCloudLandmark>> task =
cloudLandmarkDetector.detectInImage(image);
task.addOnSuccessListener(...).addOnFailureListener(...);
Public Method Summary
void |
close()
|
Task<List<FirebaseVisionCloudLandmark>> |
Inherited Method Summary
Public Methods
public void close ()
Throws
IOException |
---|
public Task<List<FirebaseVisionCloudLandmark>> detectInImage (FirebaseVisionImage image)
Detects landmarks 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 the detectedList
ofFirebaseVisionCloudLandmark
. The list is empty if nothing is found.