FirebaseVisionDocumentTextRecognizer

public class FirebaseVisionDocumentTextRecognizer extends Object
implements Closeable

Detector for performing optical character recognition(OCR) on an input image by sending the image to Google cloud ML backend. In comparison to FirebaseVisionTextRecognizer, it detects dense document text.

A cloud document text detector is created via getCloudDocumentTextRecognizer(FirebaseVisionCloudDocumentRecognizerOptions) or getCloudDocumentTextRecognizer() if you wish to use the default FirebaseVisionCloudDocumentRecognizerOptions. For example, the code below creates a cloud document text detector with default options.


 FirebaseVisionDocumentTextRecognizer cloudDocumentTextDetector =
    FirebaseVision.getInstance().getCloudDocumentTextRecognizer();
 
To perform document text detection in an image, you first need to create an instance of FirebaseVisionImage from a Bitmap, ByteBuffer, 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<FirebaseVisionDocumentText> task = cloudDocumentTextDetector.processImage(image);
 task.addOnSuccessListener(...).addOnFailureListener(...);
 

Public Method Summary

void
Task<FirebaseVisionDocumentText>
processImage(FirebaseVisionImage image)
Detects text from supplied document image.

Inherited Method Summary

Public Methods

public void close ()

Throws
IOException

public Task<FirebaseVisionDocumentText> processImage (FirebaseVisionImage image)

Detects text from supplied document image.

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