Configuring OCR engine
OpenKM can work with several OCR engines, like Tesseract.
Tesseract
Section titled “Tesseract”Tesseract is an open-source OCR engine adopted by Google. It works really well. OCR can natively read TIFF documents and has a high recognition rate with images of 300 dpi resolution that are converted to lineart (1-bit color).
The supported image formats are:
- TIFF
- PNG
- JPG
- GIF
Installation
Section titled “Installation”| OS | Description |
|---|---|
| Ubuntu and Debian | bash<br>$ apt install tesseract-ocr<br>The default installed language is English, so depending on your locale you may want to install another language file. For example, to install the Spanish language pack: bash<br>$ apt install tesseract-ocr-spa<br>You can check the installed languages this way: bash<br>$ tesseract --list-langs<br>More information at: - https://github.com/tesseract-ocr/tesseract - https://tesseract-ocr.github.io/tessdoc/Installation.html |
| Red Hat and CentOS | On CentOS, you can install Tesseract from the EPEL repository:bash<br>$ yum install epel-release<br>$ yum install tesseract<br>The default installed language is English, so depending on your locale you may want to install another language file. For example, to install the Spanish language pack: bash<br>$ yum install tesseract-langpack-spa<br>You can check the installed languages this way: bash<br>$ tesseract --list-langs<br>On Red Hat, we recommend contacting Red Hat support for more information. More information at: - https://tesseract-ocr.github.io/tessdoc/Installation.html |
| Windows | Download from https://tesseract-ocr.github.io/tessdoc/Installation.html and follow the installation wizard. |
Check installation
Section titled “Check installation”From the command line, execute (where image.jpg should be an existing image file):
$ tesseract image.jpg textConfiguration
Section titled “Configuration”Go to Administration > Configuration parameters and edit the parameter named system.ocr:
| OS | |
|---|---|
| Linux | /usr/bin/tesseract ${fileIn} ${fileOut} or /usr/bin/tesseract ${fileIn} ${fileOut} -l esp The parameter -l esp indicates that the Spanish language support must be used while executing OCR. To see all Tesseract options, execute: bash<br>$ tesseract<br> |
| Windows | c:\Tesseract-ocr-3.0.2\tesseract.exe ${fileIn} ${fileOut} or c:\Tesseract-ocr-3.0.2\tesseract.exe ${fileIn} ${fileOut} -l spa The parameter -l esp indicates that the Spanish language support must be used while executing OCR. To see all Tesseract options, execute: bash<br>c:\Tesseract-ocr-3.0.2> tesseract.exe<br> |
- The parameter ${fileIn} will be replaced internally by the image document to be processed.
- The parameter ${fileOut} will be replaced internally by a temporary text file.
- You can set other additional parameters like the -l spa parameter in the example.
Additional information
Section titled “Additional information”- http://code.google.com/p/tesseract-ocr/
- Tesseract - Summary & first experiences.
- Tesseract OCR Google Groups
- First Interactions with Tesseract OCR on Ubuntu Linux
- http://code.google.com/p/tesseract-ocr/wiki/ReadMe
- http://code.google.com/p/tesseract-ocr/wiki/FAQ
Dictionary
Section titled “Dictionary”You can also use an OpenOffice.org dictionary to enhance the OCR process. You can find these language-specific dictionaries at OpenOffice.org Dictionary Repository.
Configuration
Section titled “Configuration”Go to Administration > Configuration parameters and edit the parameter named system.openoffice.dictionary:
| OS | |
|---|---|
| Linux | /home/openkm/dictionary/en-GB.zip |
| Windows | c:\tomcat-8.5.69\dictionary\en-GB.zip |
OCR rotate configuration
Section titled “OCR rotate configuration”There’s a configuration parameter that forces OCR on rotated documents.
Configuration
Section titled “Configuration”Go to Administration > Configuration parameters and edit the parameter named system.ocr.rotate:
| Property | Description |
|---|---|
| system.ocr.rotate | The parameter is a collection of degrees separated by the character “;”. 90;180;270; |