1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

Main Page

From cosi

Jump to: navigation, search

COSI - The Common OCR Service Interface

COSI is an open standard targeted at using different OCR (Optical Character Recognition) programs as external agents in a unified manner. COSI allows to integrate an OCR tool into various top-level applications using a client-server approach.

COSI has been successfully implemented and experimented on the following well-known open source OCR applications:




Bringing COSI support to existing OCR agents

As of today, COSI support is available on Linux platforms only. Support for other operating systems will be available later.

You can build COSI-compliant versions of Tesseract-OCR and GOCR directly from the COSI source tree. It provides some Makefile's that automatically download the source code of OCR agents, apply COSI patches, compile everything, and optionnaly generate the corresponding RPM packages.

Downloading and Compiling

$ svn checkout https://cosi.svn.sourceforge.net/svnroot/cosi/trunk cosi
$ cd cosi
$ make

Generating the RPM packages

$ make rpm

Then you can find the following packages, ready to be installed :

  • Tesseract-OCR: tesseract/rpm/tesseract-srv-*.rpm
  • GOCR: gocr/rpm/gocr-srv-*.rpm
  • GNU Ocrad: ocrad/rpm/ocrad-srv-*.rpm
  • COSI-utils: utils/rpm/cosi-utils-*.rpm

The COSI utils


The COSI utils is a collection of simple utilities to test a COSI-compliant OCR agent under Linux (or any other POSIX OS). There are two binaries allowing to easily test an OCR agent:

  • cosi-png creates a shared memory frame buffer from a PNG image file.
  • cosi-viewer allows to easily generate COSI requests, that can be piped to the OCR agent standard input. This utility requires the GTK+ graphical environment.

Testing the OCR agents

From the COSI-utils directory, export a test image file to a shared memory frame buffer, and note the shmid resulting from this operation. In the example below, we assume <shmid> is 3833877.

$ cosi-png eurotext.png
COSI RGB buffer: 1024x800, shmid=3833877

While keeping the cosi-cmd utility running, launch the cosi-viewer utility and pipe it to the OCR agent.

Using Tesseract-OCR

$ cosi-viewer <shmid> | tesseract <shmid> - batch.nochop server

Using GOCR

$ cosi-viewer <shmid> | gocr -f XML -F 10 -S <shmid>

Using GNU Ocrad

$ cosi-viewer <shmid> | ocrad -x - --xml -S <shmid>
Personal tools