METHOD AND APPARATUS FOR THRESHOLDING IMAGE DATA

Abstract: A system is described for thresholding graphics images to reduce the information content for transmission and reproduction and which uses a particular image data thresholding technique that may be used to obtain display images with a number of intensity levels. Firstly, an histogram of the image to be encoded is generated and analyzed to determine essential parameters. In particular, the background colour of the image is determined by summing the histogram elements to find the median (B) of the distribution, that is, the point at which the half sum of total pixels is reached. The extrema (A, G) of the histogram are calculated and the skew is determined from the position of the median (B) with respect thereto. If the difference between the median (B) and the black extreme (G) is less than half the difference between the median (B) and the white extreme (A) then the background of the image is deemed to be black, otherwise, the image will be defined as having a white background. After the background colour is determined, the width of the background is determined from the difference between the median (B) and the background colour extreme (A), and the edge between the background and foreground regions, is defined as being at a distance one-half the background width from the median (B) in the direction of the foreground colour extreme (G). A sequence of threshold levels (D, E, F) may then be determined using this edge (C) as a base, by setting them at points disposed at fractionally different distances between the edge (C) and the foreground colour extreme (G). Preferably the levels are set at points 1/8, 1/4 and 1/2 the defined distance or at 3/16, 3/8 and 3/4. The selected points will respectively define the threshold levels such as between white/gray-white, gray-white/gray-black, and gray-black/black. Thus, the resulting image may then, after encosing and transmission, be decoded and displayed on a suitable teleconferencing system or fascimile machine with four intensity levels.

