Pushing OCR Performance to New Levels with MVTec HALCON: Testing OCR Viability

Veröffentlicht am 14. Mai 2019 von TIS Marketing.

This post, Testing OCR Viability is the first in a series of 8 posts from Pushing OCR Performance to New Levels with MVTec HALCON.

Optical character recognition (OCR) is one of the standard tasks 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.

In this series, we would like to give a short overview of the different approaches possible when using optical character recognition in HDevelop. In this first post, we will begin by taking a look at the general settings of the OCR assistant.

Let's jump right in and use OCR to read the best-by dates from a butter wrapper (below, fig. 1). If you want to code along, you can find the original image in the download section at the bottom of this page.

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

Testing the OCR Viability for the Application

To quickly test the viability of OCR 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.

In the next post, we will look at the parameters found in the OCR assistant's Segmentation tab.

Please click here to download image.