Recognizes text in an image, correcting sideways reads and undersized text.
The first pass runs directly on the input file. Only when a retry is needed is the image
rendered, to a lossless PNG for the strip retry and to a resized PNG for the upscale retry.
Sideways reads are retried on overlapping strips; the strip result is kept only when it reads
more upright lines than the first pass. Undersized text is retried on a copy upscaled to ML Kit's
optimal character size, capped at MAX_OCR_RETRY_SIDE_PX; the upscaled result is kept only
when it reads at least as many non-whitespace characters as the first pass. A retry that fails
never discards the first pass: the failure is logged and the first pass is returned.
Parameters
imageUri: string
URI of the image to recognize
Returns Promise<TextRecognitionResult>
The most reliable recognition result, in the input image coordinates
Recognizes text in an image, correcting sideways reads and undersized text.
The first pass runs directly on the input file. Only when a retry is needed is the image rendered, to a lossless PNG for the strip retry and to a resized PNG for the upscale retry. Sideways reads are retried on overlapping strips; the strip result is kept only when it reads more upright lines than the first pass. Undersized text is retried on a copy upscaled to ML Kit's optimal character size, capped at MAX_OCR_RETRY_SIDE_PX; the upscaled result is kept only when it reads at least as many non-whitespace characters as the first pass. A retry that fails never discards the first pass: the failure is logged and the first pass is returned.