15

I have always found OCR technology to be behind on open source systems. I've also watched the Ocropus project since its infancy. I've tried what I've heard is the best OCR engine available for Linux, Tesseract, and have found it woefully lacking for business documents. Are there any other more promising OCR implementations? What about the even more hopeful goal for interpreting handwriting? What is possible on *nix systems in this field?

2
  • 1
    Should this be migrated to softwarerecs?
    – Jeff Schaller
    Commented Jul 10, 2017 at 10:24
  • @Jeff probably not, given it's almost seven years old. A lot has happened since then. Some of it in OCR... ;-) Commented Jul 10, 2017 at 15:38

5 Answers 5

9

Tesseract

As of 2020, the best available open source OCR software is Tesseract 4 with its new LSTM neural network OCR model. Its OCR performance is much better than the previous OCR model used in version 3.

Example (produce a PDF file output.pdf with a text layer for a scanned german document):

$ echo page-*.png > input.list
$ tesseract --oem 1 -l deu input.list output pdf

(--oem 1 enables the LSTM engine)

Print the recognized text to stdout:

$ tesseract --oem 1 -l deu page page-0001.png stdout

List installed languages:

$ tesseract --list-langs

Support for quite many languages/scripts is available in the form a downloadable trained data sets, e.g. there is even a data set for Fraktur.

With the new LSTM model, Tesseract takes some inspiration from the OCRopus research project.

The Tesseract version 3 performs relatively bad even on good quality input images, i.e. often it falsely detects single characters in dust pixels (outside of any textual context) and easily introduces single character errors in well-known words.

Cuneiform

Cuneiform OCR performance isn't that bad, but it isn't actively maintained (last release in 2011, version 1.1) and easily crashes and has some other issues:

You can disable the layout algorithm like this:

$ cuneiform --singlecolumn -l ger -f text -o foo.txt image-0001

(-l specifies the language of the source document)

ocrad

Ocrad example call:

$ ocrad -F utf8 image-0001

Text is printed by default to stdout.

In a business document, it missed an underlined word, where cuneiform/tesseract/gocr didn't.

The Ocrad manual contains a section on the used algorithms, e.g.:

5) Detect characters and group them in lines.
6) Recognize characters (very ad hoc; one algorithm per character).
7) Correct some ambiguities (transform l.OOO into 1.000, etc).

GOCR

GOCR example call:

$ gocr image-0001

Text is printed by default to stdout.

The GOCR documentation doesn't include much details on which models/methods are used for OCR.

Hardware

Sane has very good support for some automated document feed (ADF) scanners, e.g. for the Avision and Fujitsu ones.

Included with Sane is the scanimage command line program which you can use to build scripted scan pipelines (cf. e.g. my adf2pdf.py script).

1
  • I tried Cuneiform. It works well if you need to recognize scanned image (not photos). I used Yagf as a GUI. Commented Oct 13, 2012 at 9:58
3

I found a similar question over on StackOverflow and the Asprise OCR SDK, one of the linked commercial products, boasts a Linux version.

2
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
    – Thomas
    Commented Jul 10, 2017 at 9:40
  • 1
    @Thomas the link is the only possible answer since the link points to a specific tool as requested by the OP. Not all link-only answers are bad. This gives the name of a specific piece of software and a link to its webpage. Even if the link breaks, you should still be able to find it from the name.
    – terdon
    Commented Jul 10, 2017 at 11:50
1

... OCR is more than "only character recognition". Image handling, preprocessing - page/layout analysis to find the texts, images, tables or barcodes. For the recognition, you have to deal with different fonts, sizes and languages. This is important because to get good results you have to use dictionaries and language definitions. Finally people expect more export options than text (e.g., XML, RTF, or searchable PDF). There are some commercial options for SDKs, but they are not cheap and for free.

Recently I found a CLI OCR for Linux from ABBYY. There is a free 100 page trial.

1

There are few popular OCR command-line tools:

  • Tesseract (ReadMe, FAQ) (Python)

    Also available for: Tesseract .NET, Tesseract iOS

    An OCR Engine that was developed at HP Labs between 1985 and 1995... and now at Google. Tesseract is probably the most accurate open source OCR engine available.

    Usage:

      tesseract [inputFile] [outputFile] [-l optionalLanguageFile] [PathTohOCRConfigFile]
    

    Example: Make existing PDF searchable ( OCR ) via command line / script

  • GOCR

    Open-source character recognition. It converts scanned images of text back to text files. GOCR can be used with different front-ends, which makes it very easy to port to different OSes and architectures. It can open many different image formats, and its quality have been improving in a daily basis.

  • OCRopus™ (FAQ) (written in Python, NumPy, and SciPy)

    OCR system focusing on the use of large scale machine learning for addressing problems in document analysis, featuring pluggable layout analysis, pluggable character recognition, statistical natural language modeling, and multi-lingual capabilities.

    The OCRopus engine is based on two research projects: a high-performance handwriting recognizer developed in the mid-90's and deployed by the US Census bureau, and novel high-performance layout analysis methods.

    OCRopus is development is sponsored by Google and is initially intended for high-throughput, high-volume document conversion efforts. We expect that it will also be an excellent OCR system for many other applications.

  • Tessnet2 (Open source, OCR, Tesseract, .NET, DOTNET, C#, VB.NET, C++/CLI)

    Tesseract is a C++ open source OCR engine. Tessnet2 is .NET assembly that expose very simple methods to do OCR. Tessnet2 is under Apache 2 license (like tesseract), meaning you can use it like you want, included in commercial products.

Other already suggested: ABBYY CLI OCR for Linux, Asprise OCR.

Read also:

For more complete list, check: List of optical character recognition software at Wikipedia.

0

If you have a budget, I strongly recommend ABBYY FineReader Engine CLI for Linux. Our company has been using it in our web-application for a year and we plan to renew the license. Very good recognition quality, command-line interface, recognition in many languages.

1

Not the answer you're looking for? Browse other questions tagged .