Detector for performing optical character recognition(OCR) on an input image by sending
the image to Google cloud ML backend. In comparison to
FirebaseVisionCloudTextDetector
, it detects dense document text.
A cloud document text detector is created via
getVisionCloudDocumentTextDetector(FirebaseVisionCloudDetectorOptions)
or
getVisionCloudDocumentTextDetector()
if you wish to use the default
FirebaseVisionCloudDetectorOptions
. For example, the code below creates a cloud
document text detector with default options.
FirebaseVisionCloudDocumentTextDetector cloudDocumentTextDetector =
FirebaseVision.getInstance().getVisionCloudDocumentTextDetector();
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);
FirebaseVisionImage
.
Task
<FirebaseVisionCloudText> task = cloudDocumentTextDetector.detectInImage(image);
task.addOnSuccessListener(...).addOnFailureListener(...);
Public Method Summary
void |
close()
|
Task<FirebaseVisionCloudText> |
Inherited Method Summary
Public Methods
public void close ()
Throws
IOException |
---|
public Task<FirebaseVisionCloudText> detectInImage (FirebaseVisionImage image)
Detects text from supplied document image.
For best efficiency, create a
FirebaseVisionImage
object using one of the following ways:
fromMediaImage(Image, int)
with aJPEG
formatted image fromandroid.hardware.camera2
.fromBitmap(android.graphics.Bitmap)
.
FirebaseVisionImage
factory methods will work as well, but possibly slightly
slower.
Returns
- A
Task
that asynchronously returns the detectedFirebaseVisionCloudText
.