Login| Sign Up| Help| Contact|

Patent Searching and Data


Title:
METHOD AND APPARATUS FOR CHARACTER EXTRACTION
Document Type and Number:
WIPO Patent Application WO/1987/003118
Kind Code:
A1
Abstract:
A method and apparatus for extracting character information from a signal matrix of gray level pixels, including an annular ring binarizer (30) and an adaptive post-thresholder (40). In the binarizer (30), pixels located in a pair of concentric annular rings (R5, R7) around a pixel of interest are compared to determine if a pair of relatively dark pixels occur in neighboring positions in the two annular rings (R5, R7) and if so determining the pixel of interest to be black. A binarized matrix (BI) formed in this manner is combined with the original gray level matrix to form an extracted matrix image (EI) which is used by the post-thresholder (40) to form a histogram. The histogram is analyzed to provide a post-threshold value for each document read, utilized to produce, from the extracted matrix image (EI), an improved two-level output image (PI).

Inventors:
MA HUNG S (CA)
Application Number:
PCT/US1986/002211
Publication Date:
May 21, 1987
Filing Date:
October 20, 1986
Export Citation:
Click for automatic bibliography generation   Help
Assignee:
NCR CO (US)
International Classes:
G06T5/20; G06V30/162; G06V30/10; (IPC1-7): G06K9/38; H04N1/40
Foreign References:
EP0055965A21982-07-14
US3715724A1973-02-06
US3737855A1973-06-05
Download PDF:
Claims:
CLAIMS :
1. A method of extracting character information from a signal matrix of gray level pixels, characterized by the steps of: extracting the signals representing the gray level pixels positioned approximately a first equal distance from a pixel of interest representing a first annular ring (R5) of pixels; extracting the signals representing the gray level pixels positioned approximately a second equal distance from the pixel of interest representing a second annular ring (R7) of pixels; analyzing the extracted signals representing the first and the second annular rings (R5, R7) of pixels for neighboring pairs of pixels one from each of said annular rings (R5, R7); establishing the pixel of interest to be of a first binary value when at least one such neighboring pair of pixels is found and of a second binary value when such neighboring pair of pixels is not found; and repeating the foregoing steps for each pixel of interest to form a signal matrix of binarized pixels based on the signal matrix of gray level pixels so as to facilitate the extraction of character information from said signal matrix of gray level pixels.
2. A method according to claim 1, characterized in that said like neighboring pairs of pixels are determined by determining, for each of said first and second annular rings (R5, R7) of gray level pixels, the location of valleys formed by gray level pixels having values below respective first and second ring threshold values (t 5, T 7), and determining for each valley pixel in said first annular ring whether a neighboring valley pixel exists in the second annular ring.
3. A method according to claim 2, characterized by the steps of: forming an extracted gray level matrix image (El) by combining said signal matrix of gray level pixels with said matrix of binarized pixels; utilizing said extracted gray level matrix image (El) to form a histogram of the gray levels in said extracted gray level matrix image (ΞI), utilizing said histogram to determine a postthreshold value (Tp), and utilizing said postthreshold value (Tp) as a threshold for converting said extracted gray level matrix image (El) to a twolevel post thresholded image (PI).
4. A method according to claim 3, characterized by the steps of determining said first and second ring threshold values (t 5, t 7) in dependence on average, maximum and minimum gray level values for the respective first and second annular rings (R5, R7).
5. A method according to claim 4, characterized in that said postthreshold value (Tp) is determining by locating, in said histogram, first and second histogram valleys conforming to predetermined criteria, and utilizing the minimum gray level value within said second histogram valley as said postthreshold value (Tp) .
6. Apparatus for processing a matrix of gray level pixels, characterized by annular ring binarizer means (30) having analyzing means adapted to receive gray level signals representing gray level pixels located in first and second concentric annular rings (R5, R7) centered about a pixel of interest and to determine the existence of like neighboring pixels one from each of said first and second rings (R5, R7) and pixel control means adapted to establish the pixel of interest to be of a first binary values when there is at least one such neighboring pair of pixels one in each of said first and second annular rings (R5, R7) and to establish the pixel of interest to be of a second binary value if no such pair of like neighboring pixels exists.
7. Apparatus according to claim 6, including averaging means (17) adapted to provide an average gray signal representing the average value of the gray level signals in each of said first and second annular rings (R5, R7), detection means (19) adapted to detect the maximum and minimum values of the gray level signals in each of said first and second annular rings (R5, R7), and processing means (21, 23, 25) adapted to determine respective ring threshold levels ( 5, R7) for said first and second annular rings in dependence on said average, maximum and minimum values of the respective gray level signals in the respective one of said first and second annular rings (R5, R7).
8. Apparatus according to claim 7, characterized in that said averaging means includes an adder (31) for receiving on a first input the gray level signals representing the first annular ring pixels and for receiving on a second input a previous sum signal and for adding the two together to provide at its output a present sum signal; a latch (37) for receiving the present sum signal from the output of said adder (31) to provide at its output said previous sum signal; feedback means for coupling the previous sum signal from said latch (37) back to the second input of said adder (31); and a divider (43) responsive to the summing of the last gray level signal in the first annular ring for dividing the summed signal by the number of gray level signals considered to arrive at an average gray level signal value.
9. Apparatus according to claim 8, characterized in that said divider is an addressable storage element (43) the addresses of which correspond to gray values and the stored data of which corresponds to the address gray value divided by a preselected value to provide said average gray level signal.
10. Apparatus according to claim 6, characterized in that detection means (19) includes: a register (36) for receiving and temporarily storing each of the received gray signals representing the pixels in said annular rings (R5, R7) first comparator means (32) coupled to said register (36) for comparing the value of the gray level signal presently stored in said register (36) against a previously compared gray value to determine which is less in value, the lesser value gray level signal being provided as a minimum gray level value at the output of said first comparator means (32); and second comparator means (34) coupled to said register (36) for comparing the value of the gray level signal presently stored in said register (36) against a previously compared gray value to determine which is greater in value, the greater value gray level signal being provided as a maximum gray level value at the output of said second comparator means (34).
Description:
METHOD AND APPARATUS FOR CHARACTER EXTRACTION

