tesseract.js icon indicating copy to clipboard operation
tesseract.js copied to clipboard

Add rotation preprocessing option

Open Balearica opened this issue 1 year ago • 1 comments

Tesseract performs extremely poorly when text is at an angle. For example, below is a scan with ~5 degrees of rotation. The first image shows the text Tesseract recognized without applying preprocessing while the second image shows what Tesseract recognized after rotating.

The maintainers of the main Tesseract repo frequently suggest adding image preprocessing steps (including auto-rotation) to workflows to address this, however this option is not ideal for web users. Given we already include the Leptonica image processing library, we should be able to expose a rotation option without much effort. Auto-rotation would be ideal, but is likely significantly more difficult to implement.

Possibly related to #588, which requests high-level functions that expose processed (binarized) images.

Balearica avatar Aug 23 '22 02:08 Balearica

This feature has been added in the development branch for version 4 and will be included in that release. That branch is functional at present if you would like to try it out, and is described in more detail in https://github.com/naptha/tesseract.js/issues/662. An example has also been included to demonstrate usage.

Balearica avatar Sep 17 '22 21:09 Balearica