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

FirebaseVisionTextDetector

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 =
    FirebaseVision.getInstance().getVisionTextDetector();
 
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);
 task.addOnSuccessListener(...).addOnFailureListener(...);
 

Public Method Summary

void
close()
Closes the text detector and release its model resources.
Task<FirebaseVisionText>

Inherited Method Summary

Public Methods

public void close ()

Closes the text detector and release its model resources.

Throws
IOException

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.
Returns