OCR templates

From OpenKM Documentation
Jump to: navigation, search

Nota clasica.png Since OpenKM 6.4.2 the plug-in system of OpenKM allows you to expand quickly the functionality offered by the platform, extending the available OCR field parsers without having to rebuild the system to add/change the existing functionality. Refer to Extend OCR field parsers if you need to extend OCR field parsers feature on 6.4.2.

OCR Templates allows to create zonal OCR templates which allows to recognise and extract estructured text from scanned images.

Nota clasica.png Images should be scanned at least at 200 dpi of resolution to get good text recognition from OCR engine.

Template creation

Open OCR template administration option.

Okm user guide 378.png

Then click on the Add.png new ocr template icon

Okm user guide 379.png

Fill the form and click create button.

Okm user guide 380.png

Add field zones

Field Description
Name Template field name
Type The field type ( String, Date, etc. )
Property The property group parameter name ( example okp:property.name )
Pattern Java regular expression pattern ( take a look at http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html )
Custom Commands to process images before OCR. It can contain several commands, one per line ( example: /usr/bin/convert ${fileIn} -matte ( +clone -fuzz 50% -transparent red ) -compose DstOut -composite -negate ${fileOut} )
OCR OCR command line ( example: /usr/bin/tesseract ${fileIn} ${fileOut} digits )
Use to recognise Indicate if a field is also used to identify the document or only for extraction purpose.
Zone Here, the cropped image is shown.

Then click on the Params.png fields icon

Okm user guide 381.png

Okm user guide 382.png

Fill the form and select the zone and click create button.

Okm user guide 383.png

Test OCR template

Click on the Check.png check icon and will be shown all the data fields extracted by zone.

Okm user guide 384.png

Recognise testing

From main OCR template list, click Recognize.png recognise icon.

Fill the form selecting some scanned image to test recognision.

Okm user guide 385.png

Click recognise button.

Okm user guide 386.png

Enable Zonal OCR data capture

OCR data capture can be enabled from profiles and automation.


To enable zonal OCR data capture from profiles should be enabled the check OCR data capture.

Okm user guide 387.png


Automation is divided in two operations, validations and actions.

There's a validation called IsOCRDataCaptureFile which validates if OCR data capture engine supports the image format.

Okm user guide 388.png

There're two actions OCRDataCapture and AddOCRDataCaptureToWizard. OCRDataCapture capture data and store to metadata. AddOCRDataCaptureToWizard enables end user wizard to see live ocr data capture process.

Okm user guide 389.png

For more information take a look at Automation.