FirebaseVision

public class FirebaseVision extends Object

Entry class for Firebase machine learning vision services.

To use this class, get an instance via getInstance() or getInstance(FirebaseApp), and then get an instance of a detector. The code below is an example of getting an instance of a face detector:


 FirebaseVisionFaceDetector faceDetector = FirebaseVision.getInstance().getVisionFaceDetector();
 

See individual detector classes for details.

Public Method Summary

static FirebaseVision
getInstance()
Gets an instance of FirebaseVision associated with the default FirebaseApp.
static FirebaseVision
getInstance(FirebaseApp app)
Gets an instance of FirebaseVision associated with the supplied FirebaseApp.
FirebaseVisionBarcodeDetector
getVisionBarcodeDetector(FirebaseVisionBarcodeDetectorOptions options)
Gets a FirebaseVisionBarcodeDetector that can detect barcodes in a supplied image.
FirebaseVisionBarcodeDetector
getVisionBarcodeDetector()
Gets a FirebaseVisionBarcodeDetector that can detect barcodes in a supplied image with a default FirebaseVisionBarcodeDetectorOptions.
FirebaseVisionCloudDocumentTextDetector
getVisionCloudDocumentTextDetector()
Gets a FirebaseVisionCloudDocumentTextDetector that can detect document text in a supplied image with default options.
FirebaseVisionCloudDocumentTextDetector
FirebaseVisionCloudLabelDetector
FirebaseVisionCloudLabelDetector
getVisionCloudLabelDetector()
Gets a FirebaseVisionCloudLabelDetector that can detect labels in a supplied image with default options.
FirebaseVisionCloudLandmarkDetector
getVisionCloudLandmarkDetector()
Gets a FirebaseVisionCloudLandmarkDetector that can detect landmark in a supplied image with default options.
FirebaseVisionCloudLandmarkDetector
FirebaseVisionCloudTextDetector
getVisionCloudTextDetector()
Gets a FirebaseVisionCloudTextDetector that can detect text in a supplied image with default options.
FirebaseVisionCloudTextDetector
FirebaseVisionFaceDetector
getVisionFaceDetector()
Gets a FirebaseVisionFaceDetector that detects faces in a supplied image with a default FirebaseVisionFaceDetectorOptions.
FirebaseVisionFaceDetector
getVisionFaceDetector(FirebaseVisionFaceDetectorOptions options)
Gets a FirebaseVisionFaceDetector that detects faces in a supplied image.
FirebaseVisionLabelDetector
FirebaseVisionLabelDetector
FirebaseVisionTextDetector
getVisionTextDetector()
Gets a FirebaseVisionTextDetector to perform optical character recognition.
boolean
isStatsCollectionEnabled()
Determines whether stats collection in FirebaseVision is enabled or disabled
void
setStatsCollectionEnabled(boolean enable)
Enables stats collection in ML Kit vision.

Inherited Method Summary

Public Methods

public static FirebaseVision getInstance ()

Gets an instance of FirebaseVision associated with the default FirebaseApp.

public static FirebaseVision getInstance (FirebaseApp app)

Gets an instance of FirebaseVision associated with the supplied FirebaseApp.

Parameters
app the FirebaseApp to associate this FirebaseVision with.

public FirebaseVisionBarcodeDetector getVisionBarcodeDetector (FirebaseVisionBarcodeDetectorOptions options)

Gets a FirebaseVisionBarcodeDetector that can detect barcodes in a supplied image.

Parameters
options the options for the barcode detector.
Returns

public FirebaseVisionBarcodeDetector getVisionBarcodeDetector ()

Gets a FirebaseVisionBarcodeDetector that can detect barcodes in a supplied image with a default FirebaseVisionBarcodeDetectorOptions.

Returns

public FirebaseVisionCloudDocumentTextDetector getVisionCloudDocumentTextDetector ()

Gets a FirebaseVisionCloudDocumentTextDetector that can detect document text in a supplied image with default options.

Returns

public FirebaseVisionCloudDocumentTextDetector getVisionCloudDocumentTextDetector (FirebaseVisionCloudDetectorOptions options)

Gets a FirebaseVisionCloudDocumentTextDetector that can detect document text in a supplied image.

Parameters
options the options for the cloud text detector.
Returns

public FirebaseVisionCloudLabelDetector getVisionCloudLabelDetector (FirebaseVisionCloudDetectorOptions options)

Gets a FirebaseVisionCloudLabelDetector that can detect labels in a supplied image.

Parameters
options the options for the cloud label detector.
Returns

public FirebaseVisionCloudLabelDetector getVisionCloudLabelDetector ()

Gets a FirebaseVisionCloudLabelDetector that can detect labels in a supplied image with default options.

Returns

public FirebaseVisionCloudLandmarkDetector getVisionCloudLandmarkDetector ()

Gets a FirebaseVisionCloudLandmarkDetector that can detect landmark in a supplied image with default options.

Returns

public FirebaseVisionCloudLandmarkDetector getVisionCloudLandmarkDetector (FirebaseVisionCloudDetectorOptions options)

Gets a FirebaseVisionCloudLandmarkDetector that can detect landmark in a supplied image.

Parameters
options the options for the cloud landmark detector.
Returns

public FirebaseVisionCloudTextDetector getVisionCloudTextDetector ()

Gets a FirebaseVisionCloudTextDetector that can detect text in a supplied image with default options.

Returns

public FirebaseVisionCloudTextDetector getVisionCloudTextDetector (FirebaseVisionCloudDetectorOptions options)

Gets a FirebaseVisionCloudTextDetector that can detect text in a supplied image.

Parameters
options the options for the cloud text detector.
Returns

public FirebaseVisionFaceDetector getVisionFaceDetector ()

Gets a FirebaseVisionFaceDetector that detects faces in a supplied image with a default FirebaseVisionFaceDetectorOptions.

Returns

public FirebaseVisionFaceDetector getVisionFaceDetector (FirebaseVisionFaceDetectorOptions options)

Gets a FirebaseVisionFaceDetector that detects faces in a supplied image.

Parameters
options the options for the face detector.
Returns
  • an instance of FirebaseVisionFaceDetector. Note that face detector instance will be the same instance if the supplied options are the same.

public FirebaseVisionLabelDetector getVisionLabelDetector ()

Gets a FirebaseVisionLabelDetector that labels a supplied image with a default FirebaseVisionLabelDetectorOptions.

Returns
  • an instance of FirebaseVisionLabelDetector. Note that multiple calls of this API would always return the same image label detector instance.

public FirebaseVisionLabelDetector getVisionLabelDetector (FirebaseVisionLabelDetectorOptions options)

Gets a FirebaseVisionLabelDetector that labels a supplied image.

Parameters
options the options for the image label detector.
Returns

public FirebaseVisionTextDetector getVisionTextDetector ()

Gets a FirebaseVisionTextDetector to perform optical character recognition.

Returns

public boolean isStatsCollectionEnabled ()

Determines whether stats collection in FirebaseVision is enabled or disabled

Returns
  • true if stats collection is enabled and false otherwise.

public void setStatsCollectionEnabled (boolean enable)

Enables stats collection in ML Kit vision. The stats include API calls counts, errors, API call durations, options, etc. No personally identifiable information is logged.

The setting is per FirebaseApp, and it is persistent together with app's private data. It means if the user uninstalls the app or clears all app data, the setting will be erased. The best practice is to set the flag in each initialization.

By default the logging is enabled. You have to specifically set it to false to disable logging.

Send feedback about...

Need help? Visit our support page.