METHOD FOR IMAGE DATA CODING

Abstract: To efficiently compress image data, the image data is divided into rectangular blocks of non-equal length in a hierarchal structure in accordance with a brightness change, and is encoded into tree-structure data for each of the divided blocks so that the mean distortion of the image data inside each block does not exceed an allowable value.

Description: This invention relates generally to a method of encoding image data. More particularly, the present invention relates to a high efficient data compression method of image data which is suitable for image communicaton, rough image formation of image file retrieval, and the like, at a low bit rate. Data compression systems of image data having higher efficiency have been desired in order to reduce the cost of image communication and image file and the attain higher response. Conventional image data compression methods can be classified broardly into a predictive coding method and a transform coding method. The former predicts the brightness value of a given pixel from pixels adjacent thereto in a pixel unit and encodes it in a variable length. However, this method cannot make compression of less than 1 bit/pixel, in principle. On the other hand, the transform coding method divides an image into sub-blocks having a predetermined size (mostly, such as 8x8 and 16x16), and makes orthogonal transform for this block unit and encoding. However, this method is not free from the problem of a compression ratio, either, because redundancy in a greater zone exceeding the block size (as typified by a flat background) cannot be utilized. Besides the two methods described above, a vector quantitization method has been investigated intensively in recent years. This method, too, divides an image into sub-blocks of a predetermined size and makes quantitization for each block. For this reason, this method is not devoid of the same problem as that of the transform coding method described above. These compression methods are discussed in "Comparison Of Still picture Coding Methods", , Communication Society Technical Paper IE83-106, for example. This reference describes the comparative studies on the five kinds of methods, i.e., an adaptive consine transform coding, hierarchal Hadamard transform coding, vector quantitization, DPCM coding and adaptive block coding by obtaining the respective S/N ratios, coding quantities and variable other data by simulation using a computer. All of these methods involve the problem of the compression ratio described above. A method of encoding image data according to the first part of claim 1 is known from Proceedings of the IEEE, Vol. 68, No. 7, July 1980, pages 770-786. A hierarchy of block sizes is used dependent on the variation of local activity (including brightness) within the picture. It is an object of the present invention to provide a high-efficient image data encoding method with a high ratio of image data compression. This object is accomplished by the method defined in claim 1, with two preferred embodiments of this method being specified in claims 2 and 3. Fig. 1 is a flowchart showing the encoding sequence in one embodiment of the present invention; Fig. 2 is a block diagram of an encoding/decoding apparatus showing the embodiment of the present invention; Fig. 3 is a comparative view of the concept of equal length block encoding and the concept of non-equal length block encoding; Fig. 4 is an explanatory view of a block hierachy; Fig. 5 is an explanatory view of reduction; Fig. 6 is a data structural view of encoded data; Fig. 7 is an operation diagram of FIFO; Fig. 8 is a flowchart of a decoding sequence in one embodiment of the present invention; Fig. 9 is a graph showing the evaluation of a compression ratio; Fig. 10 is an explanatory view of the slope of brightness and an approximation method of brightness; Fig. 11 is an explanatory view of a block hierachy; Fig. 12 is an explanatory view of reduction; Fig. 13 is a flowchart of an encoding sequence of another embodiment of the present invention; Fig. 14 is a data structural view of encoded data; and Fig. 15 is a flowchart of a decoding sequence of the data. Hereinafter, the principle and some preferred embodiments of the present invention will be described in detail with reference to the accompanying drawings. First of all, the principle of encoding will be explained with reference to Figs. 3 ∼ 6 and Fig. 1, and the principle of decoding, with reference to Figs. 7 ∼ 9. (A) Encoding Method: Figs. 3(a) and 3(b) are comparative views useful for comparing the concept of equal size block encoding with that of non-equal size block encoding. In order to make data compression by utilizing also global redundancy of an image, the image is divided into non-equal size blocks in accordance with the change quantity of brightness. In other words, the image is divided in such a fashion that its portions having a gentle brightness change are turned into great blocks while those having a vigorous change are turned into small blocks. If block division is made in this manner and each block is encoded by the same number of bits, encoding can be made by utilizing the global redundancy that cannot be utilized by equal size block encoding (see Fig. 3(b)). Mean distortion is used as the reference of block division, so that the mean distortion of each block after encoding and decoding does not exceed a designated allowance value. A mean square error, for example, is mostly used as an index of distortion and is expressed by the following equation: where d: mean distortion N: number of pixels in each block X ij : brightness of pixel (i, j) ij : encoded/decoded value of pixel (i, j). Fig. 4 is an explanatory view of block hierachy and Fig. 5 is an explanatory view of reduction in Fig. 4. Let's consider blocks having sizes of 1x1, 2x2, ... , 2 n x2 n . The block 2 n x2 n represents an image as a whole. Here, the 2 n x2 n block is called "the uppermost order level (0 level)" and the 1x1 block, "the lowermost order level (n level)". In the example shown in Fig. 4 in = 4), 0 ∼ 4 are the 0 to 4th level blocks, respectively. The following expression method will be used to represent each block. Since four blocks each having a size of 2 n-1 x2 n-1 (8x8 pixels) exist in the first level, they are called 1, 2, 3 and 4 in the order of upper left, upper right, lower left and lower right. In the second level, 16 blocks each having a size of 2 n-2 x n-2 (4x4 pixels) exist, and four of these blocks correspond to one block of the first level. Therefore, the four blocks of the second block contained in the same block of the first level are called 1, 2, 3 and 4, respectively. In other words, the block of the second level can be determined uniquely by the combination of the block number i₁ (i₁ = 1 ∼ 4) of the first level and the block number i₂ (i₂ = 1 ∼ 4) of the second level. In this manner, one block in the k th level can be expressed generally by (i₁, i₂, ... , i k ). In the example shown in Fig. 4, the block 5 (the hatched block) can be expressed as (1, 1, 1, 4). The mean distortion that occurs when the mean brightness of the blocks (i₁, i₂, .... , i k ) expressed by the expression method described above is X i1 , X i2 , .... , X ik and the brightness of all the pixels in the block is represented by Xi₁i₂ .... i k , is expressed as di₁i₂ .... i k . In other words, the mean distortion is given as follows: where Zi₁ ... i n is the brightness of the pixels (i₁, i₂ .... , i n ). When starting from the lowermost order level and the mean distortion defined by equation (2) does not exceed a given allowance value D, the four blocks are combined into one block of the order which is higher by one stage. When di₁ .... ik ≦ D (3) Xi₁, .... i k1 ∼ Xi₁, .... i k4 are represented by Xi₁ .... i k (see Fig. 5). This procedure will be hereinafter called "reduction". Here, since Xi₁ .... i k , di₁ .... i k can be calculated from the level which is lower by one stage in accordance with the following recurrence formula, practically efficient calculation can be made: Fig. 1 is a flowchart showing the encoding sequence in one embodiment of the present invention. The encoding sequence based on the concept of Figs. 3 and 4 will be explained with reference to the flowchart of Fig. 1. The lowermost level top block is set at step 10. The calculation of the formulas (4) and (5) is made at steps 11 and 12 to obtain mean brightness and mean distortion, respectively. Judgement of formula (3) is made at step 13 and when the mean distortion is smaller than the allowance value, that is, when the formula (3) is satisfied, reduction is executed at step 14. Processing of the next block is made at step 15, but when reduction of the next block has already become impossible, this processing is skipped. Whether or not processing of all the blocks of the level which is being now processed is completed is judged at step 16 and if it is, processing of the next level is made at step 17. Whether or not processing of all the levels is completed is judged at step 18, and if it is, the encoding processing is complete. Figs. 6(a), (b) and (c) are explanatory views each being useful for explaining the data structure. Hereinafter, the structure of the encoded data (for storage and communication) will be described. The data that are encoded as shown in Fig. 6(a) can be expressed by a quadtree such as shown in Fig.6(b). This quadtree is stored by a data structure such as shown in Fig. 6(c). Each data is divided into four data blocks, each of which corresponds to one block on the image. The image blocks are sequentially stored from the upper order levels, and symbol ESC represents an escape mark (which represents that reduction to its level is not yet made and reference to a lower order level is further necessary). For example, in the first data block shown in Fig. 6(c), the block arrangement is (ESC, X₂, X₃, ESC), and the first and fourth blocks of the first level require the reference to a lower order level while the second and third blocks can assume the brightness values of X₂ and X₃, respectively. The block in which the ESC mark is stored is developed to the lower level which is lower by one stage and the ESC mark is stored in the subsequent data block. Namely, in the case of the example shown in Fig. 6(c), the data corresponding to the first ESC is stored in the second data block while the data corresponding to the second ESC is stored in the third data block, respectively. After this data structure is generated, it is possible to make variable length encoding including the ESC marks (Hafmann encoding). Fig. 2 is a block diagram of a data encoding/decoding apparatus to which the present invention is applied. When the invention is applied to a facsimile signal, for example, the apparatus consists of a line buffer 31, a counting/brightness generation circuit 32, a code/decode circuit 33 and a buffer 34. When encoding, the image read by a scanner is stored in the line buffer 31 line by line, the pixels are counted by the count/brightness generation circuit 32 and the encoding processing shown in Fig. 1 is then effected by the code/decode circuit 33. Then, the data in the form such as shown in Fig. 6(c) is stored in the buffer 34. When data transmission is made, the data is delivered to a transmission line after being modulated to a.c. signals through MODEM. When a compression signal is received from the transmission line, the data received through MODEM is stored in the buffer 34 in the sequence of transmission in the form shown in Fig. 6(c). The data is transferred from the buffer 34 to the queue of FIFO and the later-appearing decoding processing shown in Fig. 8 is made in the code/decode circuit 33. After brightness is generated by the brightness generation circuit 32, the data is once stored in the line buffer 31 and is outputted as serial signals to the plotter for depicting the image. (B) Decoding Method: Next, the decoding method of the encoded data will be described. The data block number, the data number inside the block and the encoded data in Fig. 6(c) are expressed by ℓ, m (m = 1 ∼ 4) and Yℓ, m respectively. The queue of FIFO (First In First Out) is prepared as means for determining the lower order level development block from the ESC mark. Fig. 7 is an explanatory view useful for explaining the FIFO operation, and Fig. 8 is a flowchart of the decoding processing in one embodiment of the present invention. The decoding sequence is as follows. First of all, when ℓ = 1 (step 20), (a) if Yℓ, m ≠ ESC, X m = Yℓ, m (steps 21, 22), If Yℓ, m = ESC, m is stored in FIFO (step 23). Further, when ℓ≧2 (step 26). (a) The top element ω is read out from FIFO (step 28). (b) If Yℓ, m ≠ ESC, Xωm = Yℓ, m (steps 21, 22). If Yℓ, m = ESC, (ω, m) is stored in FIFO (step 23). Here, ω is an integer sequence and (ω, m) is an integer sequence obtained by adding m to ω. This procedure is repeated until all the data block is complete, and when all the data blocks are dealt with, the procedure is complete (step 27). Figs. 7(a), (b), (c) show the FIFO operation in the example shown in Fig. 6(c). To make the FIFO operation, the data is sequentially stored from the lower part to the upper part of the buffer, and the uppermost data is read out. In Fig. 7(a), the data are stored in the sequence of 1, 4 and in Fig. 7(b), the data are stored in the sequence of 4, 1 3 after the first 1 is read out. In Fig. 7(c), after 4 is read out, only 13 is shown stored. In the manner described above, the brightness Xi₁ ... i k of each block can be reproduced from the data sequence of Fig. 5(c). The coordinates (X, Y) of the pixels contained in the block (i₁ ... i k ) are determined by the following formula and decoding at the pixel level can be made: where: Next, the compression rate is evaluated on the basis of a simple model. (A) Assumption: (a) An image of 512 x 512 x 8 bit/pixel is assumed. (b) Among the regions requiring the accuracy of at least the level i, the ratio of the regions not requiring the accuracy of at least the level (i + 1) is set to be α, in conjunction with the given allowable distortion D and the object image. and the object image. (c) The compression component resulting from the variable length encoding is not taken into consideration. In other words, the data in the form shown in Fig. 5(c) is subjected to equal length encoding. (B) Evaluation of Compression Ratio: The assumed lowermost level is called "K". In other words, if K = 9, 1x1 is the block of the lowermost level and if K = 8, 2x2 is the block of the lowermost level. In this case, if encoding up to the ESC mark is made, the necessary bit number is given by the following formula: Accordingly, the compression ratio Cα,k is given as follows: Fig. 9 is a graph of the compression ratio evaluation, and shows the result of calculation of Cα, k for some values of k and α. When α = 1/2, a compression ratio of 1/100 can be accomplished by improving spatial resolution to K = 9 (pixel level) but when α = 1/4, spatial resolution must be lowered to about K = 7 (4 x 4 block) in order to make compression of 1/100. (C) Evaluation of S/N: The S/N value is determined from the mean distortion: where M.S.E is the mean distortion. Since M.S.E. does not exceeds the allowable mean distortion, can be established. Whereas the conventional method can evaluate S/N only after encoding and decoding are made, the present invention can evaluate in advance S/N using the allowable distortion D as the parameter and the method of invention is easier to practise. Next, another embodiment of the present invention will be described with reference to Figs. 10 to 15. Figs. 10(a), (b) are explanatory views useful for explaining the slope of brightness and an approximation method of brightness. Mean distortion is used as the reference of block division so that the mean distortion does not exceed the designated allowance value, as described already. As the index of distortion which is mostly used, there is a mean square difference as described with reference to Fig. 3 and this formula is given again below: where d: mean distortion, N²: number of pixels in block, X ij : brightness of pixel (i, j), ij : encoded/decoded brightness of pixel (i, j). A brightness slope approximate to the mean brightness inside each block is used to encode the block. The mean brightness is expressed by the following formula: The brightness slopes Δ (in the i-axis direction) and δ (in the j-axis direction) are such as shown in Fig. 10(a) and are determined in the following way. First of all, ij of the formula (8) is expressed as follows by use of X , Δ and δ: This means that the curve surface formed by the brightness inside the block is approximated by the flat surface of the slope (2Δ, 2δ) (see Figs. 10(a), (b)). Approximation that minimizes distortion is derived from the condition which minimizes d obtained by putting the formula (10) into the formula (8). A definite calculation method of Δ and δ on the basis of this condition will be described in detail in the later-appearing embodiment. The encoding method and the decoding method will be explained with reference to Figs. 11 to 14 and Figs. 15 and 16, respectively. (A) Encoding Method: Fig. 11 reproduces Fig. 4 and is used for explaining the expression method of a non-equal size block. Blocks having sizes of 1x1, 2x2, ... , 2 n x2 n are considered. The 1x1 block is a pixel itself and the 2 n x2 n block is the image as a whole. Here, the 2 n x2 n block is called "the uppermost order level (0th level)" while the 1x1 block is called "the lowermost order level ( n th level)". In the case of the example shown in Fig. 11, 0 to 4 represent the blocks of the 0th to fourth levels, respectively. To express each block, since four blocks each having a size of 2 n-1 x2 n-1 exist in the first level, they are called "1, 2, 3 and 4", respectively, in the order to the upper left, upper right, lower left and lower right. Next, in the second level, sixteen 2 n-2 x2 n-2 blocks exist and four of these blocks correspond to one block of the first level. Therefore, the four blocks of the second level contained in the same block of the first level are called "1, 2, 3 and 4", respectively, in the same way as in the first level. In other words, the blocks of the second level are uniquely determined by the combination (i₁, i₂) of the block number i₁ (i₁ = 1 ∼ 4) of the first level and the block number i₂ (i₂ = 1 ∼ 4) of the second level. In this manner, one block of a k th level can be expressed generally by (i₁, i₂, .... , i k ). In the case of the example shown in Fig. 3, the block 5 (the hatched block) can be expressed as (1, 1, 1, 4). The mean brightness and the approximate brightness slope of the block (i₁, i₂, .... i k ) expressed by the method described above will be hereby called "Xi₁i₂ .... i k " and "Δi₁i₂ .... i k , δi₁i₂ .... i k ", respectively. Furthermore, the approximate value obtained by approximating the brightness of the pixels in the block in accordance with the formula (10) by use of Xi₁ ... i k , Δi₁ .... i k , δi₁ .... i k is expressed as di₁ .... i k . In other words, where Zi₁ .... i n is the brightness of the pixel (i₁i₂ .... i n ). Incidentally, the suffix i₁ .... i n moves respectively within the range of from 1 to 4. When starting from the lowermost order level and the mean distortion defined by the formula (12) does not exceed the given allowance value D, the four blocks are unified into one block of the order which is higher by one stage than their stage. In other words, when di₁ ... ik≦D (13) Xi₁ .... i k1 ∼X i1 .... ik₄ are represented by Xi₁ .... i k , Δi₁ .... i k1 ∼Δi₁ .... i k4 by Δi₁ .... i k and δi₁ .... i k1 ∼δ i1 .... δi₁ .... i k4 by δi₁ .... i k , respectively (see Fig. 12). Next, a definite calculation method of X, Δ, δ and d to execute reduction will be described. From the formulas (11) and (12), the following relational formulas of X, Δ, δ and d can be derived: Here, Si, ti (i = 1 ∼ 4) and Ak (k = 1, .... n) are coefficients that take the following values: S₁ = S₃ = -1, S₂ = S₄ = 1, t₁ = t₂ = -1, t₃ = t₄ = 1, A k = 1 3 · 4 n-k (4 n-k -1) (18) From the formulas (7) to (10), X, Δ, D and d can be calculated recurrently from X, Δ, δ and d of the level lower than by one stage, and calculation can be made efficiently from the practical aspect, too. Fig. 13 is a flowchart of the encoding sequence in another embodiment of the present invention. First of all, the lowermost level and the top block are set at step 40. Mean brightness X is determined in accordance with the formula (14) at step 41, and the slopes of brightness Δ, δ are calculated in accordance with the formulas (15) and (16) in step 42. Then, the mean distortion d is determined in accordance with the formula (17) at step 43. Judgement of the formula (13) is made at step 44, and if the formula (13) is found satisfied, reduction is executed at step 45. Processing of the next block is made at step 46, but when the next block has already become impossible for reduction, the flow skips. Whether or not the processing of all the blocks of the level that is being processed is completed is judged at step 47, and if it is, processing proceeds to the next level at step 48. Step 49 judges whether or not the processing of all the levels is complete, and if it is, the encoding sequence is completed. Figs. 14(a), (b) and (c) are data structural views of the encoded data. As shown in Fig. 14(a), the encoded data can be expressed by the quadtree such as shown in Fig. 14(b), and are stored in the data structure such as shown in Fig. 14(c). The data is divided into four each data blocks, which correspond to one block on the image. The image blocks are sequentially stored from the upper order levels, and symbol ESC represents an escape mark (representing that reduction is not made to that level and reference to lower order levels is necessary). In the first data block of Fig. 14(c), for example, the data arrangement is (ESC, (X₂, Δ₂, δ₂), (X₃, Δ₃, δ₃), ESC). The first and fourth blocks of the first level need reference to the lower order level, while the second and third blocks are encoded to (X₂, Δ₂, δ₂), (X₃, Δ₃, δ₃), respectively. The block storing the ESC mark is further developed to the level which is lower by one stage, and is stored in the subsequent data block. Namely, in the example of Fig. 14(c), the data corresponding to the first ESC is stored in the second data block while the data corresponding to the second ESC is stored in the third data block. After such a data structure is generated, it is possible to make variable length encoding (Hafmann encoding) including the ESC mark, if there is any deviation of the data values. (B) Decoding Method: Next, the decoding method of the encoded data will be described. Here, the data block number in Fig. 14(c) is expressed by ℓ, the data number inside the block by m (m = 1 ∼ 4) and the encoded data, by Yℓ, m, (set of X, Δ, δ), respectively. Here, the queue of FIFO is prepared as means for determining the development block of lower order levels from the ESC mark. Fig. 15 is a decoding processing flowchart in another embodiment of the present invention. First of all, if (a) Yℓ, m ≠ ESC when ℓ = 1, (X), Δm, δm) = Yℓ, m (steps 50, 51, 52). If Yℓ, m = ESC, m is stored in FIFO (steps 51, 53). Next, when ℓ ≧ 2, (a) the top element ω is read out from FIFO (steps 56, 58). (b) when Yℓ, m = ESC (Xωm, Δωm, δωm) = Yℓ, m (steps 51, 52). If Yℓ, m = ESC, (ω, m) is stored in FIFO (steps 51, 53). Here, ω represents an integer sequence and (ω, m) does integer sequence obtained by adding m to ω. In this manner, the brightness Xi₁ .... i k and the brightness slope Δ i1 .... i k , δi₁ .... i k of each block can be reproduced from the data line shown in Fig. 14(c). Here, the coordinates of the pixels contained in this block are within the following range: where The following formula X xy = Xi₁ ... ik +(2X- X - X -1)Δi₁..ik +(2Y- Y - Y -1)δi₁..ik (21) can be established by setting X , X , Y and Y as follows and applying the formula (10) to the brightness X xy of the pixel (X, Y): Accordingly, decoding in the pixel level becomes possible. In accordance with this embodiment, since the inside of the block is encloded by use of the brightness slopes, the portions whose brightness slope is near constant can be compressed as one block. The compression ratio is determined by the allowable mean distortion D and the characteristics of the object image, but the compression ratio is evaluated on the basis of a simple model as described below. (A) Assumption: (a) An image of 512x512x8 bit/pixel is assumed. (b) Among the regions requiring the accuracy of at least the level i, the ratio of the regions not requiring the accuracy of at least the level (i + 1) is set to be α, in conjunction with the given allowable distortion D and the object image. (c) The compression component resulting from variable length encoding is not taken into consideration. In other words, the data in the form shown in Fig. 14(c) is subjected to equal length encoding. (B) Evaluation of Compression Ratio: The lowermost level assumed is K. In other words, if K = 9, 1x1 is assumed to be the lowermost level block and if K = 8, 2x2 is assumed to be the lowermost level block. In this case, if encoding is made inclusive of the ESC mark, the necessary bit number is given by the following formula: Therefore, the compression ratio C α,k is given as follows: Fig. 9 shows the results of calculation of C α, k for some K, α values. Incidentally, the evaluation of S/N is the same as already described. As described above, the present invention makes encoding while utilizing not only the local redundancy of the image but also its global redundancy, and can therefore make high data compression. Furthermore, since the inside of the block is encoded by use of the brightness slope, the portions having the brightness slope which is nearly constant can be compressed as one block.

Claims: A method of encoding image data by dividing the image into rectangular blocks of non-equal size in accordance with changes in brightness data, characterized in that said dividing into blocks is performed so that an error generated by approximation of the brightness data of each block with respect to two mutually perpendicular directions of the image does not exceed a predetermined allowable value, and that said brightness data of the blocks are encoded in a tree-structure. The method of claim 1, wherein said error is the mean square error of brightness of the image elements in each block. The method of claim 1, wherein said approximation is performed by use of the mean brightness and brightness slope of said brightness data.

Inventors: MIYAOKA, SHINICHIRO, SASAKI, RYOICHI, SHIRAISHI, TAKAYOSHI
Applicants: HITACHI, LTD.
Application year: 1986
Main classification: H04N1
IPC codes: G06T9, H04N1, H04N7