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

I am trying to get the information of a credential from the IFE / ine. I have run tests with the API of Google Mobile Vision (https://developers.google.com/vision/text-overview ) to be able to achieve it but you get me very few fields or you get the information very poorly understood.

It should be noted that the credential information is obtained sequentially, but sometimes it does not. I really have no idea why let sometimes be so and sometimes not.

I have downloaded some commercial OCRs and see that they use Tesseract, and I would like to make a template but actually I don't have much idea how to make it.

 5
Author: BetaM, 2016-09-26

1 answers

Update: he left you the link with the library I made, I hope it still serves you. https://github.com/BrandonVargas/AndroidOCRFforID

I just made one, unfortunately I can't make it public, but I can guide you a bit. I'm using Mobile Vision as you mention, before use Tesseract which is very good but increases the size of your app too much. To start 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 the type A. Now to make a correct reading of the fields the first thing you must do is crop the photo to the size of the IFE/INE so that it is like the image you show, once this is done the next thing is to take measurements, how to do it? Let's take as a reference the picture you put. Suppose we require to get the name out, and the image measures 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 those measurements as a basis, the "percentages" are taken out and it would be 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 cropped above and pass it to the API. It is important to take out this "proportional" data since in Android there is a wide variety of cameras and photos are of various sizes. When I can publish the library I made I will edit this. Greeting.

 5
Author: Brandon V MariƱelarena, 2017-08-27 14:47:38