Description: The present invention relates to digital processing techniques for graphics and, more particularly, to a method and means for thresholding image data to reduce the information content for transmission and reproduction. The general concept of thresholding in connection with image data handling to reduce the information content of an image to essentially black and white form is well known. The many related prior art techniques primarily deal with how the thresholding decisions are made and typical approaches are variously taught, for example, in U.S. Patent No. US-A-4,251,837 to JANEWAY, IBM Technical Disclosure Bulletin, Vol. 14, No. 4, Sept. 1971, CHOW ET AL, pages 1301-1304, as well as in U.S. Patent Nos. US-A-4,439,789 to CAHILL, US-A-4,238,768 to MITSUYA ET AL, and US-A-4,326,258 to de la GUARDIA. The essential problem in thresholding is to identify (1)the intensity range in an image which is to be considered background, (2) the intensity range which is to be considered foreground, that is, the text areas, and (3) the colour of the background, that is, whether black or white. Any thresholding technique is preferably simple from a computational point and yet reliable. A convenient method of analysing intensity ranges in this manner is with the use of an image histogram, that is, a plot of the intensity distribution of the image. One prior art example of thresholding with an histogram is found in the cited IBM Technical Disclosure Bulletin of CHOW ET AL wherein thresholds are calculated by computing the histogram for each region of an image and then determining the thresholds from the estimated distribution by the method of maximum likelihood. The de la GUARDIA patent also discusses the setting of thresholds using the histogram of FIG. 8. Both of these systems, however, have a fair degree of complexity. Other techniques involve histogram peak location and while perhaps less complex frequently lack reliability. By comparison the present invention discloses a system that is both simple and reliable using only very easily obtained histogram parameters and which, when combined with shading correction techniques, such as disclosed in US-A-4 703 689, is very robust. The present invention involves a method and apparatus for thresholding image data by determining three threshold levels in the image histogram that are used for producing four intensity levels of the image. Firstly, an histogram of the image is generated and the median of the distribution is calculated by summing the histogram elements until the half sum is reached. The extrema are calculated by summing from each end of the intensity range until respective small but significant numbers are found, and then scanning back toward the respective intensity range ends until zero elements are found in the histogram. To determine the colour of the background the skew of the histogram is then determined from the position of the median relative to the extrema. Unless the document background can be clearly classified as black, that is, the difference between the median and the black extreme is less than half the difference between the white extreme and the median, then the image is defined to have a white background. A measure of the width of the background region is then determined from the difference between the median and the extreme for the background colour, and the edge between the background and foreground regions is defined as being at a distance of one half the background width measured from the median toward the foreground colour extreme. This convenient edge determination is then used as a base for calculating the sequence of threshold levels which are set as fractions of the Further, EP-A-0 113 016 to ANASTASSIOU ET AL discloses a method and apparatus for cor­ rection of shading effects in video images. The method includes the steps of; generating a histogram of an image, computing a median of the distribution of said image, computing the extremes of said distribution and determining a range of acceptable background color intensity variation by calcu­ lating the difference between the median and the major color extreme. Other techniques difference between the edge and the foreground extreme. A nonlinear scale is preferably used, the three levels being determined at 1/8, 1/4 and 1/2 the distance between the edge and the foreground extreme, or at 3/16, 3/8 and 3/4, which differences define the threshold levels for a white background image as between white/grey-white, grey-white/grey-black, and grey-black/black. This technique is particularly suitable for use in a teleconferencing system for thresholding of images to a two-bit/pixel form such as described in US-A-4 532 651 and US-A-4 558 370 assigned to the same assignee as the present application. The invention, which is defined in the attached claims, is described in detail below with reference to the attached drawings, in which; FIG. 1 is an illustration of a typical histogram of a graphics image that may be analysed in accordance with the present invention. FIG. 2 is a flow chart of an embodiment of the present invention. FIG. 3 is a block diagram of apparatus for carrying out the present invention. The present invention deals with graphics images and is particularly useful in systems wherein images are scanned and digitally encoded and after transmission and processing are reproduced in one form or another as in teleconferencing systems or facsimile machines. It is usually necessary in such systems to reduce the information content of the image to facilitate processing and then to reproduce the image in a usable form. As noted above, a technique for accomplishing this end is the use of thresholding wherein preselected intensity levels are established for handling the digitized data. The basic thresholding procedure involves identifying the intensity ranges to be considered background and foreground and determining the colour of the background. The colour of the background will be determined to be black or white and the foreground, either whiter or blacker, respectively, will be the region containing the text material or other image detail. In accordance with the invention, the first step in the process is to generate a histogram of the graphics image such as, for example, a histogram of the type shown in FIG. 1. This histogram illustrates the distribution or the number of pixels at each intensity, along the vertical axis, as compared to their intensity values along the horizontal axis. As will be familiar to those skilled in the art the broad peak in the histogram is caused by the white background of the image and the darker text causes the tail to the right. For the purpose of the analysis, point G represents the black extreme and point A represents the white extreme of the image while the median is indicated by the point B. The edge between the background and the foreground regions is indicated by C. By way of illustration it is desired to define three threshold levels which will permit thresholding of the image to four intensity levels. The three threshold levels may be indicated by the points D, E, and F. The method of the invention for calculating the location of the three points involves the following steps shown in the flow chart in FIG. 2. Firstly, the median B of the distribution is calculated by summing the histogram elements until the half sum of total pixels is reached. As seen in FIG. 3, typically, the histogram will be generated by scanning the document to be transmitted with a conventional raster scanner 10 or the like which provides appropriate signals to a conventional histogram generator 12. The generated histogram is then fed to an analyser 14 which may conveniently be a general purpose computer such as an IBM Series/I. Next, the black extreme G and the white extreme A are calculated in the analyser 14 by summing from each end until respective small, but significant, numbers are found, and then scanning back toward the respective intensity range ends until zero elements are found in the histogram. This prevents isolated errors from influencing the decision on the extrema locations. The skew of the histogram is then determined from the position of the median B relative to the positions of the extrema A and G. This relationship is used to determine the colour of the background. The decision is not symmetric, owing to difficulties in distinguishing an all black document from an all white document when the dynamic range is low. Therefore, unless the document background can be clearly classified as black, that is, the difference between the median and the black extreme is less than one half the difference between the median and the white extreme, the image is defined to have a white background. The width of the background is then determined. Experiments have shown that the width of the background region can be determined from the difference between the median B and the background edge, that is, B - A in the histogram in FIG. 1. The edge between background and foreground regions is thus defined to be at C by B + 1/2(B-A). However, not all intensities in the foreground region will be thresholded as non-background. This is simply a convenient way to establish a base for calculating the sequence of threshold levels. It should be noted that the median B is typically shifted slightly away from the peak of the distribution toward the non-background intensity region. The threshold levels D, E, and F are now determined as fractions of the difference between point C and point G. A nonlinear scale has been found to work best, the levels preferably being set at 1/8, 1/4, and 1/2 of the distance between point C and point G. Distances of 3/16, 3/8, and 3/4 will also be found suitable so that the choice is not critical. This produces the levels D, E, and F, the threshold levels between white/grey-white, grey-white/grey-black, and grey-black/black. The image data thus thresholded may, for example, be encoded accordingly in a suitable encoder 16, and decoded after transmission in a suitable decoder 17 for imaging on a system 18, such as a teleconferencing system. Alternatively, as shown in FIG. 3, the thresholded data may be transmitted directly to display system 18 or to a storage device 19 or printer 20, or from the decoder 17 to the latter two devices. The resulting display image in the system described, will have four intensity levels. It will be seen that the technique of the present invention relies only on very easily obtained histogram parameters and is not significantly influenced by peculiar spikes and valleys in the histogram as a peak location technique might be. It is also computationally very simple, and when combined with shading correction techniques is very robust. Additionally, it will be found to be particularly suitable for use in a teleconferencing system for the thresholding of images to a two-bit/pixel form such as described in the previously noted US-A-4 532 651 and US-A-4 558 370.

