(19)
(11)EP 0 495 607 A2

(12)EUROPEAN PATENT APPLICATION

(43)Date of publication:
22.07.1992 Bulletin 1992/30

(21)Application number: 92300275.2

(22)Date of filing:  13.01.1992
(51)International Patent Classification (IPC)5G06K 9/66, G06K 9/03
(84)Designated Contracting States:
DE FR GB

(30)Priority: 14.01.1991 US 640615

(71)Applicant: NCR International, Inc.
Dayton, Ohio 45479 (US)

(72)Inventors:
  • Golem, Dennis W.
    Waterloo, Ontario N2K 3B5 (CA)
  • Higgens, Raymond L.
    Kitchener, Ontario N2N 2M1 (CA)

(74)Representative: Robinson, Robert George 
International Intellectual Property Department, NCR LIMITED, 915 High Road, North Finchley
London N12 8QJ
London N12 8QJ (GB)


(56)References cited: : 
  
      


    (54)A method and apparatus for representing an unrecognised character in optical character recognition means for subsequent recognition


    (57) The invention provides for a method of representing an unrecognized character to enable subsequent recognition by optical character recognition means capable of scanning and recognizing characters (20) from a document (19) comprising the steps of displaying an image of the unrecognized character (49, 51) having a pattern of light and dark pixels, inputting a user-specified character for identifying the unrecognized character, developing a character count representing the number of scanned characters recognized as being similar to the user-specified character, each recognized character having a light or dark pixel at each of a plurality of pixel positions, developing a pixel count at each pixel position representing the number of times a dark pixel is detected at each pixel position in said characters recognized as similar to the user-specified character and producing a template (96) of light and dark pixels representing the unrecognized character, each pixel position of said template (96) having a light or dark pixel depending on the magnitude of the corresponding pixel count relative to the character count. The invention also provides for an apparatus for carrying out the above method.




    Description


    [0001] The present invention relates to an apparatus and method of optical character recognition.

    [0002] Many existing optical character recognition systems typically provide for optical scanning and recognition of familiar, widely used fonts. Generally, these fonts are predefined and accepted as a standard in the financial community, such as the American Bankers Association.

    [0003] In such systems, the facility to recognize non-standard fonts, or to accommodate out-of-specification print problems and recognize characters with such problems is virtually non-existant. Generally, when a printed character is somewhat out-of-specification, recognition fails, the character is rejected, and the recognition operation is aborted, with consequent loss of valuable time and effort.

    [0004] Also, existing systems do not provide for optical character recognition of non-standard (custom) characters in addition to recognition of standard characters.

    [0005] The present invention seeks to provide a simple and efficient method and apparatus for representing an unrecognized character to enable subsequent recognition of the character in optical character recognition means.

    [0006] According to one aspect of the present invention there is provided a method of representing an unrecognized character to enable subsequent recognition by optical character recognition means capable of scanning and recognizing characters from a document, characterized by displaying an image of the unrecognized character having a pattern of light and dark pixels, inputting a user-specified character for identifying the unrecognized character, developing a character count representing the number of scanned characters recognized as being similar to the user-specified character, each recognized character having a light or dark pixel at each of a plutality of pixel positions, developing a pixel count at each pixel position representing the number of times a dark pixel is detected at each pixel position in said characters similar to the user-specified character, and producing a template of light and dark pixels representing the unrecognized character, each pixel position of said template having a light or dark pixel depending on the magnitude of the corresponding pixel count relative to the character count.

    [0007] As such, a method of optical character recognition is provided whereby the recognition of out-of-specification characters and custom fonts that may be specified by a user is readily acheived.

    [0008] According to another aspect of the present invention there is provided an apparatus for representing an unrecognized character to enable subsequent recognition by optical character recognition means capable of scanning and recognizing characters from a document, characterized by means for displaying an image of the unrecognized character having a pattern of light and dark pixels, input means for entering a user-specified character for identifying the unrecognized character, means for developing a character count representing the number of scanned characters recognized as being similar to the user-specified character, each recognized character having a light or dark pixel at each of a plurality of pixel positions, means for developing a pixel count at each pixel position representing the number of times a dark pixel is detected at each pixel position in said characters recognized as similar to the user-specified character, and means for producing a template of light and dark pixels representing the unrecognized character, each pixel position of said template having a light or dark pixel depending on the magnitude of the corresponding pixel count relative to the character count.

    [0009] As such, optical character recognition apparatus is provided in which the recognition of out-of-specification characters and custom fonts specified by a user is readily acheived.
    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, including a user terminal.

    Fig. 2 illustrates the appearance of a character scanable and identifiable by the system of Fig. 1;

    Fig. 3 illustrates a portion of a document with various characters recorded thereon;

    Fig. 4 illustrates a scanned character having a matrix of pixels of different opacities (grey-scale values);

    Fig. 5 illustrates a window used for framing a character;

    Fig. 6 illustrates the window of Fig. 5 used in framing the character of Fig. 4;

    Fig. 7 shows the results of various logical operations performed on binary data representing the scanned character;

    Fig. 8 shows a matrix representing various positions of the image of a framed character; and

    Fig. 9 illustrates a template and associated binary values used by the system of Fig. 1.



    [0010] Referring now to Fig. 1, there is shown a system 11 of the present invention. The system includes an optical reader or scanner 13 for scanning a document 19, and a computer system (apparatus) 21 for processing data received from the scanner 13. The scanner may be a camera with a CCD (charge coupled device) 15 and a controller 17, such as the Model TCD 132D linear image sensor system sold by Toshiba Corporation of Japan. The document 19 may be a bank draft or check with numeric character or alphanumeric symbol information 20 recorded thereon. The computer system 21 comprises a microprocessor 23, a ROM (read-only-memory) 25 with a boot program, and a RAM (random access memory with a stored program) 27, for storing data from the scanning device and from the microprocessor and for storing predefined data, a terminal 29 with a keyboard 28 and a CRT display 30, and an auxiliary storage unit 31 such as a disc drive with a database of image files of previously scanned documents. Apart from the capability of performing various scanning and processing operations on standard character fonts, as described in detail below with respect to the E13B type character, for example, the system also provides the capability of developing and processing user-specified custom fonts for optical character recognition as described further below under "Development of Custom Fonts for Optical Character Recognition".

    [0011] The scanning operation is commenced at the bottom right corner 33 of the document 19 and ends at the top left cornet 35. The scannet 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 virtual 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 of a pixel, approximately .0127 cm.

    [0012] An example of a read line of a document is shown in Fig. 3. When a document is scanned, the pixel values generated by the scanner to represent the document, including the characters thereon, are stored in memory 27 (Fig. 1). The characters of each read line are stored as a data array (matrix) having, for example, typically one hundred rows, corresponding to the read line's height, and twelve hundred columns corresponding to the document's length (twelve hundred being the typical number of columns for a six-inch document at 200 pixels per inch (2,54 cm). Within the data array, a character (when one is located and segmented as described below) is represented by a matrix of tows (e.g., twenty-one, corresponding to the character's height and columns (e.g., fourteen, corresponding to the character's width). The character "three" shown in Fig. 2, for example, may be represented in pixel array form as depicted in Fig. 4. Each pixel 49 represents a portion of the document and has an opacity index or gray-scale value in the range 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). Since characters are normally printed in a dark color compared to the generally light colored background of the document, the difference in opacity between the character and its background is easily determinable.

    [0013] As indicated above, these gray-scale data values are generated by the scanner, upon scanning the document. The genetated data ate then stored in memory 27 (Fig. 1) for processing by the system 21. The system, under control of the stored program, examines the stored data values, and proceeds to locate a first character, then successive characters of a first field, then other characters of successive fields. Upon locating a character, the system proceeds to frame or delimit the character (i.e., to separate-out or segment the character from other characters). Starting with the stored gray-scale data values obtained from scanning the document 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 41, and so on, the system locates and frames (segments) each of the characters as described below. It does this by first searching the stored data for a rise in gray-scale value representing a transition from a light pixel to a dark pixel, vertically from bottom to top along the scan line. If a rise of more than, for example, forty (the particular value, such as forty, being font dependent) is found between two gray-scale values of adjacent pixels in the scan direction 37, a dark pixel is deemed to be found. The region (of the document) proximate to the dark pixel is regarded as a region where a character is likely to be found. When a dark pixel is found, the system checks the character region (i.e., checks the stored data proximate to the dark pixel value) to determine if the dark pixel is part of a character. It checks for the presence of a character by establishing a segmentation window of sufficient size to effectively frame the character on the document, the position of the dark pixel corresponding to the center of the window. As depicted in Fig. 5, a segmentation window 53 is shown having left and right edges (columns) 55,57, and top and bottom edges (rows) 59,61. Bordering the left and right edges are columns(left+1) 63 and (right-1) 65, and bordering the top and bottom edges are rows (top+1) 67 and (bottom-1) 69.

    [0014] As explained below with reference to Figs. 5 and 6, a character is considered framed and positioned in the center of the window when the sum (Sw) of all the gray-scale pixel values in the window is maximum. To determine whether the sum (Sw) increases when the window is moved, the sums of the pixel values in each of the left and right columns 55,57 and in each of their bordering columns 63,65 are calculated. Likewise, the sums of the pixel values in each of the top and bottom columns 59,61 and in each of their bordering columns 67,69 are calculated. If, for example, the sum in column 63 is found to be greater than the sum in column 57, and would cause the sum (Sw) in the window to increase when the window 53 is moved by one pixel leftward to include column 63 and exclude column 57, then the window is moved leftward. Likewise, if by moving the window by one pixel upward to include row 67 and exclude row 61, the sum (Sw) in the window would increase, then the window is moved upward. Thus, from the sum (cumulative count) of the pixel values of the respective rows and columns adjoining (bordering) the window, relative to the sum of the pixel values of the respective rows and columns at the edges of the window, the direction can be determined in which the window can be moved to increase the sum (Sw) of the pixel values within the window. As shown in Fig. 6, according to the following counts:
    Right-1 column count
    = 0
    Right column count
    = 0
    Left column count
    = 100
    Left+1 column count
    = 100
    Bottom-1 row count
    = 0
    Bottom row count
    = 0
    Top row count
    = 170
    Top+1 row count
    = 170
    the window count is increased by 100 upon a move leftward, and increased by 170 upon a move upward. Therefore, the window is moved leftward and upward. Thus, the window is moved in the direction which increases Sw, and this operation is repeated until no movement of the window in any of the four directions (left, right, up, down) increases Sw. The window is then considered to have framed (delimited/segmented) a character, with the character positioned at the center of the window. Thus, by means of the window a matrix of pixel values most representative of the character is selected (framed).

    [0015] As a check to determine if there is enough information (dark-pixel gray-scale values) in the window to represent the framed character, the total number of pixels in the window that exceeds a predetermined confirmation threshold (e.g., a threshold gray-scale value of 100) is obtained. If the total number is greater than, for example, sixty (for the E13B font), then a character is confirmed to be found in the window. Otherwise, the object framed in the window is interpreted as noise, and the system proceeds to find the next character.

    [0016] After segmentation, the segmented (framed) character is scaled in preparation for identification (recognition). Sixteen bit words are used in the recognition process (i.e., width of template is 16 pixels). Because many characters are wider than 16 pixels (including E13B characters which are 19 pixels wide), they are converted to 16 bits after segmentation. This is accomplished by eliminating predetermined columns e.g., for the E13B font, columns 4, 9 & 14 ate eliminated. (OCRA and OCRB fonts are 16 pixels wide when scanned at two hundred pixels per inch, and do not need to have columns eliminated.)

    [0017] The preceding describes how a character is located in preparation for processing, i.e., how it is effectively located on a document and framed (segmented) for later processing. The following describes how the framed character is converted to binary form then matched to a template (predetermined binaty pattern) for the purpose of identifying (classifying/recognizing) the character.

    [0018] In the conversion operation, the stored gray-scale pixel values for each row of the framed character are converted to binary form. First a reference threshold value is calculated as the arithmetic mean of the dark pixels of the framed character (as previously described). Then, the gray-scale pixel values ate converted to binary form relative to the reference threshold. For example, if the calculated reference threshold is one hundred, then, using the binary equivalence scale shown below:


    a row of gray scale values of 80, 120, 130, 90, 85, 70, 110, 135 may be converted to binary data having the bit pattern 01100011, as shown in the eight-bit word 71 of Fig. 7.

    [0019] This binary data (which represents a row or slice of the framed character) and other rows of converted binary data representing the character ate then compared to a plurality of templates, each template corresponding to a character. Each template represents a predetermined pattern of binary data and comprises three distinct layers (bit configurations). The three eight-bit words 73, 75, 77 shown in Fig. 7 represent an eight-bit row in each of the three layers. The first layer (bit-pattern layer, corresponding to pattern word 73) represents the actual black/white (0/1) bit pattern of the character. The second layer (bit-significance layer, corresponding to bit-significance word 75) identifies the bit positions of the character that are significant and those that are not significant. One-bits identify significant bit positions where the bit pattern of the character is expected to remain unchanged regardless of small changes in size and shape of the character. Zero-bits identify non-significant bit positions where the bit pattern need not be the same for different sizes or shapes of the character. The third layer (bit-weight layer, corresponding to weight word 77) identifies which bits ate critical, and hence have greater weight than others, in distinguishing between like (substantially similar) characters. In this third layer, 1-bits are designated as weighted bits, and 0-bits are designated as non-weighted bits. For example, 1-bits in the top row of the third layer of the template for the characters "O" and "U" would be useful in distinguishing between the two characters, and 1-bits in the bottom row of the third layer of the templates for the characters "Q" and "O" would be useful in distinguishing between the Q and the O.

    [0020] As shown in Fig. 7, various logic operations are performed by processor 23 (Fig. 1) on the binary data 71 in order to identify the character. (The logic operations are actually performed as sixteen-bit operations. However, for simplicity, eight-bit operations are shown). First, the binary data is EXCLUSIVE-OR'd with the corresponding word 73 of the bit-pattern layer to produce a pattern of mismatch 74 between the binary data 71 and the predetermined correct pattern 73. This mismatch pattern 74 is then logically ANDed with the corresponding word 75 of the bit-significance layer for producing a mismatch word 76, representing the extent of mismatch independent of character size and shape. The mismatch word 76 is then weighted, i.e., logically ANDed with the corresponding word 77 in the bit-weight layer to produce a weighted mismatched indicator 78. (If weighting word 77 contained no 1-bits, no weighting or ANDing would have been performed (in order to save processing time since the outcome would be zero), and the system would have proceeded with processing the next row of binary data.)

    [0021] Following the weighting operation, a mismatch count (MCR) is calculated for the row of binary data 71. This calculation is performed by processor 23 (Fig. 1) as follows:

    (1) where,
       MCW represents a mismatch count for the mismatch word (i.e., the number of ones found in mismatch word 76),
       WOC represents a mismatch indicator or weight output count (i.e., the number of ones found in mismatch indicator word 78), and
       WF represents a predetermined weighing factor (e.g., the integer 2 for E13B type characters).
    Thus, for the mismatch bit pattern shown in the words 76 and 78 in Fig. 7, it can be seen that MCW = 2, WOC = 1, and WF = 2. Therefore, the mismatch count (MCR) calculated for the row of binary data 71 would equal fout (i.e., 2+(1x2) according to equation 1 above).

    [0022] After calculating the mismatch count for one tow, the system proceeds to calculate, as indicated above, the mismatch count for all remaining rows of the character. The mismatch counts for all the rows of the character are then summed to produce a template mismatch count (i.e., a mismatch count for the template as applied to the framed character). In a similar manner, for the other templates of the character set for the font being processed, a mismatch count is produced for each template relative to the framed character. The two lowest template mismatch counts and their associated template numbers are stored in memory as the various templates are processed. The criterion for identifying a character is: if the template with the lowest count is below a threshold (a reject threshold of 40 for E13B fonts) and is lower than the next lowest template by a predetermined amount (a difference threshold of 5 for E13B fonts), it identifies the character.

    [0023] Template recognition, as described previously, can be performed in a total of nine positions as shown in Fig. 8. This is done in order to identify characters that may not be perfectly framed due to factors like noise in the image. In the example shown in Fig.8, the template and input (binary data) pattern sizes are 23 rows (high) by 16 columns (wide). The three layers of the template (pattern layer, bit significance layer and weighting layer) are all shifted (moved) the same amount and in the same direction. In the description of shift positions presented below, template row refers to the bit pattern row, bit significance row and bit weight row.

    [0024] In the center position 87, the template 96 is placed directly over the input pattern 98. Only rows 2 through 22 are used in this match. Thus, template row 2 is compared to pattern row 2, and template row 3 is compared to pattern row 3, and so on. All columns (1 through 16) are used in the center horizontal positions 81, 87, 93. In the upper center position 81, rows 1 through 22 of the template are compared to rows 2 through 23 of the input pattern. This is the same as shifting the template pattern vertically upwards by one row. In this case, template row 1 is compared to input pattern row 2, template row 2 is compared to input pattern row 3 etc. All columns of the template and input pattern are compared in this situation (the horizontal centre Similarly, in the lower center position 93, the template is shifted down by one row, thus matching template rows 2 through 23 against input pattern rows 1 through 22.

    [0025] The horizontal shift positions correspond to a shifting of the template 96 to the left or right over the input pattern 98. In the center left position 85, template columns 1 through 15 are used and input pattern columns 2 through 16 are used. (Since it is a center position vertically, rows 2 through 22 are used for both the input pattern and the template.) Thus, template word bit 1 is compared to pattern word bit 2, template word bit 3 is compared to pattern word bit 4, and so on.

    [0026] For example, if the template pattern layer word is:

    and the input character pattern word is:

    The template is shifted left 1 bit (column):

    and the result of the exclusive Or operation would be:

    It should be noted that when a shift left operation is performed, the rightmost bit (least significant bit, LSB) is 0. Thus, the LSB of the bit-significant word will be 0 also (since all three layers ate shifted in the same direction and amount) and, as such, the LSB of the mismatch word 76 (after the AND operation with the bit-significant word) will always be 0. Similarly, a shift to the right makes the leftmost bit (most significant bit, MSB) a 0 and, as such, the MSB of the mismatch word 76 (after the AND operation) will always be 0.

    [0027] A horizontal shift to the right (position 89) is similar to the left shift, only in the opposite direction. Thus, bit 2 of the template word would line up with (be compared to) bit 1 of the input pattern word.

    [0028] The corner positions (positions 95, 91, 83, 79) represent a combination of a vertical shift of one row and a horizontal shift of one column. As an example, in the upper left position 79, the template row 1 is shifted left by one bit position and compared to pattern word 2, and template row 2 is shifted left by one bit position and compared to pattern word 3, and so on.

    [0029] To recognize a character using this method requires nine passes per template times the number of templates in the character set. For example, an alphanumeric character set with 49 characters would require a total of 441 (9*49) matches being done. This can be too time consuming. To promote faster character identification, only the center position of each template is compared initially to the input pattern. The lowest two mismatch counts and their corresponding template numbers are stored in memory 27 as the various templates are processed. At the end of this first pass, the other eight positions of only these two templates are processed to find the best possible (i.e., lowest) total mismatch against the input pattern. Thus, only 65 (1*49 + 2*8) matches need to be made ordinarily (i.e., about 15% of the 441 matches that were required).

    [0030] A description of the criteria for accepting or rejecting a character is presented below.

    [0031] The lowest template mismatch count is compared to a predetermined reject threshold for the character that the template represents. If the template mismatch count for this character is below this threshold and the difference in template mismatch counts for the lowest two templates (second lowest mismatch minus lowest mismatch) is greatet than a predetermined amount (e.g., 10), the template with the lowest template mismatch identifies the framed character. The reason for checking if the mismatch counts are too close is done to discriminate between characters that are very much alike (e.g., Q and O). If the mismatches are similar, the character is rejected rather than risking a misidentification (misread). If no template mismatch falls below the reject threshold discussed above or the two template mismatch counts are too close together, a post processing operation (described below) is performed. If after the post-processing operation the framed character is still rejected, its image is enhanced and converted to binary form (as described below). The recognition process (described above) is then performed again. If the character is identified (satisfies the above criteria), the system then proceeds to process (locate and frame) the next character as described above.

    [0032] By examining the center positions only, the possibility may be missed that a character, other than the closest two, may have a closer count in a position other than the center and be the correct choice. The post processing operation can remedy such a situation. If the lowest two characters chosen are both over the predetermined reject threshold for that individual character or the inter-character distance (second lowest mismatch-lowest mismatch) is too small, a number of other templates may be tested in the other eight positions in an attempt to find a better match. The choice of which templates to process is made, for example, based on the closest character's similarity to the templates. For example, the closest two characters (those with the lowest mismatch counts) chosen, the letters D and O, both have mismatch counts above theit individual reject threshold. In post processing operation, a predetermined set of characters that are similar to D and O would then be processed. This could include characters 0 (zero), Q, C and U. The mismatch counts of the closest two characters after this operation are checked (the one with the lowest mismatch count is checked first) to see if they meet the reject criterion and inter-character distance criterion. If at least one character meets the criteria, that character is returned as the result, and processing (locating and framing) of the next character in the image proceeds.

    [0033] If neither of the above characters meets the reject criteria, or the inter-character distance is too small, the framed character is rejected. In this case, its image is enhanced, (as described below), the character is rebinarized, and the recognition process described above is repeated a second time. If the character is recognized, it is returned. Otherwise, a reject character code is returned as the result, and processing (locating and framing) of the next character on the document continues.

    [0034] In addition to the reject threshold described above, an exit threshold (e.g., the value 10) may also be used in the character identification process as described below. To enhance processing speed, successive template mismatch counts are compared to the exit threshold value, and the first template with a template mismatch count that falls below the exit threshold value would identify the character. In which event, the remaining templates are not processed (which enhances processing speed).

    [0035] Further, to speed the character identification process, if, while the individual rows of a template are being processed, the mismatch count of the current template (i.e., the template currently being processed) is found to be larger than the second-lowest-count-obtained-thus-fat, processing of the current template may be discontinued since this current template is no longer a contender to be one of the two with the lowest template mismatch counts. To further enhance recognition speed, the templates may be presequenced in the order in which they are most likely to occur (e.g., numbers before vowels followed by consonants in an alphanumeric font). If the mismatch is below the exit threshold (as mentioned above), the remainder of the templates need not be examined. Thus those characters occurring most frequently should be examined first. Also, to promote faster character identification, only the center position may be tested by the templates, after which, if the lowest template mismatch count is above the exit threshold, the remaining eight positions for each of the two templates closest to the exit threshold may be processed, and the template with the lowest template mismatch count selected as representative of the character. Further, to speed identification, the remaining eight positions (Fig. 8) may be processed in the following sequence 79, 81, 83, 85, 89, 91, 93, 95. This is the order in which the character is most likely to be positioned.

    [0036] After identifying the framed character, the system proceeds to process the next character (i.e., to process the next group of stored pixel values representing the region on the document proximate to the framed character) by moving the segmentation window a selected number of pixels (e.g., three pixels) to the left of the previously framed character. The character in this proximate region is then framed (segmented) and identified as described above. All of the remaining characters (remaining stored pixel data) are processed in this manner until end-of-field is detected (i.e., no more characters have been located or an end-of-field character has been located).

    [0037] If, during the character-identification process a character is rejected, its image is enhanced (as noted previously) to facilitate identification. The image may be enhanced, for example, by producing character image having constant stroke widths (i.e., having a constant number of dark pixels across the width of each vertical stroke or horizontal stroke of the character). This is accomplished as described below. First, the gray-scale pixel values (e.g., 6-bit, 8-bit, or 16-bit values) representing the character ate converted to a lesser range of values (e.g., 3-bit gray-scale pixel values for faster processing), then the individual pixels of the character image are examined and only those pixels that are the darkest two or three pixels of the stroke are turned black, others are turned white. This produces a binary image with constant stroke widths as described for example in U.S. Patent No. 4,625,330 (incorpotated by reference herein).

    [0038] As an assist for improving character identification, the edges of each character may be processed as described below. As mentioned above, each template used in the character identification process corresponds to one character of the selected character set (e.g., the E13B character set) and, as shown in Figs. 2 and 4, each character is fourteen pixels wide by twenty-one pixels high. One extra column is added to the left and to the right of the character, and one extra row is added to the top and to the bottom of the character. This results in a character size of 16 by 23. Corresponding to each character, each template is sixteen pixels wide by twenty-three pixels high. Each template has an extra column on each side (right side and left side) of the fourteen-column character, and one extra row on the top and an extra row on the bottom of the twenty-one-row character. Each extra row comprises sixteen white pixels, and each extra column comprises twenty-three white pixels. The extra rows and columns serve to surround the 14 x 21 character region with a border of white pixels for better identification of the edge portions of certain characters, as explained below. For example, if the character "E" is matched against a 14 x 21 "F" template, and the template is shifted upward one pixel position, the pixel values at the bottom of the "E" would be lost since it could not be used in generating the template mismatch count. This could result in mis-identification of the E as an F since the mismatch count would be low. With the 16 x 23 template, the bottom of the E would not be lost and would contribute substantially to the mismatch count against (relative to) the bottom white row of the F template, thereby avoiding misidentification of the E as an F. A similar explanation holds with respect to the right and left column positions of the 16 x 23 template, the columns serve to reduce misidentification between characters such as "B" and "3".

    [0039] As shown in Fig. 9, each 16 x 23 template may be represented by sixty-nine sixteen-bit words of RAM 27 (corresponding to a scan of two hundred pixels per inch). Of the sixty-nine words, twenty-three represent first layer bit-pattern words, twenty-three represent second-layer bit-significance words, and twenty-three represent third-layer bit-weight words. Each set of twenty-three words correspond to the height of the character, and each sixteen-bit word correspond to the width of the character. (In Fig. 7, for simplicity, eight bits rather than sixteen bits are used to depict the logical operations.)

    Development of Custom Fonts For Optical Character Recognition



    [0040] In the foregoing, the recognition of standard character fonts (such as the E13B type font, for example) is described. In the following paragraphs, the recognition of user-specified custom fonts is described. More particularly, the development of templates by the system for defining (representing) user-specified custom fonts is described.

    [0041] Following the scanning of a document and storage of the image in memory as scan data (grey-scale pixel values) as described previously, and before the processing of the stored data, selected routines of the stored program may be initialized described below. The routines enable the system to develop and process (segment and recognize) user-specified fonts, and are initialized upon entry of the following command via keyboard (or input device such as a mouse) 28 of terminal 29:

    where AUTOFONT is the name of the program to be run, OCRB is the base name assigned to the font to be developed, and D2001.GRY is the name of the image file to be processed. The program AUTOFONT stored in memory 27 then enables the system to access the disk drive 31 and to open the file OCRB.FNT. If the file exists on the disc 31 its contents (template data) is input (read) into memory 27 and used, as described, in segmenting and identifying (recognizing) the scanned characters. If the file does not exist, the size of the characters that the system will be called upon to process must be specified (input) by the user. To enable the user to specify the required character size, the following menu is displayed by the terminal.

    1. OCRA or OCRB character size

    2. E13B character size

    3. 7B character size

    4. 10 char/inch, 6 lines/inch size

    5. Enter size by pitch

    6. Enter actual pixel size of character

    The user may then enter the number 1, 2, 3, 4, 5, or 6. In response to entry of 1, 2, 3, or 4 the system generates predetermined character sizes appropriate for the particular font (character type/style). For example, if 2 was entered, the character size of 17 x 24 pixels (i.e., 17 pixels wide by 24 pixels high, corresponding to a scaled-down template size of 16 x 26) would be used by the system for E13B type characters, as described previously. In expressing the character sizes associated with the menu selections, the system provides a resolution of 200 pixels/inch.

    [0042] If the desired character size is not one of the standard ones, represented by menu selections 1-4, the user may specify a custom size by indicating the pitch (e.g., eight characters/inch) of the desired custom font. The user does this by entering the following information in the following input sequence:

    1. User enters the number "5" System then displays "ENTER PITCH"

    2. User enters the number "8"

    Alternatively, the user may specify the actual pixel size of the character (e.g., 12 pixels wide by 20 pixels high) by entering the following information in the following input sequence:

    1. User enters the number "6" System then displays "ENTER CHARACTER HEIGHT"

    2. User enters the number "20" System then displays "ENTER CHARACTER WIDTH"

    3. User enters the number "20"



    [0043] When the character size information has been input by the user, the system then builds an initial character set consisting of the numerics (characters 0 through 9) and their associated templates. (Initially, each of the bits in the bit-pattern layers of these templates are set to black(one), the bits in the bit-significance layer are set to all ones, and the bits in the weight layer are set to zeroes since no character has yet been detected). This is done since most fonts contain numeric characters.

    [0044] The system then creates a statistics(Stats) file for each of the above defined characters. The Stats File consists of the following:
       a 16-bit word (called a character-frequency word) containing the count of the number of times this character has been recognized. (This word is initialized to zero when created.)
       two 8-bit words which hold the values of the height and width of the character, in pixels. (These words are initialized to the values input by the user, as described above.)
       an array of sixteen-bit words (called bit-frequency words), one for each pixel position in the character. For example, a character with a height of 26 pixels and width of 16 pixels would have 26 x 16 or 416 of these words. (Note the width is always scaled to a maximum of 16 for recognition purposes.) These words ate also initialized to zero at creation of the Stats File.

    [0045] The system then segments and binarizes a character from the image (pixel data stored in memory) and performs the recognition process (i.e., passes the binarized character to the recognition routine) as described previously. If the character is recognized, the Stats File and template are updated as described below. If the character is not recognized (i.e., is rejected), the binary image of the character is displayed on the display 30 (Fig. 1) of terminal 29 along with the message "Enter Character:" inviting the user to indicate what he/she thinks the character is. The user then responds by entering a character (e.g., "3") via the keyboard 28. The system then checks to see if the character is a member of the character set. If not, the character is added to the character set and a corresponding template and Stats File are created.

    [0046] At this point, the system knows what character the segmented pattern represents (e.g. "3") because it was either input by the user, or the recognition routine was able to recognize it because it was predefined. The Stats File for the character is then updated in the following manner. First, the character-frequency word is incremented. Then, each pixel position in the character pattern is checked. If the pixel is black (represented by a binary one), the corresponding bit-frequency word in the array is incremented. If the pixel is white (represented by a binary 01, the bit-frequency word is not updated. For example, if the pixel at row 12, column 15 is black, then the bit-frequency word representing that position would be incremented.

    [0047] When the Stats File for the character has been updated, the template for that character (consisting of the bit-pattern layer, bit-significance layer and the bit-weight layer, as discussed previously) is also updated. The system builds the bit-pattern and bit-significance layers based on the Stats File contents. The count of the number of times a pixel was black (bit-frequency word) is compared to the number of patterns detected (character-frequency word).

    [0048] If the bit-frequency value is found to be greater than, for example, ninety percent of the character-frequency value, the corresponding bit in the bit-pattern layer being built is set to one (black), and the corresponding bit in the bit-significance layer being built is set to one. If the bit-frequency value is found to be less than, for example, ten percent of the character-frequency value, the corresponding bit in the bit-pattern layer being built is set to zero (white), and the corresponding bit in the bit-significance layer is set to one. If the bit-frequency value is within ten to ninety percent of the character-frequency value, the corresponding bit in the bit-pattern layer being built is set to zero and the corresponding bit in the bit-significance layer is set to zero. Likewise, for each remaining pixel of the displayed character, the corresponding bits of the bit-pattern layer and bit-significance layer being built (developed) are set to one or zero until development of these two layers of the template is complete.

    [0049] Initially, all bits (pixels) of each bit-weight layer being developed are set to zero (no weighting).

    [0050] When a document is finished being processed (i.e., after all characters on the read line have been processed), the weight layers for each template are updated as described below.

    [0051] To determine if weighting is required, each template is compared to every other template in turn, in the following manner. For example, let template 1 be the primary template and the rest be secondary templates. Initially, the weight layer of the primary template is set to zero, and one of the secondary templates is selected. The bit-pattern word in the selected secondary template is then EXCLUSIVE OR'd with the bit-pattern layer of the primary template (similar to the type of operation shown in Figure 7). The result of this operation is then ANDED with the bit-significance word of the primary template to give a mismatch count (as is done in the normal recognition process described previously). This process is performed for all the words in the template. If the total mismatch for the two templates is less than an inter-character threshold (e.g., 10), weighting is performed to try to separate (distinguish) the mismatch counts for similar characters such as O and Q. If the mismatch count is less than a post-process-threshold (e.g.,40), the character that the secondary template represents is added to the list to post-process, as described previously with respect to the recognition process. The next secondary template is then processed as described above, until all of the secondary templates have been processed (developed). Then, a new primary template is selected and similar processing (as describe above) is performed until each template has been compared with all others.

    [0052] If the total mismatch for two templates is less than the inter-character threshold mentioned, weighting is performed as follows. The pattern word from the primary template is EXCLUSIVE OR'd with the pattern word from the secondary template. The result of this operation is then ANDed with the bit-significance word of the secondary template, and the result of that operation is ANDed with the bit-significance word of the primary template to produce a third result. The 1 bits in this third result are both different and significant for the two templates. Thus, weighting of these bits would increase the mismatch count between the two templates. The weight word of the primary template is therefore OR'd with this final result. The same operation is performed for the rest of the words in the template.

    [0053] Having developed bit-pattern, bit-significance, and bit-weight layers for each character, the system now has a complete set of templates. It then stores these newly developed templates on disc for later use to recognize characters in subsequent scanning and recognition operations.

    [0054] A listing of the pseudo code of the stored program which enables the system to perform the logical and other processing operations described above is presented below.






    Claims

    1. A method of representing an unrecognized character to enable subsequent recognition by optical character recognition means capable of scanning and recognizing characters (20) from a document (19) characterized by displaying an image of the unrecognized character having a pattern of light and dark pixels (49, 51), inputting a user-specified character for identifying the unrecognized character, developing a character count representing the number of scanned characters recognized as being similar to the user-specified character, each recognized character having a light or dark pixel at each of a plurality of pixel positions, developing a pixel count at each pixel position representing the number of times a dark pixel is detected at each pixel position in said characters recognized as similar to the user-specified character, and producing a template (96) of light and dark pixels representing the unrecognized character, each pixel position of said template (96) having a light or dark pixel depending on the magnitude of the corresponding pixel count relative to the character count.
     
    2. A method according to claim 1, characterized in that each pixel position of the template (96) has a dark pixel if the ratio of said pixel count to said character count is above a predetermined value.
     
    3. A method according to claim 1 or 2, characterized in that production of said template (96) includes the production of a bit-pattern layer.
     
    4. A method according to claim 1, 2 or 3, characterized in that the production of said template (96) includes the production of a bit-significance layer.
     
    5. A method according to claim 1, 2, 3 or 4, characterized in that production of said template (96) includes the production of a bit-weight layer.
     
    6. An apparatus for representing an unrecognized character to enable subsequent recognition by optical character recognition means capable of scanning and recognizing characters (20) from a document (19), characterized by means (30) for displaying an image of the unrecognized character having a pattern of light and dark pixels (49, 51), input means (28) for entering a user-specified character for identifying the unrecognized character, means for developing a character count representing the number of scanned characters recognized as being similar to the user-specified character, each recognized character having a light or dark pixel at each of a plurality of pixel positions, means for developing a pixel count at each pixel position representing the number of times a dark pixel is detected at each pixel position in said characters recognized as similar to the user-specified character, and means for producing a template (96) of light and dark pixels representing the unrecognized character, each pixel position of said template having a light or dark pixel depending on the magnitude of the corresponding pixel count relative to the character count.
     
    7. An apparatus according to claim 6, characterized in that each pixel position of said template (96) has a dark pixel if the ratio of said pixel count to said character count is above a predetermined value.
     
    8. An apparatus according to claim 7, characterized in that said means for producing a template (96) includes means for producing a bit-pattern layer.
     
    9. An apparatus according to claim 6,7, or 8, characterized in that said means for producing a template (96) includes means for producing a bit-significance layer.
     
    10. An apparatus according to claim 6, 7, 8 or 9, characterized in that said means for producing a template (96) includes means for producing a bit-weight layer.
     




    Drawing