Character Recognition
IMAQ Vision also provides some tools for the machine recognition of characters, similar to the digital instrument example; in the basic version of the IMAQ Vision toolkit, only the functions for bar code reading are implemented. The reading of text characters , or optical character recognition (OCR), can only be implemented by addition of the IMAQ Vision OCR toolkit.
Text Reading (OCR)
OCR is a method that converts images containing text areas into computer editable text files. The IMAQ Vision OCR toolkit can read text in capital and printed letters . An additional group of functions can be used to "unwrap" characters that are not located in a straight line, for example, the number on a compact disc (see Figure 5.63), before the OCR process begins.
Figure 5.63. Characters to "Unwrap" on a Compact Disc
Bar Code Reading
As mentioned before, bar code reading is included in the basic IMAQ Vision functions. An example including some bar code images is part of the IMAQ Vision Examples set and is easy to modify for our purposes.
In the examples section on the attached CD-ROM, I provide four special images in two different bar code languages:
- barcode0.png and barcode1.png are the codes from the back side of the IMAQ Vision manuals ([4] and [5]). These codes are a 3 of 9 type (or Code 39); Figure 5.64 shows an example.
- barcode2.png is an ISBN code from the book of E. R. Davies: Machine Vision [13] (Figure 5.65).
- barcode3.png is another ISBN code from the book Computed Tomography by W. A. Kalender [20].
Figure 5.64. Bar Code Reading Example (Code 39 Setting)
Figure 5.65. Bar Code Reading Example (EAN 13 Setting)
The function that performs the bar code reading is IMAQ Read Barcode . In general, the program works with the following bar code languages:
- UPC-A (Universal Product Code-A) is the most widely used code for product identification in the United States. The code has a fixed length of 12 characters, with the twelfth digit being a check value calculated from the other 11.
- MSI or MSI-Plessey is a code containing check digits. It uses special symbols for start and stop characters.
- Interleaved 2 of 5: This is a high-density code of variable length for the coding of an even number of digits. Odd-positioned data is encoded in the bars, even-positioned data in the spaces.
- EAN 13 (Europ ische Artikel-Nummerierung) is mainly used in Europe instead of UPC-A. It consists of 13 digits instead of 12 (see Figure 5.65).
- EAN 8: EAN code with 8 digits.
- Code 128 allows the coding of the entire 128 ASCII (American Standard Code of Information Interchange) character set. Code 128 is self-checking and contains features that improve scanner reading.
- Code 3 of 9 (Code 39) is a common code that can also encode alphanumeric characters. The start and the stop character is always an asterisk (*; not shown in the display). National Instruments uses this code for its manuals (see Figure 5.64).
- Code 9 of 3 (Code 93) provides higher density and higher security than does Code 39.
- Codabar is a self-checking language that can encode the digits 0-9 and 6 special characters.
To calculate the ISBN bar code of books, skip the last number of the ISBN; for example, the ISBN 0-12-206092-X is turned into the number 012206092. After that, add 978 to the beginning. These two steps lead to the 12-digit number 978012206092 (compare with Figure 5.65).
The procedure of the VI is very similar to that of the LCD example: just draw an ROI in the first image (as long and as narrow as possible) and the program is ready to convert bar codes according to the type setting control.
Image Focus Quality
|