Live data from Hacker News

Ask HN: Open source OCR library?

news.ycombinator.com

11–20 of 104 posts

Re: Ask HN: Open source OCR library?

#12
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.

Re: Ask HN: Open source OCR library?

#13

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.

yep:

https://github.com/tleyden/open-ocr/wiki/Stroke-Width-Transf...

https://github.com/tleyden/DetectText

http://libccv.org/doc/doc-swt/

https://github.com/tleyden/open-ocr/wiki/Stroke-Width-Transf...

Re: Ask HN: Open source OCR library?

#14
post #2

https://code.google.com/p/tesseract-ocr/ is pretty good

Tesseract does no layout analysis. So if the source image contains text columns or pull quotes or similar, the output text will just be each row of text, from the far left to the far right.

Could you add another layer on top (eg. image processing) to detect boundaries of blocks of content, and send each block to Tesseract in sequence?

Re: Ask HN: Open source OCR library?

#17
As others pointed out, Tesseract with OpenCV (for identifying and cropping the text region) is quite effective. On top of that, Tesseract is fully trainable with custom fonts.

In our use case, we've mostly had to deal with handwritten text and that's where none of them really did well. Your next best bet would be to use HoG(Histogram of oriented gradients) along with SVMs. OpenCV has really good implementations of both.

Even then, we've had to write extra heuristics to disambiguate between 2 and z and s and 5 etc. That was too much work and a lot of if-else. We're currently putting in our efforts on CNNs(Convolutional Neural Networks). As a start, you can look at Torch or Caffe.

Re: Ask HN: Open source OCR library?

#18

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…

and an implementation with source & binaries [1]. also check out unpaper [2]

[1] http://galfar.vevb.net/wp/2011/deskewing-scanned-documents/

[2] https://github.com/Flameeyes/unpaper

Re: Ask HN: Open source OCR library?

#20
It depends on what you're trying to do. For myself, I wanted to OCR scanned documents and I've been moderately successful using ScanTailor to process the images and then Tesseract to OCR the result. Certainly, it's far from perfect and the documentation on Tesseract and its options is spotty, but I've been moderately happy. As a note, I've had better luck with the current trunk in the git repo of Tesseract than the point releases. Some of the older versions of Tesseract modified the images when processing to a PDF and this was unacceptable to me.
Post reply on HN