Image encoding apparatus
This application is a continuation of application Ser. No. 07/401,240 filed Aug. 31, 1989, now abandoned. 
    
    
     BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates to an image encoding apparatus for progressively encoding binary image. 
     2. Related Background Art 
     In a facsimile apparatus as a typical still image communication apparatus, a method of encoding an image in accordance with MH or MR coding by sequentially scanning the image is employed. In this method, in order to recognize the entire image, all the image data must be transmitted, resulting in a long transmission time. Therefore, it is difficult to apply this method to an image communication service such as an image data base service, a videotex, or the like, in which an image must be quickly judged. 
     Unlike the method employed in the facsimile apparatus, a sequential reproducing/encoding method, e.g., progressive coding, is proposed in which rough image data is transmitted before the entire image is transmitted, and additional data is then transmitted to generate detailed image data. 
     In order to progressively encode binary image data, an image is sub-sampled to generate images having different resolutions, and the images are encoded from those having lower resolutions. 
     However, if image data is merely sub-sampled to form a low-resolution image, characters or fine lines may be disconnected or omitted before encoding. Therefore, encoded data obtained by encoding the low-resolution image does not properly express an original image. Therefore, an image obtained by decoding such encoded data cannot accurately reproduce the original image. 
     SUMMARY OF THE INVENTION: 
     The present invention has been made in consideration of the above situation, and has as its object to provide an image encoding apparatus for encoding an image so that an original image can be satisfactorily reproduced. 
     It is another object of the present invention to provide an image encoding apparatus which can form and encode a low-resolution image without omitting characters or fine lines in an original image. 
     It is still another object of the present invention to provide an image encoding apparatus which can satisfactorily encode images in respective stages upon progressive coding. 
     The above and other objects and features of the present invention will be apparent from the following description. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a block diagram showing an embodiment of an encoder to which the present invention is applied; 
     FIG. 2 is a block diagram of a reverse quantizing circuit; 
     FIG. 3 is a table showing filter coefficients of the reverse quantizing circuit; 
     FIG. 4 is a view showing positions of pixels to be sampled by a sampling circuit; 
     FIG. 5 is a block diagram of a binary encoding circuit; and 
     FIG. 6 is a table showing weighted coefficients. 
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT 
     FIG. 1 is a block diagram of an encoder to which the present invention is applied. 
     Binary data 100 representing an original image is stored in a first frame memory 1. Binary data 200 read out from the first frame memory 1 is subjected to low-pass filtering processing (3×3 filter) in a first reverse quantizing circuit 2, and is converted to multi-value data. The multi-value data is sub-sampled to a desired resolution (in this case, 1/2 that of an original image) by a first sampling circuit 3. The sub-sampled multi-value data is binary-encoded by an error diffusion method by a first binary encoding circuit 4. 
     Binary data 300 is input to a second reverse quantizing circuit 5 and a selector 8. The data 300 is subjected to low-pass filtering processing (3×3  filter) by the second reverse quantizing circuit 5 again to be converted to multi-value data. The multi-value data is sub-sampled to a 1/2 resolution (1/4 that of the original image) by a second sampling circuit 6. The multi-value data is binary-encoded by the error diffusion method by a second binary encoding circuit 7. 
     The selector 8 selects one of the signal 200 from the first frame memory, the signal 300 from the first binary encoding circuit, and a signal 400 from the second binary encoding circuit in accordance with data from a controller 9, and outputs the selected signal as a signal 500. 
     The signal 500 is subjected to MH coding by an encoding circuit 10, and is transmitted. 
     At a reception side, a decoding circuit 11 decodes the MH-encoded data, and a display 12 displays the decoded data. 
     FIG. 2 is a block diagram of the first reverse quantizing circuit 2. An input binary signal 20 is latched by latches 44a, 44b, and 44c to be delayed by one pixel clock, respectively. Line memories 43-a and 43-b hold input signals delayed by one line. Signals having pixel positions corresponding to those of the latches 44a, 44b, and 44c are obtained at latches 44d, 44e, and 44f, and latches 44g, 44h, and 44i. Thus, binary data corresponding to nine pixels constituting a 3×3 matrix shown in FIG. 3 can be obtained. The output signals from the latches 44a, 44c, 44g, and 44i are added by an adder 45a, and the sum is multiplied with a constant (×C 1 ) by a multiplier 46a. 
     The output signals from the latches 44b, 44d, 44f, and 44h are added by an adder 45b, and the sum is multiplied with a constant (×C 2 ) by a multiplier 46b. The output signal from the latch 44e as a central value is multiplied with a constant (×C 3 ) by a multiplier 46c. The values of the constants C 1 , C 2 , and C 3  indicate degrees of reverse quantization, and can be independently set by the external controller 9. In this case, standard values are set to be C 1  =C 2  =C 3  =1. 
     The output signals from the multipliers 46a, 46b, and 46c are added by an adder 47, and the sum is output as a multi-value signal 30. Note that the second reverse quantizing circuit 5 can be realized by the same arrangement as in FIG. 2. 
     FIG. 4 is a view for explaining the operation of the sampling circuits 3 and 6 used in the encoder shown in FIG. 1. Hatched pixel data in FIG. 4 are sampled at every other timings in main and sub scan directions, so that a sub-sampled image having a 1/2 size (1/4 in terms of an area) can be formed. This can be easily realized by adjusting latch timings of image data. 
     In this manner, binary data is converted to multi-value data in consideration of surrounding pixel data using the reverse quantizing circuit shown in FIG. 2 before the sub-sampling operation for decreasing a resolution. Sampling processing can be performed without ignoring image data which do not correspond to pixel positions but sub-sampling them in consideration of these image data, so that resolution conversion can be attained without losing original image data. 
     FIG. 5 is a block diagram of the first binary encoding circuit 4 using the error diffusion method of this embodiment. Multi-value image data X ij  is input from the first sampling circuit 3 to a terminal 900. A multiplier 67 multiplies input data with (255/(4C 1  +4C 2  +C 3 )) to normalize the input data to a value between 0 (inclusive) and 255 (inclusive). An error buffer memory 60 stores density errors ε ij  diffused up to a given timing in units of pixels. A group of errors ε ij  to be used in the error buffer memory 60 follows the multi-value data X ij  that a corresponding window 66 is moved as the multi-value data X ij  advances. A weighted coefficient circuit 61 multiplies an effective error α ij  with a predetermined weighted coefficient α kl  in the error buffer memory 60 to form a normalized correction value. 
     FIG. 6 shows an array of the weighted coefficients α kl . Assuming that a pixel position of the multi-value image data X ij  in the error buffer memory 60 is 66, this position also corresponds to a position indicated by &#34;*&#34; of the weighted coefficients α kl . 
     An adder 62 adds the normalized correction value to the input multi-value image data X ij  to form corrected data X&#39; ij . The above processing is expressed by the following equation. ##EQU1## 
     In this equation, the second term in the right-hand side indicates the normalized correction value. 
     The corrected data X&#39; ij  is compared with a threshold value T 4  (e.g., 128 gradation level) by a binary encoding circuit 63. If X&#39; ij  ≧ T 4 , the binary encoding circuit 63 outputs logic level &#34;1&#34; (corresponding to 255 gradation level) as output data Y ij  ; otherwise, it outputs logic level &#34;0&#34; (corresponding to 0 gradation level) as the output data Y ij  In this manner, the multi-value corrected data X&#39; ij  is binary-encoded. The binary data Y ij  is stored in an output buffer 65. 
     An arithmetic unit 64 subtracts the corrected data X&#39; ij  from the output data Y ij  (0=0 gradation level or 1=255 gradation level) and stores a new density error ε ij  generated upon printing of the corresponding pixel at the pixel position 66 of the error buffer memory 60. This operation is sequentially repeated by advancing the input multi-value image data X ij  pixel by pixel, thus executing binary encoding processing of the error diffusion method. In this case, error data of 12 surrounding pixels are used. However, the present invention is not limited to this, and error data of four surrounding pixels may be used. If the coefficients in the weighted coefficient circuit are set to be powers of the number of pixels, the weighted coefficient circuit can be constituted by a shift arithmetic operation. The second binary encoding circuit 7 can be realized by the same arrangement as in FIG. 5. 
     In this manner, multi-value image data whose resolution is decreased upon sampling at the sampling circuit 3 or 6 is not merely binary-encoded but is binary-encoded by the error diffusion method. 
     Thus, an error generated upon binary-encoding of multi-value data is diffused to surrounding pixels, and multi-value data is binary-encoded while preserving an image density. Omission of data caused by binary-encoding processing can be minimized. Therefore, characters, fine lines, and the like can be satisfactorily binary-encoded, and can be prevented from being disconnected or omitted. 
     The selector 8 outputs one of the signals 200, 300, and 400 as the signal 500 under the control of the controller 9. For example, the selector 8 selects the signal 400 in the first stage, and sends it to an encoding circuit 10. Thus, an image having a resolution 1/4 that of an original image can be encoded. After the 1/4-resolution image is transmitted, the control advances to the next stage. 
     In the next stage, the signal 300 is selected, and an image having a resolution 1/2 that of an original image is encoded and transmitted. Thereafter, the signal 200 is selected, and the original image is encoded and transmitted. 
     With the above method, an image can be progressively encoded and transmitted. 
     In this embodiment, the encoding circuit 10 and a decoding circuit 11 comprise a known MH encoder and decoder, and a detailed description thereof is omitted. The encoder and the decoder are not limited to the MH encoder and decoder but may be MR, MMR, arithmetic coding encoder and decoder, and the like. 
     For a color image, the circuit of this embodiment is prepared in correspondence with predetermined colors, thus obtaining a progressive encoding apparatus for a color binary image which is free from degradation in characters and fine lines. 
     In this embodiment, the number of stages is 3. However, the present invention is not limited to this, and required numbers of the reverse quantizing circuits, sampling circuits, and binary encoding circuits can be prepared to provide an N-stage encoding apparatus. 
     The above-mentioned processing including this embodiment can be easily realized by software processing using a microprocessor. 
     As described above, multi-value data obtained by reverse-quantizing binary image data is sub-sampled, and sub-sampled multi-value data is subjected to binary-encoding processing by the error diffusion method to preserve an image density of an original image. Therefore, good progressive data (encoded data) free from omission of characters and fine lines can be obtained. 
     The preferred embodiment of the present invention has been described. However, the present invention is not limited to this, and various changes and modifications may be made within the spirit and scope of the appended claims.