Apparatus and method for optical recognition of bar-coded characters

Abstract: The invention provides for optical character recognition apparatus (11) comprising scanning means (15) for optically scanning a bar-coded character (20) recorded on a document (19) and having a predetermined pattern of bars (43) and intervals of different opacities from said document (19), and producing a plurality of gray-scale pixel values corresponding to said pattern memory means (27) arranged to store said gray-scale pixel values, a program, and a plurality of predetermined binary codes, one of said codes representing said character, and having processing means (23) coupled to said scanning means (15) and to said memory means (27), and operating under control of said program, for selecting from said gray-scale pixel values a first set of values representative of a segment of said character extending across said character transversely to the bars of said character, for producing a binary code corresponding to said first set of values, and for identifying said character by matching said produced binary code to one of said predetermined binary codes. Also, the invention provides for a method of optical character recognition carried out by apparatus according to the above description

Description: The present invention relates to an apparatus and method for optical recognition of alphanumeric symbols generally, and in particular but not exclusively, to optical scanning and recognition of CMC7 bar-coded characters. The CMC7 character set, which was developed by the French Company Compagnie des Machines Bull, is widely used in financial transaction documents in many countries, primarily in Europe. Generally, the characters are recorded on documents such as bank drafts and cheques in MICR (magnetic ink character record) form for scanning by a magnetic scanner. A vidicon camera is often used to scan the document and to record an image of it for archival and evidentiary purposes while, in a separate operation, a magnetic scanner is used to read the magnetic-ink characters. This need for two separate scanners to perform two separate operations presents a costly, time-consuming problem. Another frequent problem, generally associated with optical character recognition, is character adulteration. Character adulteration occurs when the characters, e.g., those printed along the bottom of a document such as a check, are partly obscured (stamped-over or written-over) by stamped information, payer's signature, or a teller's comment. Known apparatus and methods involve the segmentation of a character by way of the segmentation of a binary pattern representative of the character and the subsequent processing of the segmented binary pattern, including comparing the segments with predetermined stored patterns. However, such known systems are disadvantageous in that separate image recordal and scanning are required but also that correct operation is severely impaired by character adulteration. EP-A-0,353,842 discloses a bar code reading arrangement in which a bar code pattern is scanned in the direction substantially perpendicular to the direction of the bars and which the data obtained is stored in the form of a bit map wherein adjacent rows of the bit map are processed for comparison with predetermined values in an attempt to compensate for potential mispositioning ofthe bar code pattern. EP-A-0,350,933 discloses an arrangement for scanning a bar code image which includes a processing arrangement for determining the location and orientation of the bar code in an attempt to obtain the correct scanning thereof in a direction substantially perpendicular to the direction of the bars of the pattern. The present invention therefore seeks to provide for an apparatus and method for the recognition of bar-coded characters which not only provide for image scanning and character recognition, thereby eliminating the requirement for two systems and two operations, but can also read partly-obscured characters correctly. In accordance with one aspect of the present invention there is provided optical character recognition apparatus comprising scanning means for optically scanning a bar-coded character recorded on a document and having a predetermined pattern of bars and intervals of different opacities on said document, and producing a plurality of gray-scale pixel values corresponding to said pattern, memory means arranged to store said gray-scale pixel values along with a program and a plurality of predetermined binary codes, one of said codes representing said character, and comprising processing means coupled to said scanning means and to said memory means, and operating under control of said program, for selecting from said gray-scale pixel values a first set of values representative of a segment of said character extending across said character transversely to the bars of said character, for producing a binary code corresponding to said gray-scale pixel values, and for identifying said character by matching said produced binary code to one of said predetermined binary codes, characterized in that the processing means is further arranged for selecting said gray-scale pixel values second sets of values representative of segments of the character extending in the direction of the bars of the character and counting those gray-scale values in the second sets that correspond to the bars so as to identify left and right edges of the character, and for determining the distance between the said left and right edges of the character as represented by the gray-scale values and comparing the distance with a known character width. In accordance with another aspect of the present invention there is provided a method of optically identifying a bar coded character recorded on a document and having a predetermined pattern of bars and intervals of different opacities on said document, and producing a plurality of gray-scale values corresponding to said pattern comprising the steps of storing said gray-scale of pixel values along with a program and a plurality of predetermined binary codes wherein one of said codes represents a character, scanning the bar-coded character so as to produce a plurality of gray-scale pixel values corresponding to said pattern, processing the stored gray-scale pixel values under the control of said program so as to select from said gray-scale pixel values a first set of values representative of a segment of said character extending across said character transversely to the bars of said character, producing a binary code corresponding to said second set of values and identifying said character by matching said produced binary code to one of said predetermined binary codes characterized by the steps of selecting from said gray-scale pixel values second sets of values representative of segments of the character extending in the direction of the bars of the character and counting those gray-scale values in the second sets that correspond to the bars so as to identify left and right edges of the character, and for determining the distance between the said left and right edges of the character as represented by the gray-scale values and comparing the distance with a known character width. The invention is advantageous in that the selection and subsequent use of data representing a segment of a character enables a correct reading of the character even if partly obscured, while also providing for both document image scanning and character recognition. The invention is described further hereinafter, by way of example only, with reference to the accompanying drawings in which: Fig. 1 is a block diagram of a system embodying the present invention; Fig. 2 shows the appearance of a bar-coded character readable by the system of Fig. 1; Fig. 3 shows a portion of a document with bar-coded characters recorded thereon; Fig. 4 shows a character having a matrix of pixels of different opacities (gray-scale values), the matrix showing a window or segment of the character; Figs. 5A-5D are flow charts showing the operations performed by the system of Fig. 1 in determining the boundary of a character; Fig. 5E shows a coordinate system used by the system of Fig. 1 in determining the boundary of a character; Fig. 6A shows selected segments of a character, across the bars and intervals of the character, along the marker lines (horizontal windows) at positions (Y) and (Y+1); Fig. 6B shows a waveform having maximum pixel values (peaks) and minimum pixel values (nulls) corresponding to the character segment at coordinate position (Y) of Fig. 6A, the peaks and nulls being expressible relative to a threshold value. Fig. 6C shows a waveform having peaks and nulls expressed relative to a threshold value, the waveform corresponding to the character segment at coordinate position (Y+1) of Fig. 6A; and Fig. 7 shows a null expressed relative to a threshold for determining the width of a long interval of a character. Fig 1 shows a system (apparatus) 11 of an embodiment of the present invention. The system includes an optical camera or scanner 13 for scanning a document 19, and a computer system 21 for processing data received from the scanner 13. The scanner may be a camera with a CCD (charge coupled device) 15 and controller 17. The document 19 may be a bank draft or check with numeric or other bar-coded character 20 recorded thereon. The computer system 21 comprises a microprocessor 23, a ROM (read only memory) 25 with a boot program, a RAM (random access memory with a stored program) 27 for storing data from the scanner and microprocessor, and for storing predefined coded character data. The scanning operation is commenced at the bottom right corner 33 of the document and ends at the top left corner 35. The scanner 13 scans the document 19 vertically, from bottom-to-top, as shown by arrow 37, first along right-most virtual scan line 39, then again from bottom-to-top along next-right-most virtual scan line 41, and so on until the top left corner of the document is reached. The scan lines are arranged in parallel. The document 19 is moved continuously from left to right, as shown by arrow 43, while the scanner scans along successive scan lines, the width of each scan line corresponding to the diameter (e.g., 0.0127 cm) of a pixel. In scanning a document, the system treats each individual character recorded on the document as if the character were bounded in an area 21 pixels wide by 24 pixels high as shown in Fig. 2. Actually, the height of a character may vary from 18 to 30 pixels, and the width of the character may vary from 17 to 23 pixels. The image recorded on the document may be non-magnetic or magnetic, and may comprise various characters (objects), such as the CMC7 MICR characters shown in Fig. 3. As shown in Fig. 2, each character 20 is uniquely defined by seven parallel vertical bars (data bars) 45, four short intervals 47, and two long intervals 49 between the bars. The scanning direction 37 (Fig. 1) coincides with the direction of the parallel bars. Each bar may be from .010 to .019 cm. wide, each short interval may be from .011 to .019 cm. wide, and each long interval may be from .031 to .039 cm. wide. The scanning, and processing (segmentation and recognition) of the characters are described in terms of the vertical bars and intervals which make up each character. Although the heights of the individual bars may vary, the widths of the bars and intervals are kept (printed) within a predetermined range. The widths of the bars and intervals for one character are the same as the widths of the bars and intervals for other characters of the same set. To facilitate understanding of the operation of the system, each vertical bar, and each short interval between adjacent bars, will be described as having a width equivalent to the diameter of a pixel, and each long interval is described as having a width equivalent to the diameter of two pixels. Thus, a character may be viewed as being 21 pixels wide, having seven pixels representing the width of the seven vertical bars, four pixels representing the width of the two long intervals, four pixels representing the width of the four short intervals, and six pixels representing the space between adjacent characters (three pixels representing the width of the space on one side of the character, and three pixels representing the width of the space on the other side of the character). When a character is scanned, the pixel values generated by the scanner to represent the various bars and intervals of the character are stored in memory 27 (Fig. 1) as a data array (matrix) having, for example, 24 rows corresponding to the character's height, and 21 columns corresponding to the character's width. As shown in Fig. 2, for example, excluding the pixels which represent the spaces between successive characters and the spaces above and below the characters (i.e., spaces representing the background of the document), the bars and intervals of the character "nine" may be represented in array form as depicted in Fig. 4. Each dark pixel 51 represents a portion of a vertical bar 45 (Figs. 2 and 4), and has an opacity index or gray-scale value in the range 0-255. Each light pixel 53 represents a portion of an interval 47, 49, or a portion of an inter-character space 55, and has an opacity/gray- scale value of 0-255. The dark pixels generally have a greater gray-scale value (approaching 255), and the light pixels generally have a lesser gray-scale value (approaching 0). As indicated above, these gray-scale data values are generated by the scanner, upon scanning a document. The generated data are then stored in memory 27 (Fig. 1) for processing by the system. The system, under control of the stored program, examines the stored data values, and proceeds to define the various character fields (character groups) and the boundary of each character within a field. Starting with the stored gray-scale data values obtained from scanning, from bottom-to-top, along the right-most scan line 39 (Figs. 1 and 2), and then from bottom-to-top along the next-right-most scan line, and so on, the system segments the characters as shown and described in Figs. 5A-D. It does this by searching the stored data first for a gray-scale value representing a dark pixel. A dark pixel is a pixel whose gray-scale value is greater than the gray-scale value of its right neighbor (right-adjacent pixel) by more than a predetermined value (e.g., 16). When a dark pixel value is found (representing a detected dark spot on the document), the system then checks to determine if a data bar pattern exists nearby to the left of the detected dark spot. It does this by examining the gray-scale values corresponding to the pixels that are horizontally adjacent and to the left of the detected dark spot. Refer, for example, to window 57 (Fig. 4). The window is 25 pixels wide, and one pixel high. If, upon moving from right to left within the window, at least four stored peak data values and two null data values are found, representing at least four dark pixels and two light pixels, a data bar pattern is deemed to be present near the detected dark spot. (A peak value of a pixel is any gray-scale value for that pixel which is greater than the values of the neighbouring (left-adjacent and right-adjacent) pixels. A null value of a pixel is any gray-scale value for that pixel which is less than the values of the neighboring pixels.) Upon detecting a data bar, the system, under program control, then proceeds to determine the boundaries (bottom, right, and left edges) of the character comprising the detected bar. If no bar is detected proximate to the dark spot, the spot is treated as noise and disregarded, and the remaining stored pixel data (representing the rest of the vertical scan line) are examined until a dark spot is detected, or until the end of the scan line is reached. If no bar is detected at the end of a vertical scan (i.e., after examination of the stored data corresponding to a complete vertical scan), the system effectively shifts left by one pixel and proceeds to examine the next group of stored data representing the next scan line for a dark spot. As indicated above, when a dark spot and bar are found, the system stores the X-Y coordinate position of the bar as an approximate start-of-field position 30 (Fig. 3), for use when searching subsequently for the character. A typical field 40 is shown in Fig. 3. The system then attempts to define the boundary of a character in the field (i.e., the character of which the discovered dark spot and bar are parts) by locating the lower-right corner of the character. Refer, for example, to corner position (starting X-Y position) 44 shown in Fig. 2. Referring now to Figs. 5A and 5E, the system, starting from the (X,Y) position, first determines the location of the right edge of the detected character. It does this, as shown in Fig. 5B, by computing the total pixel value/count (i.e., a pixel count representing the sum of the gray-scale pixel values) at column locations (X,Y) and (X+2, Y) over the character's height (e.g., from (X,Y) to (X,Y+n) where, in our example of a 24-row character, the maximum value for n is 23). If the pixel count (total pixel value) at position X is not less than the pixel count at nearby position X+2 (signifying that the pixel counts are somewhat similar and there is no transition from a light interval region to a dark bar region), position X is updated by one pixel to the left, to address the next, horizontally adjacent, vertical region. The above process is then repeated. If the pixel count at position X is less than the pixel count at position X+2, indicating that the vertical region at position X is significantly lighter than the vertical region at position X+2, this transition from light to dark signifies that a bar, (and, hence, a start of a character) may be present at X+2. The system then scans the stored data virtually vertically upward checking each horizontal segment (window) for the presence of a bar. If more than two segments contains bar-pattern information, this verifies that a character has been located. The system then proceeds to look for the left edge. As shown in Fig. 5B, after detecting the right edge of the character and determining its coordinate (Xr), the system checks for the left edge. It does this, as shown in Fig. 5C, by selecting a position near to the left edge (e.g., the position (Xr+14), and examining the horizontally adjacent positions (e.g., positions (Xr+15) and (Xr+13)). With the (Xr+14) position addressed (labeled) as the X address, the (Xr+15) and (Xr+13) positions may be addressed (labeled) as the (X+1) and (X-1) addresses, respectively. The system then compares the pixel count at address X with the neighboring pixel counts at addresses (X-1) and (X+1). If the count at X is greater than the counts at (X-1) and (X+1), then X is regarded as a peak address. This peak address is then checked to determine the extent to which it differs from the previous peak address. If this difference is significant (e.g., the difference is greater than four, specified for CMC7 characters), this would indicate that an edge (a left edge) has been detected at previous peak address. If the difference is not greater than four, the pixel count at the next left-adjacent position is examined. If the width of the character has been traversed and no difference greater than four is found, the X address of the left edge is set to the X address of the right edge detection plus the character width. As shown in Fig. 5A, after the coordinates of the right and left edges are determined, as indicated above, the difference in pixel count (horizontally measured) between the right and left edges is compared with the known (predetermined) character width. If the difference is less than a predetermined width (e.g., ten pixels), indicating that the right and left edges are too close, the character is regarded as noise and discarded. If the difference is greater than the predetermined character width, the coordinate of the right edge is adjusted by subtracting the character width from the left-edge coordinate. After the left and right edges of the character are determined as explained above, the bottom of the character is determined, as explained below. As shown in Fig. 5D, to determine the bottom of the character, the marker window 57 (Fig. 4) is moved down one pixel, and the neighboring pixel values are checked, as described above, to determine if a data bar pattern exists. If a data bar pattern is found, the marker window is moved down another pixel and a data bar pattern is checked for again. This procedure is repeated until no data bar pattern is found, indicating that the bottom of the character is reached. The Y coordinate representing the bottom (the last data bar pattern found) is then combined with the X coordinate representing the right edge of the character, and this (X,Y) coordinate, representing the bottom right edge of the character, is passed from the segmentation routine to the recognition routine for processing. The foregoing is a description of the character-segmentation process. A description of the character-recognition process is presented below. As shown in Figs. 5A and B, following the receipt of the (X,Y) coordinate information from the segmentation routine identifying the bottom-right edge of a character, the system, under control of recognition routine of the stored program, examines the gray-scale pixel values stored in memory. The values are examined a group at a time, each group corresponding to a horizontal slice (segment) of the bars and intervals of the character, as shown by window (marker line) 57 in Figures 4 and 6A. Window 57 represents a selected segment indicative (representative) of the character. From each group of gray-scale data values (e.g., the gray-scale values at marker line 57 of Fig. 4, as represented by waveform 59 in Fig. 6B), the system determines the maximum values (peaks) and minimum values (nulls/troughs) in the data. A null is defined as any gray-scale value which has its two adjacent values larger, and a peak is defined as any gray-scale value which has its two adjacent values smaller. Thus, as shown in Fig. 6B, peaks are detected at positions 2, 6, 8, 10, 17 and 19, and nulls are detected at window (marker-line) positions 4, 7, 9, 15 and 18. A null also seems to exist at position 12. To determine with greater confidence if a null does exist, the window (marker line) 57 is moved up the character to another Y-coordinate position e.g., to position (Y+1) in order to select another slice of the character (i.e., to select the next group of gray-scale values for examination). As shown in Fig. 6C, the nulls detected within this next slice (i.e., among this next group of gray-scale values) are 4, 7, 9, 12, 15 and 18. (Optionally, even a third slice of the character may be examined to boost the confidence level associated with the null and peak values.) From the nulls, a threshold level (average gray-scale value) 60 is calculated as follows: THRESHOLD LEVEL = SUM OF NULL Grey-SCALE PIXEL VALUES/NUMBER OF NULLS To correctly identify the character, the system first develops (derives) a binary code for the character by assigning a "0" each short interval and a "1" to each long interval. It is possible for pixel samples of a short interval to fall below the threshold. All the intervals that fall below the threshold have their widths measured. The two intervals with the widest widths are assumed to be long intervals. Any interval that does not fall below the threshold is labeled a short interval. As a special case, for the example shown in Fig. 6B, the system assigned a "0" to each null above the threshold, and a "1" to each null below the threshold. Thus, from a slice of the bar pattern (i.e., from a window of grey-scale pixel values) shown in Fig. 6A, a binary code of "010001" (corresponding to the pattern of peaks and nulls shown in the waveform of Figs. 6B and 6C) is produced (derived) representing the character. The system then compares the derived binary code to predetermined codes of various characters pre-stored in RAM 27 (Fig. 1). The stored codes, which are arranged in look-up-table form as shown in Table I below, includes various binary codes and corresponding character representations. LOOK-UP TABLE FOR CMC7 CHARACTER SUBSET Char. Binary Code 0 0 0 1 1 0 0 1 1 0 0 0 1 0 2 0 1 1 0 0 0 3 1 0 1 0 0 0 4 1 0 0 1 0 0 5 0 0 0 1 1 0 6 0 0 1 0 1 0 7 1 1 0 0 0 0 8 0 1 0 0 1 0 9 0 1 0 1 0 0 S1 1 0 0 0 0 1 S2 0 1 0 0 0 1 S3 0 0 1 0 0 1 The derived code, which is presented solely for the purposes of illustration, is shown to match the binary code for the control character "S2." The character code corresponding to the derived code is then passed by the recognition routine to the segmentation routine for further processing. If the derived code does not match any of the stored binary codes, this non-match (reject) condition is also passed to the segmentation routine. In the process of "recognizing" a scanned character, the system, under control of the recognition routine, also determines other factors such as confidence level, as described below. Referring to Fig. 7, it can be seen how the relationship between the pixel values and the threshold value (t) 60 may be used by the system to determine (calculate) the widths of the long intervals of the character. The pixels 61, 63 are shown as neighbouring pixels, at horizontal positions (X) and (X + 1), with gray-scale pixel values of (Y) and (Y1), respectively, the value (Y1) being less than (Y). Likewise, the pixels 63 and 65, and 65 and 67 are shown as neighbouring pixels. The pixels 65 and 67 are shown as neighbouring pixels. The pixels 65 and 67 at positions (X+n) and (X+n+1) have gray-scale values of (Y2) and (Y3), respectively, with (Y3) being greater than (Y2). The long interval L1 is calculated as follows: L1 = X1 + (n-1) + X2 where, (n-1) = (X + n) - (X + 1) X1 = (t - Y1)/(Y-Y1) X2 = (t - Y2)/(Y3-Y2) This calculated value representing the width of the long interval is then compared to a predetermined long-interval value (stored in RAM 27) for the character. The result of the comparison is used in determining a confidence level factor, as described below. As indicated above, the system provides a code for the detected character when a match occurs between the derived binary code and one of the predetermined binary codes. In addition to the code, the system also provides a confidence-level indication (e.g., 0% to 100%) after determination of the code, and improves the confidence level depending on the result obtained from additional examinations of the character. Additional examination results may be obtained when a second or third window 57 (Fig. 4) is used to examine additional gray-scale values, or obtained when the width of the long interval (calculated as described above, and as shown in Fig. 7) is compared to the predetermined long-interval value for the character. A confidence level is returned per scan, and is accumulated on successive scans until a high enough level is reached. If a high enough level is not reached, a reject code is outputted. Conditions (factors) which effect confidence level determination include: the widths of the long intervals falling within an expected range the two long intervals having approximately the same widths the distance between the second and third longest interval (if a third interval is detected) exceeding a fixed minimum. the distance of the peaks of the segment from the threshold all six nulls were detected (one or more short interval may have been missed but their positions were detected). all six nulls were not detected (one or more short interval may have been missed but their positions were detected). all six nulls were not detected. If no match occurs between the derived and predetermined binary codes, a reject indication is provided, and the system under control of the segmentation routine, continues scanning until a character is identified (recognized), or until the top of the character has been reached. Following detection and identification of a character, the system proceeds to detect the next character in the field (as shown in Fig. 3), by searching the stored pixel values (as if proceeding leftward on the document) for the right edge of the next character. If a right edge is not found within two character positions, the above-mentioned processing operations are repeated until all of the stored pixel values have been processed.

