Image processing method

Abstract: An image processing system for finding a local minimum in a histogram of an image in order to define a threshold comprising steps of; Generating a table of density according to the order of number of pixels; Assuming that the density of maximal number of pixels of the table is one local maximum of higher or lower density; Searching another local maximum and the local minimum based on the assumption; Assuming that the density of maximal number of pixels of the table is another local maximum of lower or higher density; Searching another local maximum and the local minimum based on the second assumption; and Determining true local maximums and the local minimum reviewing the first and second searching.

Description: FIELD OF THE INVENTION The present invention relates to an image processing method, particularly to MODE METHOD, wherein a local minimum of histogram is calculated. BACKGROUND OF THE INVENTION Mode method is well-known as an effective method for determining threshold in binarizing. In mode method, a local minimum is to be found between a couple of local maximums. For finding the local minimum, L³ times comparisons are necessary when the number of levels of the histogram is L. The comparison takes a lot of process time. Threshold determination based on local minima is known for instance from US-A-4 601 057. SUMMARY OF THE INVENTION Therefore, the present invention as defined in the appended claims has an object to provide an image processing method by which the threshold is calculated in much shorter process time than the conventional method. According to the present invention, the density b which maximizes the following formula is found. (Na-Nb) x (Nc-Nb) a : Density higher than b; c : Density lower than b; Na: Number of pixels of density a in a histogram; Nb: Number of pixels of density b in a histogram; Nc: Number of pixels of density c in a histogram. The density a gives local maximum of higher density in the histogram and density c gives local maximum of lower density. The density b gives local minimum to be deemed to be the optional threshold. For finding the densities a, b and c, a table of density is generated first in the order of number of pixels of each density. The density of maximal number of pixels is assumed to be the density which gives one of the local maximum of higher or lower density; that is a or c. When it is assumed to be local maximum a of higher density, two densities are assumed to be densities b and c; b<=a and c<=b. The densities b and c are selected from densities of higher numbers of pixels, then gradually from densities of lower number of pixels. On each assumption and selection, (Na-Nb)x(Nc-Nb) is calculated. The densities a, b and c which give maximum value of (Na-Nb)x(Nc-Nb) are finally selected as the local maximums and the local minimum. BRIEF DESCRIPTION OF DRAWINGS Fig. 1 shows a histogram of an image; Fig. 2 shows a table corresponding to the histogram of Fig. 1; Fig. 3 shows a table in the order of a number of pixels generated from the table in Fig. 2; Fig. 4 shows a histogram to be flattened; Fig. 5 shows a block diagram effective for the processing according to the present invention. PREFERRED EMBODIMENTS OF THE PRESENT INVENTION Exemplary preferred embodiments of the image processing method according to the present invention will be described in detail hereinafter. Fig. 1 shows a histogram of an image, wherein local maximums M1 and M2 and local minimum rather clearly appear. Usually, local maximum and local minimum are not so clear in practical image. So Fig. 1 is an example for description and easy understanding. Fig. 2 shows a table of number of pixels according to the order of density, corresponding to the histogram in Fig. 1. The table of Fig. 2 is converted to the table of Fig. 3 according to the present invention. The table in Fig. 3 shows densities according to the order of number of pixels. The table of Fig. 3 is generated by sorting of the table of Fig. 2. The density of maximal number of pixels is the density giving one of local maximum. With respect to the histogram in Fig. 1, the density of maximal number of pixels is the density giving local maximum M1. Here, the density of maximal number of pixels is assumed to be the density giving the local maximum of higher density or lower density. The processing following to the assumption is determined according to which of the local maximum is assumed. a) Processing when the density of maximal number of pixels is assumed to be the local maximum of higher density; N0 is assumed to be M1. In the table of Fig. 3, number of pixels are arranged from the maximum N0 to the minimum Nn, to which the densities D0, D1, ..., Dn correspond, respectively. From N0 to Nn, the maximal Nk is searched whose density Dk is lower than N0; D0>Dk. Nk is assumed now to be m. Then (N0-Nk) is calculated and registered. Next the maximal Nl is searched under the condition that Dk>D1 as well as Nk<Nl. Nl is assumed now to be M2. Then, Xkl=(N0-Nk)x(Nl-Nk) is calculated and registered. Furthermore, the other D1′ is evaluated. The maximal Nl′ under the conditions that D1>D1′ as well as Nl<Nl′ is found so as to be assumed to be M2. The value of Xkl′=(N0-Nk)x(Nl′-Nk) calculated and compared with Xkl. Xkl=(N0-Nk)x(Nl-Nk) When Xkl′>=Xkl, Xkl′ is newly registered, substituting Xkl by Xkl′. Hereafter, Nl(n) is searched until the following relationship occurs. (N0-Nk)x(Nl (n) -Nk)<(N0-Nk)x(Nl (n+1) -Nk) The maximal value of Xkl caused by Nl (n) is finally registered. After the searching of Nl for one Nk, Nk is successively changed. nth Nk is defined as Nk (n) , the density thereof is defined as Dk (n) . Nk (n) is selected under the condition that Dk (n-1) >Dk (n) as well as Nk (n-1) >Nk (n) . For each Nk (n) , Nl (n) is searched similar to the processing above. As shown in Fig. 1, when the assumption N0=M1 is correct, that is, the point P is the local maximum of higher density, the point Pk assumed to give Nk is moved gradually toward the point Pm which gives local minimum m. While the point Pl assumed to give Nl cannot be found until Pk reaches Pk′ with same altitude of Pl which gives M2, because there is no point with lower density as well as with higher number of pixels than that of Pk. Therefore, the calculation of Xkl is not executed so that the number of calculation times is economized. b) Processing when the density of maximal number of pixels is assumed to be the local maximum of lower density. N0 is assumed to be M2. From N0 to Nn, the maximal Nk is searched whose density Dk is higher than N0; D0>Dk. Nk is assumed now to be m. Then (N0-Nk) is calculated and registered. Next the maximal Nl is searched under the condition that Dk<Dl as well as Nk<Nl. Nl is assumed now to be M2. Then, Xkl=(N0-Nk)x(Nl-Nk) is calculated and registered. Furthermore, other Dl′ is evaluated. The maximal Nl′ under the conditions that Dl<Dl′ as well as Nl<Nl′ is found so as to be assumed to be M2. The value of Xkl′=(N0-Nk)x(Nl′-Nk) is calculated and compared with Xkl. Xkl=(N0-Nk)x(Nl-Nk) When Xkl′>=Xkl, Xkl′ is newly registered, substituting Xkl by Xkl′. Hereafter, Nl(n) is searched until the following relationship occurs. (N0-Nk)x(Nl (n) -Nk)<(N0-Nk)x(Nl (n+1) -Nk) The maximal value of Xkl is caused by Nl (n) is finally registered. After the searching of Nl for one Nk, Nk is successively changed. nth Nk is defined as Nk (n) , the density thereof is defined as Dk (n) . Nk (n) is selected under the condition that Dk (n-1) <Dk (n) as well as Nk (n-1) >Nk (n) . For each Nk (n) , Nl (n) is searched similar to the processing above. In the histogram of Fig. 1, the assumption of N0=M2 is incorrect. There is no point giving Nl under the condition that Nk<Nl as well as Dk<Dl. Therefore, the searching of Nk and Nl is rapidly executed without finding suitable Nk and Nl. So N0 is easily found not be be M2. In the above searching, Nl is searched for each assumption of Nk. It is also possible to search Nk for each assumption of Nl, that is, a number of pixels in Fig. 2 is successively assumed to be Nk and Nl is searched for each assumption of Nk. As for the searching direction, both of the directions from lower density to higher density and from higher density to lower density can be applied. After the processing of a and b, the density giving Pm under the correct assumption. In a practical image, there are usually spiky drops in a histogram as shown in Fig. 4. In Fig. 4, drops are represented by references b1, b2 and b3. Such drops causes incorrect local minimum. It is better to smooth the histogram before the processing of mode method according to the present invention. Fig. 5 shows a block diagram effective for the processing according to the present invention. In Fig. 5, a frame memory 1 is connected to an address input A of a high speed memory 2. The high speed memory 2 is provided with a feed back line from a data output D/O to a data input D/I through a light computational portion 3. An image to be processed is storaged in the frame memory 1 first. The density d of each pixel of the image is outputted from data output D/O of the memory 1 to the address input A of the high speed memory 2. The high speed memory 2 is initialized first and, data "0" is stored in each address. When the density d is inputted, the high speed memory 2 outputs the data stored in the address designated by the density d. Outputted data is inputted to the light computational portion 3 and increased by "1" therein. The increased data is fed back to the data input D/I and stored again in the address of d. Since the data in the high speed memory 2 is increased by "1" on each input of d, the number of pixels of each density d is counted up and stored in the address d of the high speed memory 2. Then a histogram is generated. The memory 2 comprises for example a static RAM (random access memory) which performs reading and writing in high speed. So it is possible to increase the data in the high speed memory 2 synchronously with each output from the frame memory 1. The histogram is generated within one scanning of the image. When a static RAM of process speed of about 40nsec/pixel is used an image size of 512x512 pixels can be processed in about 1/60 sec; in a video rate. For the high speed processing, the frame memory 1 should be of high process speed. As a high speed frame memory, a serial accessible memory such as dual-port memory is applicable. When histogram generating is completed, the data in the high speed memory 2 is read by MPU 4. MPU 4 designates address of the frame memory 1 with the number of pixels stored in the high speed memory 2 and writes the density d (address of the high speed memory) in corresponding address of the frame memory 1. The data in the frame memory can be deemed to be the table in Fig. 3, when data is reviewed according to the order of address. There is a possibility that different densities has the same number of pixels. Such problem may be easily solved by managing the overlapping of number of pixels. Although only a few exemplary embodiments of this invention have been described in detail above, those skilled in the art will readily appreciate that many modifications are possible in the exemplary embodiments without materially departing from the novel teachings and advantages of this invention. Accordingly, all such modifications are intended to be included within the scope of this invention as defined in the following claims.

