FirebaseVision

public classFirebaseVision extendsObject

Entry class for Firebase machine learning vision services.

To use this class, get an instance viagetInstance() 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

FirebaseVisionDocumentTextRecognizer
FirebaseVisionDocumentTextRecognizer
getCloudDocumentTextRecognizer()
Gets a FirebaseVisionDocumentTextRecognizer that can detect document text in a supplied image with default options.
FirebaseVisionImageLabeler
getCloudImageLabeler(FirebaseVisionCloudImageLabelerOptions options)
Gets a cloud version of FirebaseVisionImageLabeler that can detect labels in a supplied image.
FirebaseVisionImageLabeler
getCloudImageLabeler()
Gets a cloud version of FirebaseVisionImageLabeler that can detect labels in a supplied image with default options.
FirebaseVisionTextRecognizer
getCloudTextRecognizer()
Gets a FirebaseVisionTextRecognizer to perform optical character recognition with cloud model and default options.
FirebaseVisionTextRecognizer
getCloudTextRecognizer(FirebaseVisionCloudTextRecognizerOptions options)
Gets a FirebaseVisionTextRecognizer to perform optical character recognition with cloud model and provided options.
staticFirebaseVision
getInstance()
Gets an instance ofFirebaseVision associated with the defaultFirebaseApp.
staticFirebaseVision
getInstance(FirebaseApp app)
Gets an instance ofFirebaseVision associated with the suppliedFirebaseApp.
FirebaseVisionImageLabeler
getOnDeviceAutoMLImageLabeler(FirebaseVisionOnDeviceAutoMLImageLabelerOptions options)
This method is deprecated. The standalone ML Kit SDK replaces this API. For more information, refer to themigration guide.
FirebaseVisionImageLabeler
getOnDeviceImageLabeler()
This method is deprecated. The standalone ML Kit SDK replaces this API. For more information, refer to themigration guide.
FirebaseVisionImageLabeler
getOnDeviceImageLabeler(FirebaseVisionOnDeviceImageLabelerOptions options)
This method is deprecated. The standalone ML Kit SDK replaces this API. For more information, refer to themigration guide.
FirebaseVisionObjectDetector
getOnDeviceObjectDetector()
This method is deprecated. The standalone ML Kit SDK replaces this API. For more information, refer to themigration guide.
FirebaseVisionObjectDetector
getOnDeviceObjectDetector(FirebaseVisionObjectDetectorOptions options)
This method is deprecated. The standalone ML Kit SDK replaces this API. For more information, refer to themigration guide.
FirebaseVisionTextRecognizer
getOnDeviceTextRecognizer()
This method is deprecated. The standalone ML Kit SDK replaces this API. For more information, refer to themigration guide.
FirebaseVisionBarcodeDetector
getVisionBarcodeDetector(FirebaseVisionBarcodeDetectorOptions options)
This method is deprecated. The standalone ML Kit SDK replaces this API. For more information, refer to themigration guide.
FirebaseVisionBarcodeDetector
getVisionBarcodeDetector()
This method is deprecated. The standalone ML Kit SDK replaces this API. For more information, refer to themigration guide.
FirebaseVisionCloudLandmarkDetector
getVisionCloudLandmarkDetector()
Gets a FirebaseVisionCloudLandmarkDetector that can detect landmark in a supplied image with default options.
FirebaseVisionCloudLandmarkDetector
FirebaseVisionFaceDetector
getVisionFaceDetector()
This method is deprecated. The standalone ML Kit SDK replaces this API. For more information, refer to themigration guide.
FirebaseVisionFaceDetector
getVisionFaceDetector(FirebaseVisionFaceDetectorOptions options)
This method is deprecated. The standalone ML Kit SDK replaces this API. For more information, refer to themigration guide.
boolean
isStatsCollectionEnabled()
Determines whether stats collection inFirebaseVision is enabled or disabled
void
setStatsCollectionEnabled(boolean enable)
Enables stats collection in ML Kit vision.

Inherited Method Summary

From class java.lang.Object
Object
clone()
boolean
equals(Object arg0)
void
finalize()
finalClass<?>
getClass()
int
hashCode()
final void
notify()
final void
notifyAll()
String
toString()
final void
wait(long arg0, int arg1)
final void
wait(long arg0)
final void
wait()

Public Methods

public FirebaseVisionDocumentTextRecognizergetCloudDocumentTextRecognizer(FirebaseVisionCloudDocumentRecognizerOptions options)

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

Parameters
optionsthe options for the cloud text detector.
Returns

public FirebaseVisionDocumentTextRecognizergetCloudDocumentTextRecognizer()

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

Returns

public FirebaseVisionImageLabelergetCloudImageLabeler(FirebaseVisionCloudImageLabelerOptions options)

Gets a cloud version of FirebaseVisionImageLabeler that can detect labels in a supplied image.