Technical Field

This invention relates to a method of extracting character information from a signal matrix of gray level pixels.

The invention also relates to apparatus for processing a matrix of gray level pixels.

The invention has a particular application to the field of automatic document scanners/readers, such as check processing apparatus.

Background Art

When a document such as a check is scanned for relevant character information, the scanner has difficulty in determining whether changes in reflectivity are caused by character information, noise, and/or scenic background. Various types of systems using noise filters and extraction algorithms attempt to -separate the character information from such unwanted signals.

Disclosure of the Invention

It is an object of the present invention to provide a method of efficiently extracting character information from background information.

Therefore, according to the present invention, there is provided a method of extracting character information from a signal matrix of gray level pixels, characterized by the steps of: extracting the signals representing the gray level pixels positioned approximately a first equal distance from a pixel of interest representing a first annular ring of pixels extracting the signals representing the gray level pixels positioned approximately a second equal distance from the pixel of interest representing a second annular ring of pixels; analyzing the

extracted signals representing the first and the second annular rings of pixels for like neighboring pairs of pixels one from each of said annular rings; establishing the pixel of interest to be of a first binary value when at least one such neighboring pair of pixels is found and of a second binary value when such neighboring pair of pixels is not found; and repeating the foregoing steps for each pixel of interest to form a signal matrix of binarized pixels based on the signal matrix of gray level pixels so as to facilitate the extraction of character information from said signal matrix of gray level pixels.

It will be appreciated that a method according to the invention has the advantage of eliminating undesired background information without undue degradation of the desired character information.

According to another aspect of the invention, there is provided apparatus for processing a matrix of gray level pixels, characterized by annular ring binarizer means having analyzing means adapted to receive gray level signals representing gray level pixels located in first and second concentric annular rings centered about a pixel of interest and to determine the existence of like neighboring pixels one from each of said first and second annular rings, and pixel control means adapted to establish the pixel of interest to be of a first binary value when there is at least one such neighboring pair of pixels one in each of said first and second annular rings and to establish the pixel of interest to be of a second binary value if no such pair of like neighboring pixels exists.

According to a further embodiment of the invention, the binary signal matrix is combined with the original gray level pixel matrix to provide an

extracted matrix image which is used to form a histogram. The histogram is analyzed to adaptively provide a post-threshold value, utilized to produce, from the extracted matrix image, an improved binary matrix image. This has the advantage that, in application to document processing, thresholding is adaptively suited to the particular document being processed, rather than being at a fixed level for all such documents. It will be appreciated that this achieves a still further improvement in extracting character information from background information.

Brief Description of the Drawing

One embodiment of the present invention will now be described by way of example with reference to the accompanying drawings, in which:

Fig. 1(a) through Fig. 1(d) illustrate some topologies of a character line.

Fig. 2 illustrates annular rings intersecting sections of a character line.

Fig. 3 illustrates a matrix of pixels with discrete annular rings comprised of numbered pixels located around a central pixel.

Fig. 4 is a normalized histogram of a scanned image in gray level.

Fig. 5 is a normalized histogram with the brighter gray levels extracted.

Fig. 6 is a chart illustrating an example of peaks and valleys for the gray level values of pixels adjacently positioned around an annular ring.

Fig. 7 is a chart illustrating positional identification of peaks and valleys occurring with respect to a defined threshold value.

Figs. 8A and 8B together form a look up table of neighborhood pixel elements of two consecutive rings.

Fig. 9 is a block diagram of the preferred embodiment of the invention.

Fig. 10 is a more detailed block diagram of the preferred embodiment illustrated in Fig. 9.

Fig. 11 is a detailed block diagram of an averager used in the Fig. 10 embodiment.

Fig. 12 is a detailed block diagram of a min- ax detector used in the Fig. 10 embodiment.

Fig. 13A through 13D illustrate in flow chart form the operation of the annular ring binarizer.

Fig. 14A through 14C illustrate in flow chart form a subroutine used in the preferred embodiment.

Fig. 15A through 15C illustrate in flow chart form the operation of the adaptive post-thresholding.

Best Mode for Carrying Out the Invention

The preferred system operates upon a gray level image that is 512 pixels by 640 pixels in area. In picking the area size of the gray level image consideration was given to the physical size of a typical bank check such that the right-half portion of the check would be covered. The right-half portion of the check carries most, if not all, of the information of interest for data processing.

