I am developing an Android application that reads text from an image in order to scan a DNI. For this I use the object TextRecognizer
and its method .detect(Frame)
which is passed a frame
and he analyzes it by returning a SparseArray<TextBlock>
object which can be iterated to obtain all the text that has been taken from the image. So far so good. The problem comes when interpreting the text because I get disorganized words and I do not know how to decide what is the last name, what is the name etc. The normal thing would be that, in the DNI (Spanish) the first surname was what is under the label First name, the thing is that I do not know how to get what I read in an orderly and vertical to know in order that is everything . It's weird to explain, but here's a picture of a false identity card and I'll explain it better:
When I scan this image and go through the Array
that has come to me, maybe the word "primer" comes to me as the word "Carmen" arrives first, and then the next iteration comes the "IDESP" ...
What I need is to know if there is a possibility to scan the image vertically and that the first thing that arrives to me is "NATIONAL IDENTITY DOCUMENT", the second "FIRST SURNAME", then the last name and so on.