Live data from Hacker News

Tesseract OCR

github.com

51–60 of 66 posts

Re: Tesseract OCR

#51

If you are trying to detect text from document images / photos: tesseract is strongly focused mainly on the OCR part of the whole preprocessing(1). If you would like to get better results on that, you could use the wolf binarization tool (2) as an easy adaptive thresholding to remove shadows and uneven areas, which should improve your OCR results a lot on document photos! (1): https://towardsdatascience.com/pre-proce…

I know that tesseract uses leptonica which does have capabilities of binarization and thresholding. Interesting that it's not enough.

Image processing strongly depends on what image you wanna use. To find an "auto" approach, that works for every image is nearly impossible...

I once wrote a bookscanner app in Java (https://boofcv.org), where everything was done automatically (preprocessing, object detection / book extraction, skin detection / finger removal, deskewing, line-slope-correction and so on). It was very difficult to adjust the parameters, that at least most of the books looked good.

Re: Tesseract OCR

#52
I use this from a small script to OCR the text from screenshots and add it to the metadata, so that I can search for them in Finder.

I believe Apple are adding this feature to the OS soon.

Re: Tesseract OCR

#53
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!

For Android there is a old project from Mozilla that just works like a firecracker on whatever size screenshot directory you have :

Firefox ScreenshotGo[beta] https://mzl.la/2NMgD30

Re: Tesseract OCR

#54
Is there a good OCR is good for some weird data (not natural language), such as a screenshot of a base64 encoded file. There was a CTF challenge requiring you to recover full RSA private key from a partially redacted screenshot of a RSA private (pem). I tried serveral OCR tools to try to extract the remaining base64 characters. I did tried to use Tesseract too, but the result is quite bad. I used GCP's OCR service eventually, the result is almost perfect for this task, but I wonder is there some non cloud-based tools are good for this task?

Re: Tesseract OCR

#55

If you are trying to detect text from document images / photos: tesseract is strongly focused mainly on the OCR part of the whole preprocessing(1). If you would like to get better results on that, you could use the wolf binarization tool (2) as an easy adaptive thresholding to remove shadows and uneven areas, which should improve your OCR results a lot on document photos! (1): https://towardsdatascience.com/pre-proce…

It is mentioned in the README that there is a Gimp plugin for Christian Wolf's binarization. This could be handy at times.

Otherwise, the C++ code on Github requires converting images to PGM format.

---

The page is in French, so I will mention that the Python script is here: https://www.vvpix.com/gmp_Telecharger_script.php?sFichier_a_...

To install it, copy the file to: `C:\Program Files\GIMP 2\lib\gimp\2.0\plug-ins`

Then call the script via the `Python-fu > Color > Binarize` tab in Gimp.

The algorithm is quite slow for large images. Aim for 1440p at most.

That being said, the results on my quick experiments look great, so it saves my time compared to other more manual methods in the end!

Re: Tesseract OCR

#56
post #28

Earlier quoted context omitted.

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 splitt…

Even directly for Latin alphabet languages you would typically want to know the language, both to reduce the charset (i.e. the distinctions between smudgy ã or â or ā or ä or á often are trivial if you know the language but may be quite hard to tell otherwise) and to use a proper language model for disambiguating individual character guesses.

Re: Tesseract OCR

#57
I used Tesseract for some projects a few years ago (version 2.x). It was already state-of-the-art in the specific task it is designed for, more or less on par with the best proprietary solutions. As others pointed out, Tesseract is only a specific part in a general OCR solution.

I'm wondering how actively it is being developed. I see that the last release is from 2019. I also see, however, that there have been some version 5.x alpha releases published this year. Does anyone know what is happening inside the project?

Re: Tesseract OCR

#58
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!

Tesseract is not really good for text on pictures (non-white background). You can use the free Space OCR API at https://ocr.space instead.

Or, just upload your photographs to Google Photos. Google OCRs all images automatically(!) and you can search them for text in the images. This includes text e. g. on posters in the background.

Re: Tesseract OCR

#59

I tried to use this library to process nutrition labels for a fitness app. Sometimes took 40 seconds to process, which is unacceptable for a phone app. I remember seeing a video where a google product used a neural net and resolved the same info in 1 sec or so.

I used the wasm implementation ( https://tesseract.projectnaptha.com/ ) and scanned 1 cereal box label.

Re: Tesseract OCR

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

If you're just looking to copy/paste text from images, there are a couple of small utilities for this using the built-in Vision framework.

OwlOCR is the one I use, with shortcuts set up next to the cmd-shift-3/4/5 screenshot keys.

TextSniper is another one, and I think there was a third that I can't remember the name of.

Post reply on HN