In the processTextRecogniation operate, we first get a list of blocks from the FirebaseVisionText object. If no text uncovered, we need to screen a information “No Text found” and then return out from the perform.

Subsequent, we require to iterate by way of the blocks, which we get from the FirebaseVisionText. We then get the line of textual content from FirebaseVisionText.line and iterate on it.

Just after finding the strains and iterating, we require to get the ingredient Checklist from the FirebaseVisionText.Factor and then iterate the elements to get the frames for the unique words in just the impression.

Ultimately, we append the text from the aspect into the TextView.

Here’s a look at the code for this system:

private pleasurable processTextRecognition(textual content: FirebaseVisionText) {
val textBlock: Checklist = textual content.textBlocks
if (textBlock.isEmpty())
imageText.textual content = "No Textual content found"
return

for (index in until textBlock.size)
val lines: Checklist = textBlock[index].strains
for (j in until finally strains.size)
val ingredient: Record = lines[j].elements
for (k in until component.dimensions)
imageText.append(" " + ingredient[k].text)


}