Thanks to googles text recognition API I was able to effortlessly get text from the receipts I wanted to parse.
In the picture above you can see I created a method I could pass images into which returned results through a callback. The strategy was simple.
Here is the link I used to set it up.
1) Add the library through gradle.
2) Create a method where you can pass an image and probably a countdown latch
3) The using the firebase api create an Image Input Object, a Detector Object and an on success listener.
Thats it! But you may notice two things
A) I used a countdown latch. My text recognition ran in an Intent Service completely separate from the UI and this allowed me to halt the overall parsing strategy to wait for the Vision Results.
B) Googles API returns a vision object but this object was not serializable so I made a serialize-able version and did he conversion myself. The vision result gives you a box where you can easily detect its location and size on the screen and therefore make critical decisions about what information you are looking at.
For example the vendors name is often larger and directly adjacent the phone number or address. These two factors alone will give you the correct vendor with startling accuracy.
Or for example the price is usually on the right lower half (localization excluded).
Anyways, I enjoyed using it and its always fun to stand on somebody else’s shoulders when building your project. Thanks Google