Live data from Hacker News

Tesseract OCR

github.com

21–30 of 66 posts

Re: Tesseract OCR

#21
post #6

I finally figured out how to use the Tesseract CLI utility on macOS today (installed from Homebrew). It's really neat - you can use it to turn a PNG into a PDF with embedded text, which you can then copy-and-paste: https://til.simonwillison.net/tesseract/tesseract-cli I learned about it from this post: https://alexn.org/blog/2020/11/11/organize-index-screenshots...

Does it work well on photographs ? I’d love to run it on my photo library so I can search for shop names etc!

Re: Tesseract OCR

#22
post #6

I finally figured out how to use the Tesseract CLI utility on macOS today (installed from Homebrew). It's really neat - you can use it to turn a PNG into a PDF with embedded text, which you can then copy-and-paste: https://til.simonwillison.net/tesseract/tesseract-cli I learned about it from this post: https://alexn.org/blog/2020/11/11/organize-index-screenshots...

Does it work well on photographs ? I’d love to run it on my photo library so I can search for shop names etc!

I just tried it on a photo of a fish counter at a supermarket with some text labels on some of the fish and it did very well (printed text, in focus) - so yeah this may well be worth trying!

Re: Tesseract OCR

#23
post #17

I must’ve done things spectacularly wrong cuz the two times I’ve tried tesseract (second time to recognize factory printed 8 inch tall letters on a trash can), I got 0% accuracy. 0%. Not even close. So I gave up.

You typically need to pre-process the images.

I'd recommend https://scantailor.org/ for this (OSS, but unmaintained)

Re: Tesseract OCR

#24
post #6

I finally figured out how to use the Tesseract CLI utility on macOS today (installed from Homebrew). It's really neat - you can use it to turn a PNG into a PDF with embedded text, which you can then copy-and-paste: https://til.simonwillison.net/tesseract/tesseract-cli I learned about it from this post: https://alexn.org/blog/2020/11/11/organize-index-screenshots...

macports also had Tesseract CLI available with a lot of language packs.

Re: Tesseract OCR

#25
I've used tesseract directly and there definitely is some footguns when it comes to PDFs and being sure not to re-compress them and lose quality.

If you're looking to add a text layer to a PDF (for search purposes for instance) I can highly recommend OCRmyPDF: https://github.com/jbarlow83/OCRmyPDF/

It uses Tesseract and works quite well for most PDFs, I made a semi-functional script before I discovered it and it would have saved a lot of hassle.

Re: Tesseract OCR

#26
I have used Tesseract for OCRing Japanese vertical texts and while it does work fine most of the time (not good mind you, since it constantly mixes certain complex kanji, lack of advanced context awareness shows) after a bit of pre-processing (removing noise using threshold filtering, making characters darker, removing furigana), sometimes it simply breaks and produces a clear garbage. And page segmentation is not the only problem. I've wrote a custom algorithmic page segmentation (text from a page gets concatenated into a single "line") and Tesseract still breaks on certain inputs, removing several characters from the beginning of such text usually "fixes" this issue.

Re: Tesseract OCR

#27
post #17

I must’ve done things spectacularly wrong cuz the two times I’ve tried tesseract (second time to recognize factory printed 8 inch tall letters on a trash can), I got 0% accuracy. 0%. Not even close. So I gave up.

Most people are best served by the big vendor OCRs. In my experience Amazon’s works the best, followed closely by Microsoft and Google at a distant third.

Re: Tesseract OCR

#28
post #17

I must’ve done things spectacularly wrong cuz the two times I’ve tried tesseract (second time to recognize factory printed 8 inch tall letters on a trash can), I got 0% accuracy. 0%. Not even close. So I gave up.

I tried it a couple of years ago on some Japanese receipts and it couldn't handle the mix of Japanese and English words/characters. Perhaps it was the way I set things up but the result was that of failure.

It seems the project has made a trade-off about language support.

One approach would be to say language doesn't matter, just train on converting any character from any language alphabet from image to text. The problem is that higher accuracy can be achieved by isolating characters from each language from each other. I imagine that particularly for Latin alphabet languages, accuracy must improve dramatically by splitting out any kanji or hanzi.

Re: Tesseract OCR

#30
I used Tesseract almost 10 years ago to scan letters from a Words With Friends board. I was getting over 90% accuracy, but the letters with score values on them corrupted the letters and screwed up the detection. So I created a new "language" which Tesseract supports, that incorporated the score value corruption as part of the OCR translation. I got to over 98% accuracy with that which was about as good as I could get.

Overall I thought it was great and I wonder how good it would perform these days with 10 years of improvements!

Post reply on HN