Extraction of features from a pattern

Abstract: An apparatus for and a method of feature extraction in which are formed feature vectors representing pixels contained in a pattern desired to be recognized, and reference patterns. One part of the feature vector developed is representative of the pixels contained in the pattern itself. Another part of the feature vector, consisting of one or more bytes of the feature vector, defines the aspect ratio of the pattern. Each byte of the feature vector representing the pixels contained in the character can represent the relative ratio of black pixels to total pixels in a specific area of the character; other functions relating input matrix and output feature vector information can be used. The areas of the character which are defined by the feature vector can together cover the entire character, providing a feature vector describing what might loosely be thought of as a "blurred" version of the pattern.

Description: DESCRIPTION The invention relates to an apparatus for and a method of extracting pattern features, the apparatus and method being capable of use in a pattern in recognition system. A wide variety of pattern recognition systems are known in the art. Each such system optically receives data depicting a pattern to be recognized, and performs certain tasks on this pattern in order to compare it to known patterns in order to "recognize" the input pattern. A basic flow chart depicting a pattern recognition system is shown in Figure 1 of the accompanying drawings, which is a block diagram depicting both the physical organization and process flow of a typical prior art pattern or character recognition system. The input pattern is the pattern which is desired to be recognized. A digitizer 12 converts input pattern 11 to a series of bytes for storage in system memory 13. These bytes are typically binary in nature, reflecting the fact that input pattern 11 is basically a black and white figure. Digitizers are well known in the art and typically are used in such devices as facsimile machines, electronic duplicating machines (as opposed to optical photocopy machines) and optical character recognition systems of the prior art. Memory 13 can comprise any suitable memory device, including random access memories of well-known design. Segmentation 14 serves to divide the image data stored in memory 13 into individual characters. Such segmentation is known in the prior art, and is described, for example, in Digital Picture Processing , Second Edition, Volume 2, Azriel Rosenfeld and Avinash C. Kak, Academic Press, 1982, specifically, Chapter 10 entitled "Segmentation". Feature extraction means 15 operates on each piece of data (i.e., each character) received from segmentation 14 in order to transform that data into a standard predefined form for use by identification means 16, which in turn identifies each character as one of a known set of characters. Output means 17 serves to provide data output (typically ASCII, or the like) to external circuitry (not shown), as desired. Identification means 16 can be any one of a number of prior art identification means typically used in pattern recognition systems. including, more specifically, optical character recognition systems. One such identification means is described in U.S. Patent No. 4,259,661, issued March 31, 1981 to Todd, entitled "Apparatus and Method for Recognizing a Pattern". Identification means 16 is also described in Syntatic Pattern Recognition and Applications , K.S. Fu, Prentice Hall, Inc., 1982, specifically, Section 1.6, and Appendices A and B. Inasmuch as this invention pertains to an apparatus, and to its method of operation for use, in place of the feature extraction means 15 as in an optical character recognition system, this specification, including the description of prior art herein, will focus on such feature extraction means. Prior art feature extraction techniques generally fall into two categories, namely, "matrix overlay", and "feature analysis". In matrix overlay, an input character to be recognized is physically compared with a plurality of known patterns which are stored in memory. Essentially, both the input data and the stored, known characters, containing a plurality of pixels (picture elements) are each stored as a feature vector comprising a bit for each pixel (both white and black) of the character. This results in a very large number feature vectors being stored if the test pattern is to be compared with a large number of reference patterns. Matrix overlay type of feature extraction generally employs a figure of merit which is a number derived by a best-match procedure of the individual pixels in which the individual pixels of the input character and the individual pixels of a known character are combined in an Exclusive OR logical operation. The resulting figure of merit of this Exclusive OR operation is a number depicting the number of pixels which do not match in the two patterns. This information is provided to identification means 16, which selects as the recognized character, that character having the lowest number of mismatched pixels. The matrix overlay method of feature extraction is useful for matching input characters with a very limited number of fonts or reference characters. This is one reason that special "OCR" character fonts have been developed which, although very well suited for use with matrix overlay feature extraction techniques, are not particularly legible by humans. Matrix overlay feature extraction techniques are relatively insensitive to "speckle" noise (i.e., a dirty page), and are relatively insensitive to unintended breaks within characters. However, matrix overlay is highly sensitive to changes in shape, i.e., changes in fonts, type size, the use of italics, underlines, bold print, and similar common occurrences. Therefore, matrix overlay feature extraction techniques are not really suitable for widespread use in systems which must recognize characters having a large number of fonts, type sizes, and the like, without requiring an enormous investment in hardware and computational abilities. Another prior art technique used for feature extraction is so-called "feature analysis". Feature analysis is a feature extraction technique which looks at each character to be recognized and determines whether such characters contain any one or more of a plurality of specific features. Such specific features often used in feature analysis feature extraction techniques include the location of strokes in certain positions, location of edges of the character, location of areas which are completely bounded by the edge of a character (such as the upward pointed promontory at the top of a capital letter "A", rightward pointing "bays", such as the opening in the letter "C", and the like. Such feature analysis techniques are described, for example, in Computer Analysis and Perception , Volume I, "Visual Signals", Ching Y. Suen, Renato De Mori, CRC Press, Inc., 1982, particularly, Chapter 3. There are a great number of feature analysis techniques depending upon, in part, the particular features that a given person believes are important in recognizing characters. The data output from a feature analysis feature extraction technique is a mathematical feature vector defining the existence of, the quantity of, or the strength of, specific features in an unknown character to be recognized. This feature vector is then used by the identification means to compare with stored feature vectors of known characters, with the unknown character being identified as that known character having a feature vector most similar to the feature vector of the unknown character. In some feature analysis techniques, certain features are more heavily weighted than others during the comparison of the unknown character feature vector and the known character feature vectors. In general, the feature analysis technique, regardless of which features are being located and used, are very sensitive to undesired breaks in characters and to speckle noise. On the other hand, feature analysis feature extraction techniques generally provide less sensitivity to changes in shapes, and thus changes of font and type size, than does matrix overlay feature extraction techniques. In addition, there has been used in the prior art a technique which combines some of the characteristics of the matrix overlay and the feature analysis feature extraction techniques. The so-called "template matching" techniques use known masks to view regions within the unknown character in order to locate certain features. Thus, a certain mask might be used to view the left edge of the character to determine if there is a vertical line on the left edge of the character, as in the letter "K". While this technique overcomes some of the disadvantages of the matrix overlay and feature analysis feature extraction techniques, template matching feature extration techniques tend to share many of the same drawbacks. For example, template matching, like feature analysis, requires a great deal of computational ability. Another prior art feature extraction technique is described in "Chinese Character Recognition by Hierarchical Pattern Matching", S. Yamamoto, A. Nakajima, K. Nakata, Proceedings of the First International Joint Conference on Pattern Recognition, October 30 through November 1, 1973, Washington, D.C., The Institute of Electrical and Electronics Engineers, Inc., pages 187-196. Yamamoto et al. describe a matrix overlay feature extraction technique. However, in each step of this feature extraction technique, the pixels forming the character to be recognised are used to form a series of "compressed images", each of such compressed images being compared with known characters whose images have been similarly compressed. During each step, less "compression" is used, and a number of known characters which are determined not to be the unknown character, are eliminated from subsequent comparisons, thereby speeding the comparison process. This type of matrix overlay technique provides certain advantages as compared with the matrix overlay techniques described above, however, since it remains a matrix overlay technique, it is difficult to use this technique to recognise characters from a large number of fonts, without requiring an undue amount of hardware and computational ability. The extraction technique featuring in the prior art portion of the independent claims is described in Elektronische Rechenanlagen 1974 Heft 4 page 135. The present invention accordingly provides an apparatus and a method in which are formed feature vectors representing the pixels contained in a pattern desired to be recognised, and reference patterns. One part of the feature vector developed in accordance with the invention is representative of the pixels contained in the pattern itself, while not requiring a very large feature vector which exactly defines each pixel of the pattern. This invention can also provide that other part of the feature vector, consisting of one or more bytes of the feature vector, defines the aspect ration of the pattern. Each byte of the feature vector representing the pixels contained in the character can represent the relative ratio of black pixels to total pixels in a specific area of the character; other functions relating input matrix and output feature vector information can be used. Those areas of the character which are defined by the feature vector can together cover the entire character, providing a feature vector describing what might loosely be though of as a "blurred" or confounded version of the pattern. Regions of the input matrix, may be evenly spaced of equal size and/or overlap. It is to be understood that the invention is applicable for use in pattern recognition systems for recognising patterns other than characters, and indeed to systems used to recognise any information capable of being represented mathematically. The invention will be further explained below, by way of illustration, with reference to the remaining Figures of the accompanying drawings, in which: Figures 2a through 2C depict the technique used in accordance with this invention to transform a matrix of a first size containing buts representing pixels in an image into a matrix of a second size containing bytes representing a confounded version of that image; Figures 3a through 3c also illustrate the technique used in accordance with this invention to transform a matrix of a first size containing bits representing pixels in an image into a matrix of a second size containing bytes representing a confounded version of that image; Figure 4 is a flow chart depicting the method of Figures 3a and 3b; Figure 5 is a flow chart depicting the method of Figures 3b and 3c; and Figure 6 is a flow chart depicting a similar method of this invention in which the intermediate array is not used. In accordance with this invention, there are formed feature vectors defining the pixels contained in a pattern or character desired to be recognized. The feature vector developed in accordance with the invention is, unlike that of the prior art, representative of the pixels contained in the character itself while, unlike matrix overlay techniques, not forming a very large feature vector which exactly defines each pixel of the image. In one embodiment of this invention, the feature vector contains 40 bytes, plus 16 bytes defining the aspect ratio (the square root of the ratio of the character's width to the character's height). In this embodiment, each of the 40 bytes of the feature vector define the relative number of black pixels to total pixels in each of 40 different areas of the character. In one embodiment it is not desirable to simply divide the character into 40 pieces since, in general, the number of pixels in the character is not evenly dividable by 40. The technique employed in this embodiment effectively divides the character into 40 equal regions by allowing portions of one pixel to be apportioned among several (in one embodiment up to four) regions. This allows an optical character recognition system using this technique to compare an unknown character with a plurality of known characters (represented by their own unique feature vectors) in a manner thought to be similar to the way comparisons are made by humans. This ability is not merely of academic interest; it has been determined that this technique allows the recognition of characters, and avoids the misrecognition of characters, to a much more reliable extent than known in the prior art for characters in many different type fonts. It has been empirically determined, by performing optical character recognition on a rather large amount of input data, that a feature vector representing a 5x8 matrix (width equal to 5, height equal to 8) representing a character, provides the greatest accuracy in recognition of Roman print. For scripts other than Roman, the same exercise can be performed to determine if different aspect ratios would be better suited for recognizing such other character sets. Since, in general, the digitization of text being read results in a character represented by a number of pixels larger than a 5x8 matrix, it is necessary to have a technique for transforming, for example, a 20-pixel-wide by 30-pixel-high image into a 5x8 byte feature vector matrix. In prior art techniques for reducing a large matrix to a smaller matrix for easier manipulation using feature analysis or matrix overlay feature analysis techniques, only selected pixels would be included in the transformed array. The selected pixels would, hopefully, be selected to be key pixels which enhance the ability to distinguish between two similar characters such as a "c" and an "e". While these techniques did allow the transformation of data into a more manageable size, they still had the attendant disadvantage described above with regard to feature analysis or matrix overlay feature analysis techniques. Conversely, small characters, such as the "period", must be expanded to fill a 5x8 feature vector matrix. In accordance with this invention, apparatus is provided to transform a matrix of a first size defining a character into a matrix of a second size which defines the same character in a manner thought to be similar to the way that humans view the character, albeit a "blurred" version of the character. This technique can be described with reference to Figures 2a through 2c. Figure 2a represents an NxM matrix, for example, as received from segmentation means 14 (Figure 1). While Figure 2a shows a 4x3 matrix, this is to be understood to be exemplary only, and in reality a typical input matrix might be 20 pixels wide by 30 pixels high or more. Further, for sake of example, assume it is desired to transform the 4x3 matrix of Figure 2a into a 3x2 matrix, as shown in Figure 2c. Figure 2b depicts an intermediate matrix of size NPxMQ bits (although it is to be understood that other sized intermediate matrices could be used), where N is the height of the input matrix, M is the width of the input matrix, P is the height of the output matrix, and Q is the width of the output matrix. In order to fill the matrix of Figure 2b, the value of each bit of Figure 2a is entered into Figure 2b Q times in the horizontal direction and P times in the vertical direction, as shown (dashed rectangles). In order to complete the transformation, the data from the intermediate matrix of Figure 2b is entered into the PxQ matrix of Figure 2c by summing the value of each of the PxQ regions of Figure 2b (solid rectangles). each having size NxM, as shown. This result in a transformation of the NxM (4x3) input matrix of Figure 2a to the PxQ (3x2) output matrix of Figure 2c. Of importance, the output matrix of Figure 2c represents the character previously represented by input matrix 2a in a blurred or "confounded" manner. In other words, the data in Figure 2c is confounded from the data of Figure 2a in such a manner that each byte of the matrix of Figure 2c represents a region of the original character represented in Figure 2a. If the input array is fairly large, this embodiment results in a very large intermediate array (Fig. 2b). In another apparatus embodying this invention, the same output array (Fig. 3c) is created with the use of a series of counters that coordinate when elements of the input array (Fig. 3a) are to be added to the elements of the output array. This second embodiment is arranged to create an intermediate array having the width of the output array and the height of the input array. The intermediate array (Fig. 3b) so created is incremented first, using the elements of the input array. When the intermediate array is full, the elements of the intermediate array are used to fill the output array. Figure 4 is a flowchart depicting the process of filling the intermediate array, and Table 1 depicts the values of the various counters and indices used in the flowchart of Figure 4 in order to fill the intermediate array. Similarly, Figure 5 is a flowchart depicting the process for filling the output array, once the intermediate array has been filled, and Table 2 shows the values of the counters indices used in the filling of the output array. The steps in the Tables of this specification are numbered just prior to execution of the step marked with "star" in their associated flowchart. For the purpose of this specification, the following variables are used in conjunction with flowcharts and the tables in order to describe the operation of the counters. M = width of Input Array (bit map) Q = width of Output Array N = height of Input Array P = height of Output Array i = Input Array horizontal index. Increments from 0 to M-1. I = Output Array horizontal index. Increments from 0 to Q-1. j = Input Array vertical index. Increments from 0 to N-1. J = Output Array vertical index. Increments from 0 to P-1. H1= Horizontal counter to determine i incrementation. Increments from 0 to Q. H2= Horizontal counter to determine I incrementation. Increments from 0 to M. V1= Vertical counter to determine j incrementation. Increments from 0 to P. V2= Vertical counter to determine J incrementation. Increments from 0 to N. In another embodiment of this invention, the use of the intermediate array is replaced by utilising additional counters. Figure 6 is a flowchart depicting the operation of this third embodiment. Table 3 traces the steps in the algorithm for the transformation of the input array of Fig. 3a into the output array of Fig. 3c. As previously described, a typical input matrix defining a character might be 20 pixels wide by 30 pixels high, and the blurred or confounded output matrix might be 5 bytes wide by 8 bytes high, thus incidentally greatly reducing the number of bytes required to be manipulated in order to further process this data. As will be readily understood by those of ordinary skill in the art, a 20 wide by 30 high input matrix containing single bit binary numbers representing white and black pixels, when confounded to a matrix of any size, can provide an output byte having a maximum value of 600 (N times M) corresponding to a region which is all black (all input pixels in that region = 1). In one embodiment of this invention, the feature vector (except for those bytes of the feature vector representing the aspect ratio or other additional features) is normalized such that the norm is equal to 256 in accordance with the following equation: where x i = the ith byte of the feature vector; and N = the number of bytes in the blurred or confounded pixel part of feature vector The number 256 has been empirically determined to produce output vectors with the smallest number of bits per element that still gives results from identification means approximately as accurate as those from feature vectors with arbitrary large numbers of bits per element. Normalisation provides several advantages. Normalisation reduces the value of any given byte, thereby minimising the number of bits required to represent that byte. More importantly, this normalisation is performed in order to eliminate the effects of variations in character size, thus requiring only a single set of reference vectors per font over a wide range to type size. This is in stark contrast to prior art techniques in which, say, a set of reference characters feature vectors would be required for Courier 10 point, a separate set of reference character feature vectors required for Courier 12 point, a separate set for Courier 14 point, and so on. In other words, in accordance with the teachings of this invention, the feature vector, for example, for a 12-point Courier "e" is exactly the same as the feature vector for a 14-point Courier "e", while in OCR systems using matrix overlay feature extraction techniques, these would have two separate feature vectors. This allows a dramatic reduction in the number of stored reference character feature vectors, with an attendant decrease in cost and greatly-enhanced speed of operation. In relatively few cases (empirically determined to be less than approximately 1/10 of 1%), this normalisation technique results in one or more bytes of the normalised vector having a value of greater than 127. In this event, these values are set equal to 127, thereby maintaining each byte of the feature vector as a value which can be represented in 7 bits. As an additional feature of this invention, one or more additional bytes, representing additional features for the input patter, are used to form the feature vector. In one embodiment, 16 such bytes are used to each represent the following value: K √ W/H ; where W = the width of the input character H = the height of the input character K is a constant which has been empirically determined to be equal to approximately where KKHEIGHT = the number of vertical elements in the feature vector. In this manner, the bytes representing the aspect ratio actually represent a weighted aspect ratio which has been determined to be the relative importance of the aspect ratio in comparing unknown characters to known characters, relative to the remaining bytes defining the feature vector. In this embodiment, a plurality of such weighted aspect ratio representations are used in order to keep their values such that they can each be represented in 7 bits or truncated to 7 bits without great loss of accuracy. If this is not necessary, a single aspect ratio byte could be used. In this embodiment of this invention, the value K is actually 1/4 of the weighting factor determined to be most effective for accurately recognizing characters and hence there are 16 aspect fields in the feature vector. In this manner, when comparing a feature vector representing a character to be recognized with a known reference character feature vector, each aspect ratio byte is dealt with in a manner which is identical to how each of the initial 40 bytes are dealt with. In other words, when comparing two feature vectors, the following equation is performed: X = feature vector X; Y = feature vector Y; D(X,Y) = the distance between feature vector X and feature vector Y; X i = the ith element of feature vector X; Y i = the ith element of feature vector Y; and N = the number of elements in each feature vector (N=56 in the feature vector described above having 40 confounded pixel bytes and 16 bytes representing the aspect ratio). While this specification illustrates specific embodiments of this invention, it is not to be interpreted as limiting the scope of the invention as defined by the claims. Many embodiments of this invention will become evident to those of ordinary skill in the art in light of the teachings of this specification.

Claims: An apparatus for extracting pattern features from pixel data elements having values representing the pattern and stored in an input matrix, comprising: means for grouping the input matrix elements into a plurality of groups; and means for summing the input element values in each group to provide output matrix elements representing the input data pattern in the form of a blurred feature vector suitable for further processing for pattern identification, characterised by means for providing an output feature vector including an input pattern aspect ratio parameter weighted according to its usefulness in identifying unknown input patterns. An apparatus as claimed in claim 1 characterised in that the means for summing comprises counters for determining which elements from the input matrix are to have their values added to which elements of the output matrix. An apparatus as claimed in claim 2 characterised in that the counters are used to determine which elements from each row of the input matrix are to be added to which of a first plurality of elements in a corresponding row of an intermediate matrix, and the counters are used to determine which elements from each column of the intermediate matrix are to be added to which of a second plurality of elements in a corresponding column of an output matrix having a first plurality of columns and a second plurality of rows. An apparatus as claimed in claim 1, 2 or 3 characterised by means for proportioning the aspect ratio parameter to the square root of (M/N) where M is the width in pixels and N is the height in pixels of the input pattern matrix. An apparatus for transforming an input pattern in the form of pixel data in an input matrix of width M elements and height N elements into an output feature vector matrix of width Q elements and height P elements, comprising: means for forming an intermediate matrix having a width MQ and height NP; means for entering each element from the input matrix into the intermediate matrix Q times in the horizontal direction and P times in the vertical direction; and means for filing the output matrix with elements from the intermediate matrix, characterised in that the feature vector includes an input pattern aspect ratio parameter weighted according to its usefulness in identifying unknown input patterns. A method of extracting pattern features from pixel data elements having values representing the pattern and stored in an input matrix having a height and a width, comprising the steps of: grouping together data elements from regions of the input matrix; and transforming groups of elements to provide output matrix elements representing a blurred version of the pattern and being suitable for further processing for pattern identification, characterised in that the output matrix elements include an input pattern aspect ratio parameter weighted according to its usefulness in identifying unknown input patterns. A method as claimed in claim 6 characterised in that the regions are evenly spaced across the width of the input matrix. A method as claimed in claim 6 or 7 characterised in that the regions are evenly spaced along the height of the input matrix. A method as claimed in claim 6, 7 or 8 characterised in that the regions are of equal size. A method as claimed in claim 6, 7, 8 or 9 characterised in that the regions overlap. A method as claimed in claim 6, 7, 8, 9 or 10 characterised in that the pixel data elements are in the form of binary data bytes and the values include black and white. A method as claimed in claim 11 characterised in that the binary data bytes represent optical characters. A method as claimed in claim 11 characterised in that the values include grey values, and the step of transforming comprises summing grey level values of data bytes in each region to provide elements for the output matrix. A method as claimed in claim 11 characterised in that the transforming step comprises summing the number of black pixel value data bytes in each region to provide elements for the output matrix. A method as claimed in claim 6 characterised by repeating the input matrix data elements a selected number of times, grouping the repeated data elements with adjacent repeated data elements, and summing elements within groups to provide elements of the output matrix forming a feature vector. A method as claimed in claim 15 characterised in that the summing comprises counting to determine which elements from the input matrix are to be added to which elements of the output matrix. A method as claimed in claim 16 characterised in that the summing comprises counting to determine which elements from each row of the input matrix are to be added to which of a first plurality of elements in a corresponding row of an intermediate matrix, and counting to determine which elements from each column of the intermediate matrix are to be added to which of a second plurality of elements in a corresponding column of an output matrix having a first plurality of columns and a second plurality of rows. A method of transforming an input pattern in the form of data elements in an input matrix of width M elements and height N elements into elements of a feature vector for an output matrix of width Q elements and height P elements, comprising the steps of: forming an intermediate matrix having a width MQ and height NP; filling the intermediate matrix with elements from the input matrix; and filling the output matrix with elements from the intermediate matrix, characterised in that the feature vector includes an input pattern aspect ratio parameter weighted according to its usefulness in identifying unknown input patterns. A method as claimed in claim 18 characterised in that the step of filling the intermediate matrix comprises entering each element from the input matrix into said intermediate matrix Q consecutive times in the horizontal direction and P consecutive times in the vertical direction. A method as claimed in claim 18 or 19 characterised in that Q equals 5 and P equals 8. A method as claimed in any of claims 15-20 characterised by the step of proportioning the aspect ratio parameter to the square root of (M/N) where M is the width in pixels, and N is the height in pixels, of the original input pattern matrix. A method as claimed in claim 21 characterised in that: the proportion is where KKHEIGHT is the number of vertical elements in the feature vector. A method as claimed in claims 15-22 characterised by the step of normalising the output matrix feature vectors. A method as claimed in claim 23 characterised by the step of normalising the feature vectors to be insensitive to the dimensions of the original pattern represented by the input matrix pixel data. A method as claimed in claim 23 characterised by the step of normalising the part of the feature vector derived from the transformation to a value of 256.

Inventors: ROSS DAVID JUSTIN, ROSS, DAVID JUSTIN
Applicants: PALANTIR CORP, THE PALANTIR CORPORATION
Application year: 1986
Main classification: G06K9
IPC codes: G06T7, G06K9