Claims: 1. A method for thresholding image data comprising the steps of: generating a histogram of an image; computing a median (B) of the distribution of the image by summing the histogram elements until the half sum of total pixels is reached; computing the extremes (A, G) of said distribution; determining the skew of said distribution from the relative position of said median (B) with respect to said extremes (A, G) to determine the colour of the image background; characterized by the steps of defining the edge between background and foreground regions of the image by determining a point (C) located between the median (B) and the foreground colour extreme (G) a distance equal to half the distance between the median (B) and the background colour extreme (A), which edge point is used as a base for calculating the sequence of threshold levels; and determining a sequence of threshold levels (D, E, F) in a foreground region of said histogram by establishing a plurality of points differentially spaced along the distance between said edge point (C) and said foreground colour extreme (G). 2. Method as in claim 1 wherein the step of computing the extremes (A, G) of said distribution is carried out by summing the histogram elements from each end of the inten­ sity range until a small but significant number is found and then scanning back toward the respective intensity range ends until respective zero elements are found in the histo­ gram. 3. Method as in claim 1 wherein said plurality of points (D, E, F) are spaced 1/8, 1/4, and 1/2 of said distance. 4. Method as in claim 1 wherein said plurality of points (D, E, F) are spaced 3/16, 3/8, and 3/4 of said distance. 5. Method as in claim 1 wherein the step of determining the skew of said distribution comprises measuring the lengths of the respective distances between said median (B) and-said extremes (A, G) and then determining whether the length of one distance is less than one half the length of the other distance. 6. Apparatus for thresholding image data comprising: means for generating a histogram of an image; means for computing a median (B) of the distribution of the image by summing the histogram elements until the half sum of total pixels is reached; means for computing the extremes (A, G) of said distribution,means for determining the skew of said distri­ bution from the relative position of said median (B) with respect to said extremes (A, G) to determine the colour of the image background; characterized by means for defining the edge between background and fore­ ground regions of the image by determining a point (C) located between the median (B) and the foreground colour extreme (G) a distance equal to half the distance between the median (B) and the background colour extreme (A), which edge point (C) is used as a base for calculating the se­ quence of threshold levels (D, E, F); and means for deter­ mining a sequence of threshold levels (D, E, F) in a fore­ ground region of said histogram by establishing a plurality of points differentially spaced along the distance between said edge point and said background colour extreme. 7. Apparatus as in claim 6 wherein said means for computing the extremes (A, G) of said distribution comprises means for summing the histogram elements (A, G) from each end of the intensity range until a small but significant number is found and then scanning back toward the respective ends of said intensity range until respective zero elements are found in the histogram. 8. Apparatus as in claim 6 wherein said plurality of points (D, E, F) are spaced 1/8, 1/4, and 1/2 of said distance. 9. Apparatus as in claim 6 wherein said plurality of points (D, E, F) are spaced 3/16, 3/8, and 3/4 of said distance. 10. Apparatus as in claim 6 wherein said means for deter­ mining the skew of said distribution comprises means for measuring the lengths of the respective distances between said median (B) and said extremes (A, G) and means for determining whether the length of one distance is less than one half the length of the other distance.

Inventors: PENNEBAKER, WILLIAM BOONE
Applicants: INTERNATIONAL BUSINESS MACHINES CORPORATION
Application year: 1985
Main classification: H04N1
IPC codes: G09G5, H04N1, G06T1, G06T5, G06K9