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:
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.
$ svn checkout https://cosi.svn.sourceforge.net/svnroot/cosi/trunk cosi
$ cd cosi
$ make
$ make rpm
Then you can find the following packages, ready to be installed :
tesseract/rpm/tesseract-srv-*.rpm
gocr/rpm/gocr-srv-*.rpm
ocrad/rpm/ocrad-srv-*.rpm
utils/rpm/cosi-utils-*.rpm
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:
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.
$ cosi-viewer <shmid> | tesseract <shmid> - batch.nochop server
$ cosi-viewer <shmid> | gocr -f XML -F 10 -S <shmid>
$ cosi-viewer <shmid> | ocrad -x - --xml -S <shmid>