Google is committed to advancing racial equity for Black communities. See how.


public class FirebaseVisionTextDetector extends Object
implements Closeable Closeable

Detector for performing optical character recognition(OCR) on an input image.

A text detector is created via getVisionTextDetector(). See the code example below.

 FirebaseVisionTextDetector textDetector =
To perform OCR on an image, you first need to create an instance of FirebaseVisionImage from a ByteBuffer, Bitmap, 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 texts in the supplied FirebaseVisionImage.

 Task<FirebaseVisionText> task = textDetector.detectInImage(image);

Public Method Summary

Closes the text detector and release its model resources.

Inherited Method Summary

Public Methods

public void close ()

Closes the text detector and release its model resources.


public Task<FirebaseVisionText> detectInImage (FirebaseVisionImage image)

Detects FirebaseVisionText from a FirebaseVisionImage. The OCR is performed asynchronously. Right now, only the following input types are supported:

For best efficiency, create a FirebaseVisionImage object using one of the following ways:

All other FirebaseVisionImage factory methods will work as well, but possibly slightly slower.