Claims: Image processing method for determining a threshold value of a density distribution of a pixelwise stored image, said density distribution being defined by the numbers N O -N N of pixels of respective density-values D O -D N occuring in the image, said determination being achieved by selecting a local minimum within the histogram CHARACTERIZED IN THAT said selecting comprises the following steps A-D, whereby step B and C can be interchanged with each other: A) Generating a density table arranged from the maximum number of pixels N₀ to the minimum N N according to the numbers N₀-N N of pixels of respective densities D₀-D N ; B) starting with density D₀ having the highest number of pixels N₀ and searching for the next density D K1 in the table, which fulfills the following conditions: D K1 < D O ^ N K1 < N O and storing said D K1 , searching a density D L1 fulfilling the following conditions: D L1 < D K1 ^ N L1 > N K1 variating D K1 until a D L1 is found fulfilling condition (2); if no D L1 can be found continuing with the next step; if a D L1 was found storing said D L1 and variating DK1 until X KL1 = (N O - N K1 ) x (N L1 -N K1 ) reaches a maximal value; storing said maximal value X KL1 and considering the respective density D K1 as being the local mimimum; C) starting with density D₀ having the highest number of pixels N₀ and searching for the next density D K2 in the table, which fulfills the following conditions: D K2 > D O ^ N K2 < N O and storing said D K2 ; searching a density D L2 fulfilling the following conditions: D L2 > D K2 ^ N L2 > N K2 variating D K2 until a D L2 is found fulfilling condition (5); if no D L2 can be found continuing with the next step; if a D L2 was found storing said D L2 and variating D K2 until X L2 = (N O - N K2 ) x (N L2 -N K2 ) reaches a maximal value; storing said maximal value X KL2 and considering the respective density D K2 as being the local mimimum; D) if a local minimum D K(1,2) is found, considering D K(1,2) as said threshold value; if more than one local minimum was found considering that D K(1,2) to be the true threshold value which is related bigger X KL(1,2) value. A method according to claim 1 CHARACTERIZED IN THAT before step A is executed generating a density distribution histogram out of the density values D₀-D N and their respective numbers N₀-N N , flattening said histogram and using the flattened values for generating the table of density according to step A.

Inventors: KUMAGAI RYOHEI C O EZEL INC, KUMAGAI, RYOHEI C/O EZEL INC.
Applicants: EZEL INC, SHARP KK, EZEL INC.
Application year: 1989
Main classification: G06T7
IPC codes: G06T1, G06T5, H04N1, G06T7