Referring to Figs. 1(a) through 1(d), four simple geometrical configurations of a portion of a character line 10 are illustrated. Each character line 10, when scanned at a radius r from a central pixel P, will evidence the existence of at least one line segment 11 positioned a distance from the central pixel P. The following topological features are observed:

In Fig.1(a) there is at least one line segment 11 located r units away from the central character pixel P on the line 10. The line 10 terminates on the right side prior to reaching a length equal to or

greater than r, therefore only one line segment 11 will be detected. The average gray level in the line 11 is approximately equal to the gray level of the central pixel P. The gray level is depicted by the hashed lines. Any short character line or noise patch which is smaller than r units from the central character pixel will not be registered.

In Fig.1(b) the line 10 is longer than 2r and therefor two line segments 11, having the same gray level will be detected.

In Fig.1(c) The character line 10 changes angle but the line segments have the same gray level.

In Fig.1(d) a character line 10 having multiple legs is shown having three line segments 11 positioned a distance r from the central pixel P.

In order to detect character lines with all possible orientations (at different angles) with respect to a central character pixel P, an analysis is performed on the gray levels of those pixels positioned along paths equivalent to concentric annular rings that center on the character pixel P. Each annular ring is 1 pixel in width and defines a discrete domain in which the analysis of line segments is performed.

In Fig. 2, an example of two concentric annular ring paths, centered around pixel P at radii ri and r2, is shown. As can be seen in Fig. 2, the gray level of the character line 10 is substantially constant along its length, and different, as compared to the surrounding area. The line segments 11 (pixels) will thus all be of the same gray level along the length of the character line. Considering the

pixels that would be in the paths defined by the annular rings, there will be two identical pairs (neighbors) of line segments 11 having the same gray level. All other pixels on the annular paths may have a different gray level from that of the pairs of line segments.

An example of annular ring consideration of pixels positioned in a matrix form is shown in Fig. 3. The matrix of 15 x 15 pixels has a central pixel P as shown. Each pixel may have a gray value of 0 through 255 dependent on its lightness or darkness. The 256 levels are electronically determined by optically scanning a document to derive an analog signal the levels of which range between an assigned threshold value equal to pure black, 0, and an assigned threshold value equal to pure white, 255. A threshold detector having 255 discrete threshold levels compares the input signals, one pixel at at time against the assigned thresholds and provides a gray level output indicative of the particular amplitude of the analog signal. The provided output is a function of one of the 256 available gray levels and corresponds to the average gray value within that pixel. The sampling density which determines the size of each pixel, in the preferred embodiment, was 315 pixels per inch (about 125 pixels per centimeter) horizontally and 315 pixels per inch (about 125 pixels per centimeter) vertically.

In the preferred embodiment of the invention the pixels that are of interest are those which are positioned in the matrix at the end of radii extending outward to discrete annular rings, located at 5 pixel units (R5) and 7 pixel units (R7) from the central pixel P. The number shown with each pixel corresponds to the physical position of the pixel in the annular ring and not to the pixel's gray level. The first positions 1 commence at the 3 o'clock position, from

central pixel P, and increase by a unit count, in the counterclockwise direction. A string of pixels for a ring, for example, ring R7, would consecutively include the pixels numbered 1 through 56 that appear 7 pixel units from the central pixel P.

Changing gray level signals to binary signals, either a zero (0) or a one, (1), can be accomplished by setting a threshold value, corresponding to a particular gray level, and by comparing the gray level of a pixel against the set threshold value it can be determined if the gray level of the pixel is above or below the threshold. If above, the pixel can be denoted (established) as being white and a zero (0). If below, the pixel can be denoted as being black and a one (1). However, in the present system, topological features are used to binarize pixel gray levels, i.e., a pixel P is deemed black (denoted a 1-pixel) if there is at least one pair of neighboring line segments that is found in two consecutive annular rings with radius r_ and t 2 r centered at P. If a pixel is not denoted as a 1 it is denoted as a 0 and is deemed white, the aforementioned will be referred to as the "neighborhood rule".

A binarizer, based on the annular ring topological features of pixels, provides a binarized output which has a great percentage of the character pixels in the scanned area binarized to be 1-pixels and a great percentage of the background pixels in the scanned area binarized to be 0-pixels. This intrinsic property of the binarizer suggests that a gray level histogram, generated from the gray level for only those pixels with a corresponding 1-pixel in the binarized image, will provide more informative information about the actual gray level distribution of the character pixels than will a gray level histogram of the entire image. A histogram reflects the frequency of occurrence of pixels of like gray levels for the area scanned.

In Fig. 4 there is shown a histogram wherein the occurrence of pixels having gray levels between 0 and 255 for a document such as a check is plotted. To be noted is that the occurrence of the bright pixels far outweighs the occurrence of the darker pixels. We know that the darker pixels correspond more to the information about the character, therefore, by ignoring those pixels having a gray value above a particular threshold and amplifying (normalizing) the remaining occurrences, the histogram of Fig. 5 can be derived. The darker gray levels now show the greater frequency of occurrence. Further filtering is obtained in the present system by eliminating those 1- pixels which are falsely generated by the binarizer. This is accomplished by detecting the minimum point within the second major valley of the histogram curve of Fig. 5 (the first major valley occurs in the area containing the 0 occurrence of g) and by establishing an adaptive post threshold value, Tp, at. this point and eliminating from consideration all pixels having a value above the established threshold. The remaining signals will be a more informative group of signals for data processing purposes.

