FirebaseVisionDocumentTextRecognizer
Stay organized with collections
Save and categorize content based on your preferences.
Inherited Method Summary
From class java.lang.Object
Object
|
clone()
|
boolean |
|
void |
finalize()
|
final Class<?>
|
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()
|
From interface java.io.Closeable
From interface java.lang.AutoCloseable
Public Methods
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.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-08-08 UTC.
[null,null,["Last updated 2020-08-08 UTC."],[],[],null,["public class **FirebaseVisionDocumentTextRecognizer** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nimplements [Closeable](//developer.android.com/reference/java/io/Closeable.html) \nDetector for performing optical character recognition(OCR) on an input image by sending\nthe image to Google cloud ML backend. In comparison to [FirebaseVisionTextRecognizer](/docs/reference/android/com/google/firebase/ml/vision/text/FirebaseVisionTextRecognizer), it detects dense document text.\n\nA cloud document text detector is created via [getCloudDocumentTextRecognizer(FirebaseVisionCloudDocumentRecognizerOptions)](/docs/reference/android/com/google/firebase/ml/vision/FirebaseVision#getCloudDocumentTextRecognizer(com.google.firebase.ml.vision.document.FirebaseVisionCloudDocumentRecognizerOptions)) or\n[getCloudDocumentTextRecognizer()](/docs/reference/android/com/google/firebase/ml/vision/FirebaseVision#getCloudDocumentTextRecognizer()) if you wish to use the default [FirebaseVisionCloudDocumentRecognizerOptions](/docs/reference/android/com/google/firebase/ml/vision/document/FirebaseVisionCloudDocumentRecognizerOptions). For example, the code below creates\na cloud document text detector with default options. \n\n\n FirebaseVisionDocumentTextRecognizer cloudDocumentTextDetector =\n FirebaseVision.getInstance().getCloudDocumentTextRecognizer();\n \nTo perform document text detection in an image, you first need to create an instance of [FirebaseVisionImage](/docs/reference/android/com/google/firebase/ml/vision/common/FirebaseVisionImage) from a [Bitmap](//developer.android.com/reference/android/graphics/Bitmap.html), [ByteBuffer](//developer.android.com/reference/java/nio/ByteBuffer.html), etc. See [FirebaseVisionImage](/docs/reference/android/com/google/firebase/ml/vision/common/FirebaseVisionImage) documentation for more details. For example, the code below creates a [FirebaseVisionImage](/docs/reference/android/com/google/firebase/ml/vision/common/FirebaseVisionImage) from a [Bitmap](//developer.android.com/reference/android/graphics/Bitmap.html). \n\n FirebaseVisionImage image = FirebaseVisionImage.fromBitmap(bitmap);\n\nThen the code below can detect texts in the supplied [FirebaseVisionImage](/docs/reference/android/com/google/firebase/ml/vision/common/FirebaseVisionImage). \n\n\n Task\u003cFirebaseVisionDocumentText\u003e task = cloudDocumentTextDetector.processImage(image);\n task.addOnSuccessListener(...).addOnFailureListener(...);\n \nPublic Method Summary\n\nInherited Method Summary \nFrom class java.lang.Object \n\nFrom interface java.io.Closeable \n\nFrom interface java.lang.AutoCloseable \n\nPublic Methods \n\npublic void **close** () \n\nThrows\n\npublic [Task](//developers.google.com/android/reference/com/google/android/gms/tasks/Task.html)\\\u003c[FirebaseVisionDocumentText](/docs/reference/android/com/google/firebase/ml/vision/document/FirebaseVisionDocumentText)\\\u003e\n**processImage** ([FirebaseVisionImage](/docs/reference/android/com/google/firebase/ml/vision/common/FirebaseVisionImage) image) \nDetects text from supplied document image.\n\nFor best efficiency, create a [FirebaseVisionImage](/docs/reference/android/com/google/firebase/ml/vision/common/FirebaseVisionImage) object using one of the following ways:\n\n- [fromMediaImage(Image, int)](/docs/reference/android/com/google/firebase/ml/vision/common/FirebaseVisionImage#fromMediaImage(android.media.Image, int)) with a [JPEG](//developer.android.com/reference/android/graphics/ImageFormat.html#JPEG) formatted image from [android.hardware.camera2](/docs/reference/android/reference/android/hardware/camera2/package-summary).\n- [fromBitmap(android.graphics.Bitmap)](/docs/reference/android/com/google/firebase/ml/vision/common/FirebaseVisionImage#fromBitmap(android.graphics.Bitmap)).\n\nAll other [FirebaseVisionImage](/docs/reference/android/com/google/firebase/ml/vision/common/FirebaseVisionImage) factory methods will work as well, but possibly slightly slower. \n\nReturns\n\n- A [Task](//developers.google.com/android/reference/com/google/android/gms/tasks/Task.html) that asynchronously returns the detected [FirebaseVisionDocumentText](/docs/reference/android/com/google/firebase/ml/vision/document/FirebaseVisionDocumentText)."]]