BACKGROUND OF THE INVENTION
This invention relates to a character reading system in which a character of low quality, portions of which are blurred or collapsed, can be read with high accuracy.
In a character reading system, one of the essential factors affecting the reading accuracy is the print quality of an input character. In the case of a printed character, a portion of the character line may be blurred, collapsed or malformed when the type surface is dirty, the printing pressure is unsatisfactory, or the ink ribbon is irregular in density. In the case of a hand-written character, the character line may be partially blurred, collapsed or malformed when the writing tool is unsatisfactory, the writing speed is variable, or the way the person writes characters is unacceptable. Especially when characters are written with a ball-point pen, because of the irregular rotation of the ball, the ink does not flow out smoothly, as a result of which the characters are frequently blurred.
As is apparent from the numeral "0" and the character "C" for instance, in order to read a character, it is most essential to determine how the character lines are separated or connected. Accordingly, the accuracy of reading a character, the character lines of which are blurred or collapsed as described above, is, in general, low.
In order to read a character of low quality, a character reading system has been proposed, as disclosed in IBM J. Res. Develop. 1975, p. 354-363 by M. R. Bartz, in which a threshold value is calculated from the average density level and average line width of a character pattern, and one-dimensional local contrast along the character scanning direction is utilized to convert the input character pattern into binary data, e.g., black and white picture elements. This system is quite effective in reading a printed character with noise formed by splashes of ink and a lower case character, the character lines of which are liable to collapse. However, since the system is provided mainly in order to improve the accuracy of reading printed characters, the system is not so effective in reading hand-written characters in which the density level and the line width are considerably variable.
In order to eliminate the drawbacks accompanying this system, two-dimensional local contrast has been utilized as disclosed in Pattern Recognition, Pergamon Press 1974, Vol. 6, p. 127-135, by J. R. Ullmann. More specifically, when the difference in density level between one picture element and picture elements near this picture element in a two-dimensional plane is larger than a predetermined threshold value, the picture element is regarded as a black picture element; and when the difference is not larger than the threshold value, the picture element is regarded as a white picture element. This system is effective in reading a character, the lines of which are relatively low in density or a portion of which is relatively high in density. However, the system is disadvantageous in that when the character line is partially irregular in density, a portion of the character line is determined to consist of white picture elements, or a light stain is considered as black picture elements.
In another known character reading system, as disclosed in British Pat. No. 1,263,467 to Watanabe, a threshold value of high density level and a threshold value of low density level are provided, and when a picture element is connected with a picture element which is determined to be a black picture element by binary-coding with the high threshold value, and is itself determined to be a black picture element using the low threshold value, it is determined to be a black picture element. This system is advantageous in that it can readily eliminate a localized noise element spaced from the character and it is effective in reading a character the lines of which are blurred. However, the system is disadvantageous in that it cannot eliminate a noise area connected to the character, and it is not effective in reading a character, a character line of which is collapsed. In this system, the setting of the low threshold value is difficult. If the low threshold value is increased, the system is not effective in reading a character having blurred line portions. If, on the other hand, the low threshold value is decreased, the system is not effective in reading characters having collapsed line portions. Especially in a character of low quality, the grey level of collapsed line portions is, in general, higher than that of blurred line portions, and accordingly, it is impossible for the system to correctly convert both these portions into black and white picture elements.
The above-described conventional systems each include at least one drawback. In common with these systems is that the fact that a character formed with character lines is not reflected at all or not sufficiently reflected. As was described above, character information is essentially transmitted by the connection and separation of character lines, and the widths of character lines are not essential in reading the character. Accordingly, a character reading system should determine blurred line portions as black picture elements and collapsed line portions as white picture elements, to thereby correctly detect the connection of the character lines. For this purpose, the system should utilize the fact that a character pattern, unlike an ordinary figure, is a special pattern made up of character lines.
SUMMARY OF THE INVENTION
In view of the foregoing, an object of this invention is to provide a character reading system in which, after a binary-coded character pattern obtained using a low threshold value is thinned under certain conditions, local processing is effected to determine whether or not a picture element is a part of the character line, whereby portions of the character line are positively detected and a character of low quality may be read with high accuracy.
In the character reading system according to the invention, a multi-level character pattern provided by scanning means adapted to scan a character and to subject the character thus scanned to photo-electric conversion is binary-coded into picture elements of "1" and "0" levels according to a first threshold value. A second threshold value higher than the first threshold value is set, and those picture elements of "1" level which have density levels lower than the second threshold value are subjected to thinning. Each of the picture elements of "1" level having density levels lower than the second threshold level are compared in contrast with the surrounding picture elements to determine whether the level of the picture element is to be maintained at "1" or changed to "0." Thus, the system according to the invention can accurately read a character of low quality in which the character lines are particularly blurred, unnecessarily connected or collapsed, or where noises such as stains are formed.
The nature, principle and utility of the invention will become more apparent from the following detailed description when read in conjunction with the accompanying drawings.
BRIEF DESCRIPTION OF THE DRAWINGS
In the accompany drawings:
FIG. 1 is an explanatory diagram showing one example of a character pattern to be read;
FIG. 2 is an explanatory diagram showing the character pattern expressed in multi-density-levels;
FIG. 3 is an explanatory diagram showing the character pattern binary-coded with a low threshold value;
FIG. 4 is an explanatory diagram showing the character pattern binary-coded with a high threshold value;
FIG. 5 is an explanatory diagram showing the character pattern subjected to thinning;
FIG. 6 is an explanatory diagram showing one example of a local processing mask;
FIG. 7 is a diagram showing one example of a function for obtaining contrast data;
FIG. 8 is an explanatory diagram showing the character pattern as finally provided;
FIG. 9 is a flow chart showing an operating procedure;
FIG. 10 is a flow chart showing the procedure of obtaining the average line width of a character; and
FIG. 11 is a block diagram showing a character reading device according to this invention.
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
FIG. 1 shows one example of a character pattern 2 of the numeral "8", which is hand-written on a recording medium 1 such as a piece of paper. In FIG. 1, reference characters 2a and 2b designate noise formed by dirt or dust on the recording medium 1. The noise 2a is on the character line, while the noise 2b is remote from the character line. The character pattern 2 is unsatisfactory in configuration and in print quality. The upper portion of the character pattern is blurred, and the loop-like lower portion is malformed and collapsed. It is considerably difficult for a conventional system to eliminate the noises 2a and 2b without cutting the blurred portion and without collapsing the loop portion. However, this character pattern is most suitable for clarifying the effects of this invention.
FIG. 2 is a multi-level character pattern 3 which is obtained by indicating the density levels of the character pattern 2 in sixteen (16) steps. The density levels are expressed by the hexa-decimal numbers "0" through "9" and "A" through "F". The highest density level is expressed by "F", and the lowest density level by "0." However, for clarity in illustration, "0" is replaced by blanks ("0" is not shown).
FIG. 3 shows a binary character pattern 4 obtained by binary-coding the multi-level character pattern 3 with a low threshold value THL. In this case, the value THL is two (2), the picture elements whose density levels are at the threshold value THL or higher are regarded as black picture elements, and the remaining picture elements are regarded as white picture elements. Hereinafter the black picture elements will be represented by the mark X and the while picture elements by blanks, unless otherwise specified. In the binary character pattern 4, the threshold value is low as described above. Accordingly, the blurred portion is not eliminated, the loop portion is collapsed and the noises 4a and 4b appear clearly.
FIG. 4 shows a binary character pattern 5 obtained by binary-coding the multi-level character pattern 3 with a high threshold value THH. In this case, the threshold value THH is 5, and the picture elements whose density levels are at the threshold value THH or higher are regarded as black picture elements, while the remaining picture elements are regarded as white picture elements. In the binary character pattern 5, the threshold value is high as described. Accordingly, the noise areas are eliminated, and the lower loop appears clearly; however, the blurred portion of the upper loop is cut.
FIG. 5 shows a thinned character portion 6 which is obtained by thinning the binary character pattern 4 according to a system proposed by the invention. The technique of thinning is well known by those skilled in the art, and can be realized by using a method such as proposed by E. S. Deutsch ("Thinning algorithms on rectangular, hexagonal, and triangular arrays", Communications of the ACM, Vol. 15, No. 9, pp. 827-837 (1972)). The object here is not to obtain a thinned pattern in which a line width corresponds to one picture element, but to eliminate noise with character lines nonetheless maintained connected. Therefore, the aforementioned thinning method is modified as follows:
(1) Only those black picture elements having density levels lower than the high threshold value THH, are removed.
(2) An end point holding condition is eliminated.
(3) A solitary point holding condition is also eliminated.
(4) Thinning is effected beginning with picture elements lowest in density level.
With respect to paragraph (4) above, the ridge of density level of a character line remains as black picture elements. Therefore, the points (x) of the thinned character pattern 6, which are change points for preventing deformation of the character configuration, are black picture elements, the density levels of which are smaller than the threshold value THH, the picture elements 6a in the blurred portion of the upper loop are not removed in order to maintain connection of the picture elements, and the picture elements 6b in the lower loop are maintained as black picture elements as they are in the character line. Since the end point holding condition and the solitary point holding condition are eliminated as described above, the two noises are removed. Thus, the object of this invention can be achieved by changing the black picture elements 6b in the lower loop into white picture elements. The black picture elements 6a and 6b are at a ridge and valley of density gradation, respectively. Therefore, whether these picture elements should be white picture elements or black picture elements can be most suitably determined by detecting the contrast of these picture elements to the surrounding picture elements. If the picture elements of the character pattern are classified into white picture elements and black picture elements merely by the utilization of contrast as described with respect to the prior art, various difficulties occurs, for instance, because of irregularities in density. However, these difficulties can be eliminated by limiting the picture elements to those at the ridges and valleys of density gradiation, and accordingly a considerably good effect can be expected.
FIG. 6 shows one example of a local processing mask for contrast detection. In FIG. 6, reference character X0 designates the central picture element, and X1 through X16, surrounding picture elements which are spaced by two squares from the central picture element X0. A variety of methods of obtaining values for contrast have been proposed in the art; however, in order to eliminate the effect of density irregularity, the following method will be employed in the invention by way of example.
A contrast C is represented by the following expression: ##EQU1## where x0 is the density level of the picture element x0, xi (i=1 to 16) is the density level of each of the picture elements X1 through X16, and α,β and γ are constants which are not negative.
The term min (αx0 +β, γ) is a function as shown in FIG. 7, and ##EQU2## is the number of picture elements which, among the picture elements X1 through X16, are higher in density level than the picture element X0. Therefore, the contrast C is small at a valley of density gradiation and high at the ridge. Thus, the picture element X0 will be made to remain black when the contrast C is higher than a predetermined value δ, and the picture element X0 will be converted into a white picture element in the other cases. The constants α, β, γ and δ are set to most suitable values through experiment on actual character patterns. The size of the local processing mask for determining contrasts, as shown in FIG. 6, is determined from an average character line width. For instance, the dimension of one side of the mask is the average character line width +2.
FIG. 8 shows a final character pattern obtained according to a method in which, with α=1, β=6, γ=9 and δ=4, the black picture elements 6a and 6b of the thinned character pattern 6 are subjected to black/white decision. The picture elements 6a are at the ridge of a density gradiation. Therefore, the contrast C is higher than six (6), and the picture elements 6a remain black. On the other hand, as the picture elements 6b are in the valley, the contrast C is lower than two (2), and the picture elements 6b are converted into white picture elements. Thus, in the final character pattern, the noise areas are eliminated, the blurred portion is maintained continuous, and the lower loop appears clearly. That is, the character pattern is remarkably improved in quality.
FIG. 9 is a flow chart provided from a programming viewpoint, to facilitate understanding of the above-described procedure.
In Step 20, a multi-level character pattern which is provided according to a method in which the character is scanned and subjected to photo-electric conversion is binary-coded with a low threshold value THL. In Step 21, a high threshold value THH is determined so that the average line width of the binary character pattern has a set value. In Step 22, the black picture elements having density levels lower than the high threshold value THH are thinned. In Step 23, it is determined whether or not there are black picture elements having density levels smaller than the high threshold value THH. If the result is "no", then the operation is ended. If the result is "yes", the acceptability of the black picture elements satisfying the above condition is decided by local processing as described above, and the operation is ended.
Most characters to be read are satisfactory in quality. Accordingly, a character pattern of satisfactory quality scarcely includes black picture elements having density levels lower than the high threshold value THH after being thinned. In this case, therefore, the local processing operation utilizing the contrast calculation can be eliminated, and the processing time may be reduced by as much.
Now, the selection of the two threshold values THL and THH will be described. According to the invention, the degree of freedom in determining the threshold values is large, and the threshold values can be relatively freely determined irrespective of character qualities, however, the low threshold value THL should be lower than the density level of a blurred portion of a character line, or higher than the density level of a recording medium which is clean. This value can be readily obtained through experiments on a suitable number of character patterns.
The high threshold value THH should be higher than the density level of a collapsed portion of a character line, or the density level of a contact point of two parallel lines, and should be selected such that no character line disappears. If the high threshold value is excessively high, the character pattern may be contracted to eliminate the character line because the end point holding condition is eliminated. An excellent method of determining the high threshold value THH is as follows: First, measure the average line width w of the binary character pattern 5 in FIG. 4, and then select the high threshold value THH so that the value w is closest to a predetermined average line width W, i.e., a set value W. That is, by varying the value THH, a threshold value THH is obtained by which the difference d between W and w, d=|W-w| is a minimum.
FIG. 10 is a flow chart provided from a programming view-point, showing the method of determining the threshold value. In Step 30, data d is set to a sufficiently large value. In Step 31, THH is employed instead of THL. In Step 32, binary-coding is effected using THH. In Step 33, the average line width w is measured. In Step 34, |W-w|≦d is determined. When the result of determination is "yes", then in Step 35 |W-w| is set to d, and in Step 36 (THH +1) is employed as THH and the operation is returned to Step 32. Thereafter, Steps 33 and 34 are carried out. If, in Step 34 the result of determination as to |W-w|≦d is "no", then in Step 37 (THH -1) is employed as THH, and the operation is ended. The method of measuring the average line width is well known to those skilled in the art, and can be realized, for instance, according to a method proposed by M. R. Bartz ("The IBM 1975 Optical Page Reader, Part II: Video Thresholding System", IBM Res. Develop, pp. 354-363 (1968)). In another example of a method of determining the high threshold value, the value THH is obtained from the average density v of the multi-level character pattern as shown in FIG. 2 as follows:
TH.sub.H =a·v-b
where a and b are constants, and v is defined by the following equation:
v=Vi/N
where Vi is the density level of a point whose density level is not "0", and N is the number of such points.
In FIG. 2, v=5.4. In this embodiment, a=1.5 and b=3. However, these values should be obtained through experiment, similarly as in the case of α, β, γ and δ.
FIG. 11 shows one example of the arrangement of an apparatus for practicing the above-described method according to the invention.
In FIG. 11, reference numeral 7 designates a scanning device; 8, a first memory device for storing a multi-level character pattern; 9, a binary-coding device; 10, a high threshold value determining device; 11, a second memory device for storing a binary character pattern; 12, a thinning device; 13, a third memory device for storing a thinned character pattern; 14, a local processing device; and 15, an identifying logic device for identifying characters. The scanning device 7 comprises a lamp, a lens and a semi-conductor optical sensor (not shown). The character pattern 2 on the recording medium 1 is converted into electrical signals proportional to the densities by the scanning device 7. The electrical signals are converted into digital signals in sixteen steps representing density levels, and are applied to the first memory device 8. In the binary-coding device 9, the multi-level character pattern 3 in the first memory device 8 is converted into a binary (white and black) character pattern with the low threshold value THL, and is applied to the second memory device 11. In the thinning device 12, the binary character pattern 4 in the second memory device 11 and the multi-level character pattern 3 in the first memory device 8 are used, and the black picture elements having density levels smaller than the high threshold value THH determined by the high threshold value determining device 10 are subjected to thinning, the result of which is delivered to the third memory device 13. Then, in the local processing device 14, with respect to the black picture elements of the thinned character pattern 6 in the third memory device 13 having density levels smaller than the threshold value THH, contrast data are obtained with reference to the multi-level character pattern in the first memory device 8, and the acceptability of the black picture elements is determined. The final character pattern obtained through the above-described procedure is identified by the identifying logic device 15.
In the above-described embodiment, individually operating means such as the binary-coding device, the thinning device and the local processing device are combined; however, the invention is not limited thereto or thereby. That is, a part of or all of the individual means may be replaced by a processing unit.
While the invention has been described with reference to hand-written characters, the technical concept of the invention may be applied to the case where printed or otherwise formed characters, or symbols similar to characters, are read.