Live data from Hacker News

Ask HN: Open source OCR library?

news.ycombinator.com

31–40 of 104 posts

Re: Ask HN: Open source OCR library?

#31

Tesseract is ok, but I gather that a lot of the good work in the last few years on it has remained closed source within Google. If you want to do text extraction, look at things like Stroke Width Transform to extract regions of text before passing them to Tesseract.

Is it possible to extract text from pre-formatted documents? Let's say I have a document issued by the government, and I am only interested in the fields that have been filled. Could I process such a document fully automated using Tesseract? Maybe some image pre-processing would be needed?

Re: Ask HN: Open source OCR library?

#32
Does it have to be open-source? If free, but not trainable and restricted to Windows apps/phone is good enough, then I recommend the Microsoft OCR library. It gives you very, VERY good results out of the box. An excellent piece of work from Microsoft Research. To test it, see for example https://ocr.a9t9.com/ which uses Microsoft OCR inside.

And for comparison, an OCR application with Tesseract inside: It has a dramatically lower text recognition rate: http://blog.a9t9.com/p/free-ocr-windows.html

(Disclaimer: both links are my little open-source side projects)

Re: Ask HN: Open source OCR library?

#33
post #31

Tesseract is ok, but I gather that a lot of the good work in the last few years on it has remained closed source within Google. If you want to do text extraction, look at things like Stroke Width Transform to extract regions of text before passing them to Tesseract.

Is it possible to extract text from pre-formatted documents? Let's say I have a document issued by the government, and I am only interested in the fields that have been filled. Could I process such a document fully automated using Tesseract? Maybe some image pre-processing would be needed?

"Maybe some image pre-processing would be needed?"

No, a whole lot of pre-processing would be needed. It all depends on the exact layout - if your tolerances are tight you need much more logic than if you have, let's say, 2cm white space around one sentence you're after.

Re: Ask HN: Open source OCR library?

#34

I've used tesseract to great affect. I don't know how your images are but if only part of the image has text in it, you should only send that part to the OCR engine. If you send the entire image and only a portion of it has text in it, chances of the OCR extracting text are slim. There are pre-processing techniques [1] you can use to crop out the part of the image that has text [1]: https://en.wikipedia.org/?title=Ho…

Could you explain how to use a Hough transform to find areas that have text? I only recently managed to wrap my head around how it works for line detection and other shapes with the generalized form, but how would one recognize text?

Re: Ask HN: Open source OCR library?

#36
post #31

Tesseract is ok, but I gather that a lot of the good work in the last few years on it has remained closed source within Google. If you want to do text extraction, look at things like Stroke Width Transform to extract regions of text before passing them to Tesseract.

Is it possible to extract text from pre-formatted documents? Let's say I have a document issued by the government, and I am only interested in the fields that have been filled. Could I process such a document fully automated using Tesseract? Maybe some image pre-processing would be needed?

If you'd be interested in using something like this as a paid API/service and have decent volume, feel free to contact me. I'm currently in pre-beta for API rollout of such a thing.

In summary, you need templates that map the field positions -> meaningful keys so that you can get back useful data as json/csv/xml. I have some tools that are still being polished that automate much of the template creation and do a lot of the pre-proc for you.

email is my username (at) gmail

Re: Ask HN: Open source OCR library?

#37
I was actually looking in to Tesseract yesterday, so this post coincides nicely.

I have a hobby project where I scrape instagram photos, and I actually only want to end up with photos with actual people in them. There are a lot of images being posted with motivational texts etc that I want to automatically filter out.

So far I've already built a binary that scans images and spits out the dominant color percentage, if 1 color is over a certain percentage (so black background white text for example), I can be pretty sure it's not something I want to keep.

I've also tried OpenCV with facial recognition but I had a lot of false positives with faces being recognized in text and random looking objects, and I've tried out 4 of the haarcascades, all with different, but not 'perfect' end results.

OCR was my next step to check out, maybe I can combine all the steps to get something nice. I was getting weird texts back from images with no text, so the pre-processing hints in this thread are gold and I can't wait to check those out.

This thread is giving me so much ideas and actual names of algorithms to check out, I love it. But I would really appreciate it if anyone else has more thoughts about how to filter out images that do not contain people :-)

Re: Ask HN: Open source OCR library?

#38
Not really. Everything out there is ancient and uses techniques from the 80s/90s.

It's pretty sad considering that OCR is basically a solved problem. We have neural nets that are capable of extracting entities in images and bigdata systems that can play jeopardy. But no one has used that tech for OCR and put it out there.

Re: Ask HN: Open source OCR library?

#39
post #28

I tried using Tesseract and could not get it to work reliably. I tried a bunch of different pre-processing techniques and it turned into a very frustrating experience. When I compared Tesseract to Abbyy, the difference was night and day. Abbyy straight out of the box got me 80%-90% accuracy of my text. Tesseract got around 75% at best with several layers deep of image pre-processing. I know you said open source, and…

Finereader engine Abbyy for Linux looks fine, but I can't find price data, is it <10k/year? One time license?

Re: Ask HN: Open source OCR library?

#40

I was actually looking in to Tesseract yesterday, so this post coincides nicely. I have a hobby project where I scrape instagram photos, and I actually only want to end up with photos with actual people in them. There are a lot of images being posted with motivational texts etc that I want to automatically filter out. So far I've already built a binary that scans images and spits out the dominant color percentage, if…

I've done basically the same thing as you for a project i did for a newspaper where i collected 9000 selfies (see http://vk.nl/selfies).

It's a lot of manual work, but using OpenCV saves you a lot of time. I can't share the code unfortunately, but what i did was this:

* Get all Instagram photos with the '#selfie' tag

* Run it all through the haarcascade_frontalface_alt2 OpenCV cascade, i used the 1.3 and 5 values for the detectMultiScale() method.

* Check that there's only one face in the image, and make sure it's larger than 20% of the width of the image.

Even after that i still needed to go manually through the images. I guess around 10% was still false positives.

Post reply on HN