Pushing OCR Performance with MVTec HALCON: Testing OCR Viability

Published on October 16, 2019 by TIS Marketing.

This post, Testing OCR Viability is the first in a series of 7 posts from Pushing OCR Performance with MVTec HALCON: 1, 2, 3, 4, 5, 6, 7.

Optical character recognition (OCR) is a standard task in machine vision and image processing. Many different applications (e.g. automatic object recognition, quality control, packaging) rely on the power of OCR to read characters or symbols during processing. HALCON uses a classification-based system for OCR which requires the segmentation of characters from their background. After segmentation, the characters are read using a pre-trained classifier. HALCON's integrated development environment, HDevelop, offers wide-ranging OCR functionality from the easy-to-use assistant to the training of custom classifiers for specific fonts.

This series offers a short overview of possible approaches when using optical character recognition in HDevelop, beginning with a look at the general settings of the OCR assistant.

A common scenario would be to to use OCR to read the best-by dates on butter packaging (below, fig. 1). (The original image can be downloaded at the bottom of this page).

Fig. 1: Butter packaging: Image of dot-matrix characters in best-by date.

Testing OCR Viability for the Application

To quickly test OCR viability for the application at hand, HDevelop's OCR assistant provides a good starting point. First, load a sample image. Then, draw a bounding box to create a region of interest and define the expected text to be read in this region by entering it into the third field (see Fig. 3). After clicking on Apply Quick Setup, the assistant automatically tries to determine suitable parameters for segmentation and classification of the characters; the resulting regions and classes will be directly displayed in the image. If the assistant fails to find suitable parameters using Quick Setup, there are ways to fine-tune the parameters so that functional segmentation and classification can be achieved. Quick Setup tries to find good starting parameters and will not perform a long optimization process for finding them. Fig. 2 (below, right) shows the region of interest on the packaging and Fig. 3 the corresponding setup in the OCR assistant. Fig. 4 shows the results of the quick setup: segmentation and classification of characters with estimated parameters.

Fig. 2 (top, right): Region of interest for OCR on butter packaging. Fig. 3 (left): OCR assistant Quick Setup for butter wrapper. Fig. 4 (bottom, right): Results of Quick Setup.

The next post looks at the parameters found in the OCR assistant's Segmentation tab.

Please click here to download image.