News for hackers. Stuff that matters.
Re:Using Tesseract OCR with Python by kumartanmay on Tuesday July 11, 2017 @02:03AM (#14741908)
We are trying automate the entire loan application and processing. So, this involved a lot of character recognition stuff as our target group have their financial documents as hard copies. Helping them autofill their information would make their task easier as well as avoid human errors while typing. So, after reading a few articles, I first designed a OCR using google’s OCR library tesseract. The classifier produced good results when it came to reading standardised documents. But, as the complexity of the document grew, such as reading a cheque, it became challenging to achieve considerable accuracy. So, to avoid the complexities of training a custom classifier and deploying it on the cloud (which would require significant amount of computations) we decided to use Microsoft Azure’s Vision API. It provided us the coordinates of all the texts and all we had to do was look for texts similar to an Account number and IFSC from a cheque book. Using some regex it was easy to find closely matching strings. Later we extended this to read bank statements, this is where even Azure failed to read everything in the image. We had tried google vision’s API earlier but the output wasn’t satisfactory. So, decided to work on making the image more readable. I came across a lot of image filters whose main motive was to convert the image to only black and white, no other colours. I tried out a lot of them, some of them were the mean, median and gaussian thresholding. The one which worked best for us was a custom designed filter using Otsu’s Thresholding principle.
Re:Using Tesseract OCR with Python by zionsrogue on Tuesday July 11, 2017 @06:31AM (#14742960)
Adrian here, author of the PyImageSearch blog. I'll add doing a tutorial on cheque recognition (at least the routing and account numbers) to my queue. Thanks for the great suggestion.
Re:Using Tesseract OCR with Python by piker on Tuesday July 11, 2017 @07:18AM (#14743166)
One possible alternative solution is to chop the image into smaller images (with something like ImageMagick) based on each value's likely location in the document, then OCR those. You get a confidence interval with tesseract, so you can iterate over possible templates (or shrink/expand crops) until you get an [edit: aggregate] interval you're comfortable with.
Re:Using Tesseract OCR with Python by kumartanmay on Thursday July 13, 2017 @11:13AM (#14761948)
Thanks for the suggestion. Will try and share the results here
Re:Using Tesseract OCR with Python by kumartanmay on Thursday July 13, 2017 @11:36AM (#14762163)
Except for the size of cheque and the position of magnetic characters, none of the text on cheques is standardised in India. Hence we might stand a chance of chopping characters
Re:Using Tesseract OCR with Python by zebra9978 on Tuesday July 11, 2017 @05:23AM (#14742687)
is this for US banks ? I'm assuming not.

>It provided us the coordinates of all the texts and all we had to do was look for texts similar to an Account number and IFSC from a cheque book. Using some regex it was easy to find closely matching strings

Could you explain what you mean by this ? We are trying to read shopping receipts, but I have ZERO background in image processing... so have been trying to figure out what to do. I have been trying to use Google Vision API though.

>The one which worked best for us was a custom designed filter using Otsu’s Thresholding principle.

Is this where you pre-preocess the image to make it readable ? How does one do it - are these specialized tools or can I do this in python (like http://www.scipy-lectures.org/packages/scikit-image/auto_exa...)

Re:Using Tesseract OCR with Python by abc03 on Tuesday July 11, 2017 @05:54AM (#14742807)
For receipts, I recommend: http://ocrsdk.com/ which is the online product of Abbyy. They also have a blog post giving you some ideas: http://blog.ocrsdk.com/top-5-pains-for-developers-in-receipt... Has anyone successfully implemented it themselves for receipts or invoices? What was your strategy?
Re:Using Tesseract OCR with Python by ocrcustomserver on Tuesday July 11, 2017 @06:48PM (#14748734)
I can probably help, send me an email.
Re:Using Tesseract OCR with Python by holtalanm on Tuesday July 11, 2017 @08:09AM (#14743438)
if you are thinking of using OCR for this, i would suggest SikiliX. It is a Tesseract-based automation tool that is written in Java, but has Jython bindings. I have used it before, and loved it.
Re:Using Tesseract OCR with Python by winkv on Tuesday July 11, 2017 @03:11AM (#14742153)
is it possible to share the images that did not work for you?
Re:Using Tesseract OCR with Python by kumartanmay on Tuesday July 11, 2017 @04:16AM (#14742415)
We are majorly facing challenge with cheques and bank statements with noisy background. e.g. those of HDFC bank.
Re:Using Tesseract OCR with Python by anfractuosity on Tuesday July 11, 2017 @04:19AM (#14742436)
Out of interest, with cheques are you facing problems with sort code etc too, if so, I was just wondering, don't they use magnetic ink for those.
Re:Using Tesseract OCR with Python by kumartanmay on Thursday July 13, 2017 @11:25AM (#14762075)
No, magnetic ink is only used at the bottom of the cheque for banking systems to identify the source of cheque.