Claims: Optical character recognition apparatus (11) comprising scanning means (15) for optically scanning a bar-coded character (20) recorded on a document (19) and having a predetermined pattern of bars (45) and intervals of different opacities on said document (19), and producing a plurality of gray-scale pixel values corresponding to said pattern, memory means (27) arranged to store said gray-scale pixel values along with a program and a plurality of predetermined binary codes, one of said codes representing said character, and comprising processing means (23) coupled to said scanning means and to said memory means (27), and operating under control of said program, for selecting from said gray-scale pixel values a first set of values representative of a segment (57) of said character extending across said character transversely to the bars of said character, for producing a binary code corresponding to said gray-scale pixel values, and for identifying said character by matching said produced binary code to one of said predetermined binary codes, characterized in that the processing means (23) is further arranged for selecting from said gray-scale pixel values second sets of values representative of segments (39,41) of the character extending in the direction of the bars of the character and counting those gray-scale values in the second sets that correspond to the bars so as to identify left and right edges of the character, and for determining the distance between the said left and right edges of the character as represented by the gray-scale values and comparing the distance with a known character width. Apparatus according to Claim 1, characterized in that said processing means (23) includes a means for identifying the bottom edge of said character. Apparatus according to Claim 2, wherein said scanning means (15) includes means for reading from said bottom edge to the top edge in a first direction parallel to the bars of said character. Apparatus according to any one of the preceding claims, wherein said processing means (23) includes means (57) for selecting the first sets of values such that the related segment has a predetermined width, and a height of at least one pixel. Apparatus according to any one of the preceding claims, wherein said processing means includes means for selecting a set of minimum gray-scale values from said first set of values for representing the intervals of the character. Apparatus according to Claim 5, wherein said processing means (23) includes means for deriving a threshold value equivalent to the arithmetic mean of said minimum gray-scale values. Apparatus according to Claim 5 or 6, wherein said processing means (23) includes means for expressing said produced binary code in terms of the widths of said intervals, the intervals corresponding to the magnitudes of said minimum gray-scale values relative to said threshold value. A method of optically identifying a bar coded character (20) recorded on a document (19) and having a predetermined pattern of bars (45) and intervals of different opacities on said document (19), and producing a plurality of gray-scale values corresponding to said pattern comprising the steps of storing said gray-scale of pixel values along with a program and a plurality of predetermined binary codes wherein one of said codes represents a character, scanning the bar-coded character so as to produce a plurality of gray-scale pixel values corresponding to said pattern, processing the stored gray-scale pixel values under the control of said program so as to select from said gray-scale pixel values a first set of values representative of a segment of said character extending across said character transversely to the bars of said character, producing a binary code corresponding to said first set of values and identifying said character by matching said produced binary code to one of said predetermined binary codes characterized by the steps of selecting from said gray-scale pixel values second sets of values representative of segments (39, 41) of the character extending in the direction of the bars of the character and counting those gray-scale values in the second sets that correspond to the bars so as to identify left and right edges of the character, and determining the distance between the said left and right edges of the character as represented by the gray-scale values and comparing the distance with a known character width.

Inventors: HIGGINS RAYMOND L, KULKARNI MEERA, HIGGINS, RAYMOND L., KULKARNI, MEERA
Applicants: NCR INT INC, NCR INTERNATIONAL, INC.
Application year: 1991
Main classification: G06K9
IPC codes: G06K9, G06K7