android – Create a template to obtain information from the IFE/INE (OCR)


I am trying to obtain the information of an IFE/INE credential. I have made tests with the Google Mobile Vision API ( ) to be able to achieve it, but I get very few fields or the information is very incomprehensible.

It should be noted that the credential information is obtained sequentially, but sometimes it is not. I really have no idea why it is sometimes like this and sometimes it isn't.

I have downloaded some commercial OCRs and I see that they use Tesseract , and I would like to make a template but I really have no idea how to do it.


UPDATE: I left you the link with the library I made, I hope it still works for you.

I just made one, unfortunately I can't make it public, but I can guide you a bit. I am using Mobile Vision as you mention, before I used Tesseract which is very good but it increases the size of your application too much. To begin with, you should know that there are 5 types of IFE/INE A, B, C, D and E, of which the only one that is not in force is type A. Now, in order to correctly read the fields, the first thing to do is You must do is cut the photo to the size of the IFE/INE so that it looks like the image you show, once this is done, the next thing is to take measurements, how to do it? Let's take the image you posted as a reference. Suppose we need to output the name, and the image is 5.4 high by 8.6 wide. We know that android takes the origin of an image in the upper left corner, we take the measurements from there, the name starts at 0.3 cm in X and 1.6 cm in Y, it has an average width of 4 cm and a height of 1 cm . Once having these measurements as a base, the "percentages" are taken out and it would be left with X = (0.3/8.6), Y = (1.6/5.4), WIDTH = (4/8.6) and HEIGHT = (1/5.4). Having this data we can create a bitmap of the name from the one previously cut and pass it to the API. It is important to get this "proportional" data since in Android there is a great variety of cameras and the photos are of different sizes. When I can publish the library I made I will edit this. Greetings.

Scroll to Top