Parameters
optionsthe options for the cloud image labeler.
Returns

public FirebaseVisionImageLabelergetCloudImageLabeler()

Gets a cloud version of FirebaseVisionImageLabeler that can detect labels in a supplied image with default options.

Returns

public FirebaseVisionTextRecognizergetCloudTextRecognizer()

Gets a FirebaseVisionTextRecognizer to perform optical character recognition with cloud model and default options.

Returns

public FirebaseVisionTextRecognizergetCloudTextRecognizer(FirebaseVisionCloudTextRecognizerOptions options)

Gets a FirebaseVisionTextRecognizer to perform optical character recognition with cloud model and provided options.

Returns

public staticFirebaseVisiongetInstance()

Gets an instance ofFirebaseVision associated with the defaultFirebaseApp.

public staticFirebaseVisiongetInstance(FirebaseApp app)

Gets an instance ofFirebaseVision associated with the suppliedFirebaseApp.

Parameters
apptheFirebaseApp to associate thisFirebaseVision with.

public FirebaseVisionImageLabelergetOnDeviceAutoMLImageLabeler(FirebaseVisionOnDeviceAutoMLImageLabelerOptions options)

This method is deprecated.
The standalone ML Kit SDK replaces this API. For more information, refer to themigration guide.

Gets an on device version of FirebaseVisionImageLabeler that labels a supplied image, using a model trained from Firebase AutoML.

Parameters
optionsthe options for the on device automl image labeler.
Returns
Throws
FirebaseMLExceptionif failed to instantiate a FirebaseVisionImageLabeler.

public FirebaseVisionImageLabelergetOnDeviceImageLabeler()

This method is deprecated.
The standalone ML Kit SDK replaces this API. For more information, refer to themigration guide.

Gets an on device version of FirebaseVisionImageLabeler that labels a supplied image with a default FirebaseVisionOnDeviceImageLabelerOptions.

Returns

public FirebaseVisionImageLabelergetOnDeviceImageLabeler(FirebaseVisionOnDeviceImageLabelerOptions options)

This method is deprecated.
The standalone ML Kit SDK replaces this API. For more information, refer to themigration guide.

Gets an on device version of FirebaseVisionImageLabeler that labels a supplied image.

Parameters
optionsthe options for the on device image labeler.
Returns

public FirebaseVisionObjectDetectorgetOnDeviceObjectDetector()

This method is deprecated.
The standalone ML Kit SDK replaces this API. For more information, refer to themigration guide.

Gets a FirebaseVisionObjectDetector that can detect objects in a supplied image with default options.

Returns

public FirebaseVisionObjectDetectorgetOnDeviceObjectDetector(FirebaseVisionObjectDetectorOptions options)

This method is deprecated.
The standalone ML Kit SDK replaces this API. For more information, refer to themigration guide.

Gets a FirebaseVisionObjectDetector that can detect objects in a supplied image with given options.

Returns

public FirebaseVisionTextRecognizergetOnDeviceTextRecognizer()

This method is deprecated.
The standalone ML Kit SDK replaces this API. For more information, refer to themigration guide.

Gets a FirebaseVisionTextRecognizer to perform optical character recognition with on-device model.

Returns

public FirebaseVisionBarcodeDetectorgetVisionBarcodeDetector(FirebaseVisionBarcodeDetectorOptions options)

This method is deprecated.
The standalone ML Kit SDK replaces this API. For more information, refer to themigration guide.

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

Parameters
optionsthe options for the barcode detector.
Returns

public FirebaseVisionBarcodeDetectorgetVisionBarcodeDetector()

This method is deprecated.
The standalone ML Kit SDK replaces this API. For more information, refer to themigration guide.

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

Returns

public FirebaseVisionCloudLandmarkDetectorgetVisionCloudLandmarkDetector()

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

Returns

public FirebaseVisionCloudLandmarkDetectorgetVisionCloudLandmarkDetector(FirebaseVisionCloudDetectorOptions options)

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

Parameters
optionsthe options for the cloud landmark detector.
Returns

public FirebaseVisionFaceDetectorgetVisionFaceDetector()

This method is deprecated.
The standalone ML Kit SDK replaces this API. For more information, refer to themigration guide.

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

Returns

public FirebaseVisionFaceDetectorgetVisionFaceDetector(FirebaseVisionFaceDetectorOptions options)

This method is deprecated.
The standalone ML Kit SDK replaces this API. For more information, refer to themigration guide.

Gets a FirebaseVisionFaceDetector that detects faces in a supplied image.

Parameters
optionsthe options for the face detector.
Returns

public booleanisStatsCollectionEnabled()

Determines whether stats collection inFirebaseVision is enabled or disabled

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

public voidsetStatsCollectionEnabled(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 perFirebaseApp, 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.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2020-08-14 UTC.