Thus far it can be seen that the present system operates upon gray level signals by utilizing an annular ring binarizer ARB, which binarizes the gray coded signals as a function of the geometrical distribution of character pixels and then through an adaptive post thresholder, APT, establishes a threshold, Tp, which is adapted to the histogram of the extracted gray image to eliminate those pixels having a high probability of being specious.

The following defined terms will be useful in understanding the system to be described: APT = Adaptive * post thresholder ARB = Annular ring binarizer BI(X,Y) = Binarized image (two-level image)

EI(X, Υ) Extracted image gray level

(multi-level image) g(x,ϊ) Original gray level image

(0,1,2,...254,256)

PI(Xι -ϊ ) Post thresholded image (two-level image)

Tp = Post threshold value

R K = An annular ring centered at (i,j), where l,j = a running index with vertical coordinates, i, and horizontal coordinates, j. Four concentric and discrete annular rings R]_, 3, R5, and

R7, with a central pixel P, are shown in

Fig. 3. SK = Set of pixels forming an annular ring

RR, centered at (i,j), and further defined as:

{(m,n) \fk-Λr<J( -i) 2 + n-j) 2 % < (k+A )} GRK = A vector of the gray levels of the labeled pixels in ring RR (see Fig. 3).

Hence, for rings R]_, R3, R5, and R7, the gray level vectors are defined as:

G R1 ={gRl )' 9Rl(2), ..., 9R1(8)}

GR3 ={gR3d)' 9R3(2), ; ' 9R3(24)}

GR5 ={gR5 (1 )' 9R5 ( 2 ) ' •• ' g 5(40)}

GR7 ={gR7d ) ' 9 7 ( 2 ) ' ' R7(56)} respectively. g = The weighted average gray level of the central pixel P and is further defined as:

" ip " = l/2g p + l/8[g R1 (l) + g Ri (3) +

9Rl(5) + 9Rl(7)]

" ^K = Tn ^ average gray levels of annular rings

R3, R5 and R7 and is further defined as:

24 R3 = 1/24 ^T g R 3(i) i=l

i=l

56 g " R 7 = 1/56 < _ g R 7(i) i=l

gRK = The minimum gray levels in rings R3, R5 and R7 and is further defined as: gR3 = gR3 ( ) ; R3 ( ) < R3 ( i ) i = 1, ..., 24 i t j gR5 = gR5 ( ) ~ 9R5 ( ) 1 gRS* 1) i = 1, ..., 40

' + gR7 = 9R7 ( .J ) . 9R7 ( J ) < Rji^ i = 1, ..., 56

gRK = Tne maximum gray levels in rings 3, R5 and R7 and is further defined as: gR3 = 9R3 ( 3 ) ' 9R3 ( 3 ) .9R3<i ) i = 1, ..., 24 i A j R5 = 9R5(3 ) ' 9R5 ( ) .9 5(i) i = 1, ..., 40 i t j

9R7 = 9R7 ( ) ~ 9R7 ( J ) >.9R7 ( i ) i = 1, ..., 56 i j- j V K(J) ~ A valley in the gray level vector GRK which is further defined as the jth connected set of pixels in Rg, for

which their gray levels are smaller than a certain threshold value t (See Fig. 6). The position, width and lowest gray level of the valley is denoted as VRK ( )> w RxO) and RK ( D ) ' respectively.

P RK(^) = Is a peak in the gray level vector GRR and is further defined as the ith connected set of pixels in RR, for which their gray levels are greater than a certain threshold value t. (See Fig. 6). The position, width and highest gray level of the peak is denoted as θ K(i)' w RK(i) and gRK( i ) respectively. neighbor = A line segment found in annular ring R is the neighbor of a line segment found in annular ring Rκ-2' if and only if, there is a pixel in the line segment in RK that is a neighbor of a pixel in the line segment in RR-2 * τ ^ e neighborhood relationship of pixels for rings R7 to R5, and R5 to R3, are tabulated in the Table of Figs. 8A and 8B. ^κ = Threshold of ring RK.

KRK = Relative brightness of ring RK. g v = Average gray value of neighboring valleys. t]_, and t2 = Light and dark pixel control parameters which are subjectively chosen to have a value of 20.

H s (i) = Smoothed histogram.

H e (i) = Extracted image histogram.

