Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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-processing-in-ocr-fc231c6... (2): https://github.com/chriswolfvision/local_adaptive_binarizati...



Ah, the nostalgia. More than 10 years ago I wrote a local adaptive binarization tool to improve Tesseract's results, and the upstream still hasn't picked up the idea.


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!


Many years ago there was specific OCR software (SpotlightPro / RasterDesk) for vectorize scanned technical drawings to CAD formats (with dimension lines, text labels, etc.); now there is Scan2CAD[0]. All them are proprietary software.

Sadly I can't find any open-source vectorizer & OCR for repair scanned technical drawings, and Tesseract has a lot of issues with rotated text labels specific to CAD.[1]

[0] https://alternativeto.net/software/scan2cad/

[1] https://groups.google.com/g/tesseract-ocr/c/t-2Ru9h4xSc


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


Leptonica appears to use Sauvola binarization instead of the improved Wolf version.


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.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: