AI-generated Key Takeaways
-
TextRecognition
is an entry point for performing optical character recognition (OCR) on images to detect Latin-based characters. -
You create a
TextRecognizer
instance usingTextRecognition.getClient(TextRecognizerOptionsInterface)
and process images with it. -
Input images for OCR are created from sources like Bitmaps or ByteBuffers, using the
InputImage
class. -
To avoid resource leaks, make sure to call
TextRecognizer.close()
when you are finished using theTextRecognizer
instance.
Entry point for performing optical character recognition(OCR) on an input image to detect latin-based characters.
A TextRecognizer
is created via
getClient(TextRecognizerOptionsInterface)
. See the code example below.
TextRecognizer textRecognizer = TextRecognition.getClient(TextRecognizerOptionsInterface);
InputImage
from a ByteBuffer
,
Bitmap
, etc. See
InputImage
documentation for more details. For example, the code below creates an InputImage
from a Bitmap
.
InputImage image = InputImage.fromBitmap(bitmap, rotationDegrees);
Then the code below can detect texts in the supplied InputImage
.
Task<Text> task = textRecognizer.process(image);
task.addOnSuccessListener(...).addOnFailureListener(...);
Public Method Summary
static TextRecognizer |
getClient(TextRecognizerOptionsInterface
options)
Gets a new instance of
TextRecognizer
to perform optical character recognition on device with the specified
TextRecognizerOptionsInterface .
|
Inherited Method Summary
Public Methods
public static TextRecognizer getClient (TextRecognizerOptionsInterface options)
Gets a new instance of TextRecognizer
to perform optical character recognition on device with the specified TextRecognizerOptionsInterface
.
To release the resources associated with a TextRecognizer, you need to ensure that
TextRecognizer.close()
is called on the resulting TextRecognizer
object once it will no longer be used.