Referring to the chart of Fig. 6, the horizontal axis of the chart corresponds to the location, i, of a pixel in a ring RR. The vertical axis corresponds to the gray level value g^j((i) of each of the pixels in the ring.

For the example shown, the gray level values form three valleys, VRR, and three peaks, PRK* τ ^ e threshold level, t, determines the value of the gray level below which a valley is established or above which a peak is established. Using the chart of Fig. 6 the table of Fig. 7 can be generated. The table is generated by looking for the start position of the valleys RK(J)« The chart of Fig. 6 reveals by inspection that the valleys start at pixel positions 3, 8, and 13. The peaks, Q K(Ϊ start at pixel positions 1, 5 and 11. The width of the valleys and the peaks correspond to the number of consecutive pixels having a gray level value below or above the threshold, t, respectively. The lowest and the highest gray level value g^ i.) and gRκ(J) pixels for each group of valleys and peaks can be easily discerned by inspection of the chart of Fig. 6.

Referring to the neighborhood look up table of Figs. 8A- and 8B, the table establishes the neighbor pairs for consecutive rings, R7 and R5, and R5 and R3. The table was generated from the pixel matrix shown in Fig. 3. The outermost ring of Fig. 3 is R7. Comparing some R7 pixels to find their neighbors in the R5 ring we find that R7 pixels 27 and 28 each have the neighbor pixel 20 in ring R5 and that the pixel 20 in R5 is a neighbor to the pixel 12 in R3. The table is used to establish if there is compliance with the neighborhood rule, i.e., a pixel P is deemed black if there is at least one pair of neighboring line segments that is found in two consecutive annular rings with radius ri and X2 ' centered at P.

Referring to Fig. 9 the adaptive character extraction system is shown comprised of two major elements an annular ring binarizer, (ARB), 30 and an adaptive post-thresholder (APT) 40. The ARB, 30, receives an analog gray signal g(x,y) and provides at its output a binarized image signal BI(x,y). The

analog gray signal can be derived from a scanner (front-end stage) of the type described in U.S. Patent No. 4,523,231 entitled, "Method and System for Automatically Detecting Camera Picture Element Failure" by R. H. Therrien, which patent is assigned to NCR Canada Ltd-NCR Canada Ltee. The g(x,y) signal may be taken from the output of the ADC 27 shown in Fig. 1. Other types of scanners may also be used with the present invention. A multiplier 35 receives as inputs the signals g(x,y) and BI(x,y) and generates by multiplication (essentially a masking process) an extracted gray level image signal EI(x,y). The APT 40 is comprised of, a histogram analyzer 20 which receives as an input the signal EI(x,y) and which provides as an output a threshold signal Tp, and a comparator 50 which receives the output signal, Tp, from the histogram analyzer 20 and the output signal from an extracted image memory 60. The comparator 50 functions to compare the extracted image with the threshold Tp, and eliminates that portion of the extracted image which is above the threshold to provide at its output a post threshold image signal PI(x,y). The histogram analyzer 20 operates to accumulate the histogram. El, and generates from the histogram the adaptive post threshold value, Tp. The extracted image memory 60 operates to receive and store input signal EI(x,y) until it is to be compared within the comparator.

Referring now to Fig. 10, the annular ring binarizer 30 is comprised of an M68000 based microcomputer 21, hereinafter called computer A. Memory is provided by an 8K x 8 EPROM 23 and a 4K x 8 RAM 25, each connected by an 8 conductor bus to computer A. Input lines for carrying, clock, gray level for ring and central pixels, flag, and TR signals are coupled to the inputs to computer A. An averager circuit 17 (detailed in Fig. 11) receives as

inputs the signals, CLK, TR7, and the gray level image levels for ring R 7 , {{gR7(l) , ... , gR7(56)}, and provides as an output, to computer A, the averaged signal g * 7. A mini-max detector 19 (detailed in Fig.

12) receives the same input signals as the averager 17

4- and provides, as outputs the max and in signals, q--η and § 7, respectively, to the computer A. The computer A operates upon these signals to provide the output signal EI(x,y) to the input of the adaptive post-thresholder 40 and to the input of the extracted image memory 60.

The APT 40 is comprised of, an M6800 based microcomputer 27, hereinafter called computer B, and associated memory which is provided by an 8K x 8 EPROM 29 and a 4K x 8 RAM 31. EPROM 29 and RAM 31 communicate with the computer B over an 8-bit bus. The extracted image memory 60 is a 50K x 8 RAM. The memory 60 interacts with the computer B over an 8-bit bus. The output from computer B, is the signal PI(X,Y) appearing on an 8-bit output bus. An 8-bit control bus interfaces computer A with computer B to pass control signals therebetween to control the operation of the two computers in a manner well known to those persons skilled in the art. Computer B also provides control signals to peripheral devices (not shown) on a 5-bit control bus.

In operation, the gray level pixel data, (g R 7(l), g R 7(2),..., gR7(56)}, of annular ring R7, referenced to the central pixel P, are transferred serially (8 bits at a time) to the averager 17, the mini-max detector 19, and the computer A when the data transfer control line signal TR7 is high. In a similar fashion, the gray level pixel data, {g 5(l), 9R5( ),..., gR5(40)} of annular ring R5 are transferred serially to the computer A when the data transfer control line signal TRS is high.

Referring to Fig. 11 within the averager 17 there is a sequential 16-bit adder 31 and a 16 bit latch 37 which operate to continually sum the gray level pixel data (gR7(l), 9R7(2),..., g R7 (56)} as they are serially transferred 8-bits at a time. The summing operation is synchronized to the positive leading edge of the clock signal CLK. The clock signal, CLK, is gated to the latch 37 by an AND gate 33 under gating control of the signal TR7. At the completion of their transfer, the accumulated sum is then divided by 56 in a ROM Table 43 to form the average gray level value g~ R 7 of annular ring R7, which value will then be fed, as an input, to the Micro- Computer A for further processing. A monostable multivibrator 39 and a delay circuit 41 operate to delay (hold) the last sum at the outputs of the latch 37 until the ROM Table 43 is enabled, by the signal RENB from the multivibrator 39, and is able to address or load the outputs from the latch 37.

The 16-bit adder 31 is comprised of four cascaded 4 bit adders each having the industry part no. SN54LS283 or its equivalent. As is well known, each adder has two banks of four inputs each. Two of the adders have one bank of four inputs connected to the 8-bit bus carrying the signals, (g R 7(l) , .... ,g R 7(56)}. Each signal may have a gray value of from 0 to 255. An 8-bit line provides the capability of communicating 2 8 or 256 binary values. The other bank of inputs, for each of the four 4-bit adder are connected to receive the outputs from the 16-bit latch 37. The highest sum that the address 31 will ever have to handle is 56 pixels each having a gray level of 255 (with 0 counting as 1 the max gray level would be 255). The maximum count that adder 31 would have to handle would thus be 56 x 256 = 14,336. A fourteen bit line system can handle a count of 2 14 = 16,384 which exceeds the maximum actual count by

approximately 2,000. A fourteen bit adder and latch are therefore more than adequate to implement the invention. The 16-bit latch 37, which may be an SN54S281 or its equivalent, in operation latches the fourteen bit count from adder 31 and makes the output available on its fourteen output lines labeled A Q - A13. The ROM 43, which may be an Intel 3528A, is addressed at one address corresponding to the added value of (g R 7(l) , . • .. , gR7(56)} which as previously stated may have a value between 0 and 14,336. The ROM is programmed such that at each address in memory there is stored a value which is the address number divided by 56. This effectively performs a division function. The number 56 is chosen because, the maximum count 14,336 when divided by 56 results in a maximum value of 256 which is, 2 , and which may be communicated over an 8-bit bus. The 8-bit output value g " R 7 from the ROM 43 is directed to an input to the computer A.

Referring to Fig. 12 two feedback comparator stages in the mini-max detector 19 (the first comprised of an 8-bit comparator 32, an 8-bit register 38 and a 2 to 1 selector 42, and the second comprised of an 8-bit comparator 34, an 8-bit register 46 and a 2 to 1 selector 44) operate simultaneously on the serially incoming gray level pixel data (g R 7(l),..., g R 7(56)} to determine the minimum gray level pixel value g R 7 and the maximum gray level pixel value g R 7 in annular ring R7. The resultant minimum gray level pixel value and the maximum gray level value are then fed to micro-computer A.

In operation, the 8-bit register 36 buffers, in turn, each of the values g R 7(i) to comparator 32 and 34 and to the O-_ and the D2 input of the 2-to-l selectors 42 and 44 respectively. Each comparator compares the signals on its B labeled input against the signals on its A labeled input. Comparator 32 is

looking for the lowest gray level value therefore it is questioning whether the value on its B input is less than the value on its A input. If so, it selects the B input value (O input) through selector 42 and passes that gray level value to register 38 to be stored therein as the minimum gray level signal so far. If not, it selects the A value (D2 input) and passes the value back to the input of register 38 wherein it will again appear on the A input of comparator 32 ready for the next comparison. At the end of examining 56 pixel gray levels, for ring R7, the detector will make available, at the output of register 38, the lowest value found, which is g- \ .

Operating in a similar manner comparator 34 is questioning whether the gray level value on its B labeled input is greater than the gray level value on its A labeled input. If so, the selector 44 selects the signal on its D2 input and passes the signal to register 46 replacing any previous maximum signal that may be in register 46. If the gray level value on the B input is not greater than the gray level value on the A input the comparator so indicates and selector 44 selects the D]_ input and directs that input to be re-stored in register 46 as the maximum gray level value g R found so far. At the end of comparing 56 values for Ring R7 the maximum and the minimum values will be available at the terminals labeled g R 7 and q-Rj . The AND gate 48 controls the clocking of the various blocks under gating control of the signal T R 7. In the preferred embodiment of the invention the eight bit registers 36, 38 and 46 were formed from SN74100 devices, the 2 to 1 selectors 42 and 44 were formed from quad 2 port register SN54LS298 devices, and the 8-bit comparators 32 and 34 were formed from SN54LS85 devices.

Operating in a synchronous manner, the micro¬ computer A will execute the following procedures

immediately after the average gray level g " R 7, the minimum gray level g R 7, and the maximum gray level value -g/- R 7 of annular ring R7 are available.

Procedure 1: If (g p > g 7 - 20) or

(g 7 > g 7 - 20) then go to Procedure 6 otherwise go to procedure 2

Procedure 2: Determine the relative brightness factor K R 7 of annular ring R7 as; K R7 = 100 x (g R7 - 9P7) e R7 gR7

Determine the ring threshold t 7 of annular ring R7 as 30

go to Procedure 3

Procedure 3: Determine;

(a) the start positions (Q R s(i)} and

(QR7( )>

(b) the widths (W R5 (i)} and {W R7 (j)} of all the valleys {v R s(i)} and (V R 7(j)} of annular rings R5 and R7 respectively, go to Procedure 4.

Procedure 4 Eliminate all the intervals in (l R 7(j)} for;

(a) those whose widths are larger than 26, or

(b) those that do not have a neighboring interval in R5 according to the Neighborhood rule (see the look-up table of (Fig. 8) .

The number of the remaining valleys (denoted here as N) which pass tests (a)

and (b) are designated as the number of valid pairs of line segments (or valleys). Next, the average gray level (denoted here as g v ) of the valid pairs of neighboring line segments is determined, go to Procedure 5

Procedure 5 If N = 0, or g p > ~ g v + 20, then go to Procedure 6 else the gray level value of the central pixel P now in the extracted image (El) is taken as EI(P) = g p go to Procedure 7

Procedure 6: The gray level value of the central pixel P now in the extracted image (El) is taken as EI(P) = 255 go to Procedure 7

Procedure 7: Transfer the extracted gray level pixel value EI(P) to micro-computer B and to the extracted image memory 60 for the next stage of processing.

If the data transfer control line T R 7 is low, then wait, else P = P +1 and go to Procedure 1 for micro-computer B

Operating in synchronism with micro-computer A, micro-computer B reads in each EI(P) and generates a gray level histogram H(k), k =0,1,... ,255 of the extracted image El. At the end of the complete transfer of El, micro-computer B is flagged by micro¬ computer A to>perform the following (adaptive post- thresholding) :

Procedure 1: Smooth the gray level histogram H(k), k=0,l, ... ,255 and obtain

H s (i) = =(H(i) + <(H(i-2) + H(i-l) +

H(i+1) + H(i+2) ) i = 3,4, ... ,252 and H s (l) = H(l), H a (2) = H(2), H s (3) =

H(3), H s (253) = H(253), H s (254) = H(254),

H s (255)= H(255), Set the initial threshold, t = 75

Procedure 2: Threshold the smoothed histogram H s (i) with the threshold value t, and obtain f V Λ the positions lQw s (J)/ QH S ^ 1 )) and ttιe widths {w Hs (i) W Hs (J)} of all the intervals. Look for a second pair of a major valley and peak with the following test:

W »rHsCJ ) 10 2<j and

^Hs ( i ) 10 J 1 If the test succeeds, then go to

Procedure 3 otherwise adjust the threshold, t = t-5. If t l5, then go to

Procedure 2 else set the adaptive post threshold value

Tp=250 and go to Procedure 4

Procedure 4: Generate the post threshold image from the extracted image stored in the extracted image memory as;

0 , El (x,y) > T p Pi( χ ,y) =

1 , El (x,y) < p

The general procedures that have been set forth are carried out by the micro-computer following the specific flow charts and the associated descriptions to follow:

Referring to the annular ring binarizer flow chart of Figs. 13A through 13D, in block 100 the annular ring binarizer (ARB) 30 is receiving the individual pixel gray values for the ring R7 and is computing the average gray value g " 7 of ring R7, the

f maximum gray level g R 7, and the minimum gray level -r g R 7- The ARB is also monitoring for the negative transition edge of the signal TR7. upon the occurrence of the negative transition of TR7 the program will move to block 102. Block 102 questions whether the gray level of the central pixel P is greater than the ring average gray level g R 7 minus 20.

If the answer is "yes" then the program moves to block

124. If the answer is "no" the program moves to block

103. Block 103 questions whether the minimum gray ring average g 7 is greater than the ring average gray level g " 7 by 20? If the answer is "yes" the program goes to block 124. If the answer is "no" the program goes to block 104. The value 20, of blocks 102 and

103, is a selected gray level difference in relation to contrast. Assuming that the answer is "no", block

104 will calculate the relative brightness factor K R 7.

The relative brightness is a comparison of the average valve against the total range of brightness within the ring R7.

In block 105 the percentage magnitude of K R 7 is compared against the percentage 30. If the value of K R 7 is greater than 30 the program moves to block

106. If the value of K 7 is less than 30 the program moves to block 107, where the value t 7 is established as the value g^7 + 20. If the program moved to block

106 the value of t R 7 is made equal to the minimum gray level g R 7 + 20 plus a noise compensated factor. With the value t 7 computed the program moves to block 108 to determine the positions widths, and minimum gray levels of each valley. At this point the subroutine

VDETECT is activated. The subroutine VDETΞCT is set

forth in Figs. 14A through 14C and will be described later in this specification. When the values called for in block 108 have been computed the program increments to block 109 wherein the aforementioned items are computed for the valleys in R5 and the subroutine VDETECT is again called.

In block 110, the number of line pairs N is set to zero and in block 111 the value CNT7, corresponding to the pixel positions in ring R7, is set to 1. The program will then move to block 112 where the question, Is the width of the current valley in R 7 greater than the half-ring width (the half-ring width for R7 is 26)? If the answer is "yes" the program jumps to block 119. If the answer is "no" it means that the width of the valley is equivalent to a line width that is actually smaller than 26 and the program moves to block 113 and sets the pixel position count PCN7 in ring R7 equal to Q 7 (CNT7). To accomplish this the program sets CNT7, the pixel position counter, equal to the starting position count of the current valley then PCN7E is set equal to the ending position of the current valley by adding the width of the current valley to the starting position count. The program then moves to block 114 and by use of the look-up table of Fig. 8 determines the neighboring pixel in R5 corresponding to the current valley pixel in R7.

The program moves to block 115 to question whether the neighboring pixel is in a valley in R5. If the answer is "no" the program moves to block 116, If the answer is "yes" the program moves to block 118. With a "no" answer the pixel positional counter PCN7 will be incremented by 1 and move to the next pixel in the valley. At this point the program checks, through block 117, to see if the PCN7 has exceeded the width of the current valley. If it has then testing on the current valley is then terminated and the program

moves to the next valley and block 119. If the answer is "no" the program goes back to block 114 and looks through the look-up table for the neighbor position corresponding to the present position in R7. This will continue until it is determined that the addressed valley in R5 in part belongs to a valley in R7, that is, that a pair of neighboring lines has been detected and the following operations can occur. With a "yes" response from block 117 the program moves to block 119 where the CNT count is incremented by 1 and the program moves to block 120 to determine if the last valley in R7 has been examined.

The branches from blocks 102 and 103 that go to block 124 traverse through blocks 124, 125 and 126 in the manner just described for the output from block 122.

Referring now to Figs. 14A , 14B and 14C, wherein the flow chart for the subroutine VDETECT is shown, for reference the ARB program of Figs. 13A-13D when executing blocks 108 and 109 call for the subroute "VDETECT". The subroutine is entered through block 200 where initial conditions are set i.e., the pixel element count ECN is set to 1, the pixel position count PCN is set to 1, and the valley count VCN is set to 0. When set the current pixel will be directed to block 201 and tested to determine if its gray level is greater than the ring threshold, t 7« If it is not greater the program moves to block 202 and the pixel position count PCN is incremented by 1. If the gray level is greater the program moves to block 204 and the state flag SFLAG is set to 1. The program then moves to block 205, which increments the pixel position count by 1 and advances the program to block 206. Block 206 questions whether the pixel position count is greater than the pixel number for the ring. If the answer is "yes" the program, through block 207, sets PCN equal to 1 and advances to block

208. In block 208 if the gray level of the current pixel is greater than the ring threshold the program, through block 209, sets the SFLAG equal to 1. If it is not greater than the ring threshold the program advances to block 210. If the state flag SFLAG has been set, block 211 sets the flag equal to 0 and advances the valley increment count VCN by 1 and records the position of the currently detected valley in this ring. The program then advances to block 212 where the valley width, W(VCN) is incremented by 1 and the valley address VADR is recorded. The program then advances to block 213 where the gray level at the current position is compared against the previously lowest recorded gray level for other positions to determine if it is greater or less than. If it is not greater the program advances to block 214 where the present gray level is set equal to the previously recorded lowest gray level and the program advances to block 215. In block 215 the pixel element count ECN is incremented by 1 and the program is advanced to block 216. Block 216 compares the element count with the pixel number to determine if they are equal. If they are not the program branches back to block 205 to increment the pixel position count PCN by one. If the count is equal the subroutine ends and then returns to the main program.

Referring to Figs. 15A - 15C wherein is shown the flow diagrams of the adaptive post-thresholding process of the present invention. The operation reflected by block 300 is a smoothing of the gray level signal which is accomplished by computing H s (i) for the values i=3,4, ... ,252 using the given formula.

With the values of H s (i) computed the program advances to block 301 wherein the threshold value t is set initially to 75. The program then advances to block 302 where the state flag SFLAG is set to 0, the gray level value GLV is set to 0, the valley-peak pair

count, VPCN is set to 1, and the last transition position LTP is set to zero. In block 303 the gray level value GLV is incremented by 1 and the program advances to block 304. Block 304 checks to determine if the gray level value is equal to 255, if the answer is "yes" the program branches to block 315. If the answer is "no" the program advances to block 305. In block 305, if the histogram value is greater than the threshold value t the program advances to block 311, if it is not the program branches to block 306.

In block 311 if the state flag is equal to 0 the program advances to block 312, if not the program branches back to block 303. In block 312 a record is made of the start position and the width of the current valley. Block 313 sets the last transitional point LTP to the current gray level value. Block 314 sets the state flag to 1 and advances the program to block 303. Referring back to the branch from block 305 to block 306, if the state flag is equal to 1 the program moves to block 307, if not the program branches to block 303. Block 307 records the width of the current peak and advances the program to block 308 wherein the last transition position is set equal to the current gray level value. Block 309 then sets the state flag equal to zero. The program, through block 310, then increments the valley peak pair count VPCN by one and advances the program back to block 303. Referring back to block 304, if the gray level value is equal to 255 the program advances to block 315. If there is only one valley peak pair the program branches to block 316. If there is more than one valley peak pair the program branches to block 319. The program in block 319 considers whether the widths of the second valley and peak are greater than or equal to 10. If not greater than 10 the program branches to block 316. If it is greater than 10 the program advances to block 320 wherein the adaptive

post-threshold value tp is set to the minimum gray level value within the second valley. The system then uses the value t to eliminate all gray values greater than the value of tp. Referring back to block 316, if the current threshold value, t, is less than 25 the adaptive post threshold tp is set to 250. If the threshold t is greater than 25 block 317 decrements the threshold value by 5 and branches the program back to block 302.

From the preceding description it can be appreciated that there has been described a novel method and system for comparing the gray level of pixel elements, and also the topological features of pixel patterns to adaptively adjust the threshold of each individual document that is analyzed.