HALCON uses a classification approach for optical character recognition which requires segmentation of individual characters from their background in an image and then reading each character using a pre-trained classifier. HALCON includes many pre-trained fonts for classification, but also enables users to train their own custom fonts. The OCR assistant in HALCON 11’s HDevelop IDE provides developers with a graphical user interface tool designed to automatically determine or optimize the appropriate parameters for character segmentation, test and optimize different classifiers for desired results, train custom fonts, and automatically generate HALCON code for OCR applications.
As seen in the image , the OCR assistant provides a quick setup tool for rapidly configuring an OCR solution. To use the tool, users simply load or acquire a sample image then highlight the image region containing the characters, define the characters that are in the region, and describe basic information about their appearance in the image. The setup tool then automatically determines parameter settings for segmenting and classifying the characters.
Since the quick setup tool only uses basic image information, further optimization may be needed for more challenging applications. The OCR assistant supports this by providing a graphical interface for manually selecting the best parameters for segmentation. Users can adjust settings like character appearance, size, shape features, orientation range, fragmentation, and layout (number of lines of text, expected number of characters, etc). Results of the parameter settings are displayed in real-time on the sample image.
Once the proper segmentation parameters have been selected, the OCR assistant allows users to choose an effective classifier from either a pre-trained HALCON classifier, a classifier previously trained by the user, or the ability to train a new classifier.
Training a new classifier is easy thanks to the powerful teaching tool in the OCR assistant. The teaching tool allows users to define the correct character for each of the segmented characters in the image. This can be done across several sample images to increase the amount of training data and improve the robustness of the classifier.
Additionally, the OCR assistant provides a training file browser window that enables users to view all the images used for training, edit their designated character definitions and add or remove training data. This is a very efficient way to ensure that no characters are trained incorrectly. The browser also allows users to create additional training data by automatically generating modified versions of the segmented character images. These modifications can include noise, rotation, slant, stroke width, radial deformation, and local deformation.
To further improve performance, the OCR assistant allows users to define or restrict the possible results based on features like known syntax or expressions, and a dictionary file of allowable words or strings.
Finally, once the desired performance is achieved, the OCR assistant can automatically generate and insert the corresponding HALCON code into the HDev program.
Additional information on using the OCR assistant can be found in section 7.5 of the HDevelop User’s Guide available on the MVTec website.