Stay organized with collections
Save and categorize content based on your preferences.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2020-08-08 UTC."],[],[],null,["# FirebaseVisionDocumentTextRecognizer\n\npublic 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 \n### Public Method Summary\n\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| void | [close](/docs/reference/android/com/google/firebase/ml/vision/document/FirebaseVisionDocumentTextRecognizer#close())() |\n| [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 | [processImage](/docs/reference/android/com/google/firebase/ml/vision/document/FirebaseVisionDocumentTextRecognizer#processImage(com.google.firebase.ml.vision.common.FirebaseVisionImage))([FirebaseVisionImage](/docs/reference/android/com/google/firebase/ml/vision/common/FirebaseVisionImage) image) Detects text from supplied document image. |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nFrom interface java.io.Closeable \n\n|---------------|---------|\n| abstract void | close() |\n\nFrom interface java.lang.AutoCloseable \n\n|---------------|---------|\n| abstract void | close() |\n\nPublic Methods\n--------------\n\n#### public void **close** ()\n\n##### Throws\n\n| [IOException](//developer.android.com/reference/java/io/IOException.html) | |\n|---------------------------------------------------------------------------|---|\n\n#### public [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)\n\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\n##### Returns\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)."]]