Abstract:
There is disclosed an image processing apparatus in which variable-length compression is performed, e.g. by orthogonally transforming input image data in units of frames, and quantizing the transformed image data. A quantization coefficient used in coding a last image on the basis of image data quantities of a plurality of frames which have been compressed, is controlled.

Description:
This application is a continuation of application Ser. No. 08/098,865 filed Jul. 29, 1993, now abandoned. 
    
    
     BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates to an image recording method and apparatus for digital-recording a plurality of frames of image data, an image processing apparatus, and an image reading method for reading an image. 
     2. Related Background Art 
     Conventionally, a technique for compressing a plurality of frames of image data, and recording compressed image data on a recording medium is known. 
     As an example of such a technique, a compression method for orthogonally transforming input image data, and quantizing converted coefficients, e.g., a compression method called a JPEG method, is known. 
     When a plurality of input image data are compressed to fixed-length data using such a compression method, if the code quantity assigned per image is represented by L, a two-pass compression method is repetitively performed from the beginning to the end of continuous photographing operations of n images, to keep code quantities L 1  to L n  of the n images equal to or smaller than the code quantity L. 
     However, in this prior art approach, since two-step coding is performed in each photographing operation in a continuous recording mode, the data compression operation requires much time, and limits any increase in continuous recording speed which might otherwise be achievable. 
     More specifically, in the above-mentioned method, in order to limit input image data to a predetermined code quantity, compression must be attempted several times while changing quantization coefficients, resulting in the long data compression time. In particular, this method limits an increase in speed in continuous photographing operations. 
     SUMMARY OF THE INVENTION 
     It is an object of the present invention to provide an image processing apparatus and method, which can perform high-speed continuous recording operations in consideration of the above-mentioned situation. 
     It is another object of the present invention to provide an image processing method and apparatus, which can attain a substantially fixed compression ratio. 
     In order to achieve the above objects, according to a preferred aspect of the present invention, there is disclosed an image processing apparatus comprising compression means for performing variable-length data compression by orthogonally transforming input image data in units of frames (image planes), and quantizing the transformed data, and control means for, when a series of a plurality of frames of image data are compressed, controlling the compression means on the basis of the data quantities of a plurality of frames compressed by the compression means. 
     It is still another object of the present invention to provide an image reading method and apparatus, which can reduce a time lag from an input of a recording instruction until a coding operation ends in practice. 
     It is still another object of the present invention to provide an image processing apparatus having novel functions. 
     Other objects and features of the present invention will become apparent from the following description of the embodiment taken in conjunction with the accompanying drawings. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a chart showing a coding sequence in a continuous photographing mode according to the first embodiment of the present invention; 
     FIG. 2 is a flow chart showing coding by a one-pass method; 
     FIG. 3 is a block diagram of an electronic still camera according to the first embodiment; 
     FIG. 4 is a chart showing an image pickup sequence for photographing a single image; 
     FIG. 5 is a chart showing a sequence as a comparative example of the present invention upon executing compressed coding when a switch  124  is set in a continuous photographing mode; 
     FIG. 6 is a flow chart showing the first step of a two-pass method; 
     FIG. 7 is a flow chart showing the second step of the two-pass method; 
     FIGS. 8A and 8B are views showing an image divided into blocks; 
     FIGS. 9A to  9 C are views showing DCT coefficients in units of blocks; 
     FIGS. 10A and 10B are views for explaining a method of coding quantized DCT coefficients; 
     FIG. 11 is a chart showing a sequence according to the second embodiment of the present invention; and 
     FIG. 12 is a chart showing a sequence according to the third embodiment of the present invention. 
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     FIG. 3 is a block diagram of an electronic still camera as an image recording apparatus according to the first embodiment of the present invention. The camera comprises a lens  101 , an aperture  102 , a shutter  103 , a solid state image pickup element  104  for converting an image into an electrical signal, an AD conversion circuit  105  for AD-converting an output from the solid state image pickup element, and a memory  106  for temporarily storing data so as to process the AD-converted signal. The camera also comprises the following components. A signal processing circuit  107  calculates a luminance signal and color difference signals from an output from the solid state image pickup element  104  read out from the memory  106 , and stores the calculation results in the memory  106 . A DCT (discrete cosine transform) conversion circuit  108  divides a signal from the memory  106  into 8×8 blocks, DCT-converts each block into 8×8 DCT coefficients, and stores the coefficients in the memory  106 . A quantization circuit  109  quantizes the DCT coefficients so as to compress the code quantity of the DCT coefficients read out from the memory  106 . A quantization table  110  sets quantization coefficients used in quantization of the DCT coefficients. A quantization step adjusting circuit  111  adjusts the quantization step by multiplying the coefficients in the quantization table with coefficients. A zigzag scanning circuit  112  zigzag-scans the quantized DCT coefficients in units of blocks. A DPCM circuit  113  performs another compression of the data quantity by calculating a difference in DC components of the DCT coefficients between blocks. A Huffman coding circuit  114  Huffman-codes an output from the DPCM circuit. A Huffman table  115  is referred to in performing the Huffman coding. A run-length coding circuit  116  counts an interval between non-zero coefficients, i.e., a run length of zeros, in AC components of zigzag-scanned DCT coefficients. A truncation circuit  117  forcibly sets high-order coefficients to be zero when a code length assigned to each block is about to be exceeded. A Huffman coding circuit  118  assigns Huffman codes to a zero run length and non-zero coefficients. A Huffman table  119  is referred to by the Huffman coding circuit. A circuit  120  detects a quantity of codes (to be referred to as code quantity detecting circuit  120  hereinafter). A memory card  121  records compression-coded data. Coefficient values to be multiplied with coefficients in the quantization table in the quantization step adjusting circuit  111  and a code quantity to be assigned to each block are determined so as to attain a target code quantity on the basis of the code quantity detected by the code quantity detecting circuit  120 . In this embodiment, when the code quantity is about to exceed a designated quantity, high-order coefficients of AC coefficients are forcibly set to be zero, thus truncating coding. The camera further comprises a system controlling circuit  122  for controlling the operation of the entire system, a release switch  123  for starting a photographing operation, and a mode change switch  124  for selecting a continuous photographing mode when it is ON; selecting a single photographing mode when it is OFF. 
     FIG. 4 is a chart showing an image pickup sequence for photographing a single image. When the release switch  123  is turned on at time T 0 , a photometry operation is performed during a time interval from time T 0  to time T 1 , and a roughly proper shutter speed and aperture value are determined. An ante-exposure operation is performed by opening the shutter  103  during a time interval from time T 1  to time T 2 . After the shutter  103  is closed at time T 2 , an exposure electric charge is read. An optimum exposure amount is calculated based on the actual exposure electric charge information during a time interval from time T 3  to time T 4 . At time T 4 , the shutter  103  is opened again to perform a main exposure operation. During a time interval from time T 5  to time T 6 , an exposure electric charge is read, is AD-converted by the AD conversion circuit  105 , and is stored in the memory  106 . During a time interval from time T 6  to time T 7 , data is read out from the memory  106  to the signal processing circuit  107 , thereby generating a luminance signal (Y), a color difference signal (R-Y), and a color difference signal (B-Y). During a time interval from time T 7  to time T 8 , DCT conversion is performed by the DCT conversion circuit  108 . During a time interval from time T 8  to time T 9 , compression coding is performed by a method to be described later. A compressed image signal is recorded in the memory card  121  during a time interval from time T 9  to time T 10 . 
     Prior to a DCT calculation performed upon compression, image data is normally divided into blocks each consisting of 8×8 pixels. FIGS. 8A and 8B show an image divided into blocks. As shown in FIG. 8A, an image is divided into blocks each consisting of 8×8 blocks in turn from the upper left portion of a frame, and pixels in units of blocks are indexed by S 00  to S 77 , as shown in FIG.  8 B. FIGS. 9A to  9 C show DCT coefficients in units of blocks. When 8×8 pixel signals shown in FIG. 8B are subjected to a DCT calculation given by the following equation (1), 8×8 DCT coefficients S 00  to S 77  are obtained, as shown in FIG.  9 A. An inverse DCT calculation is given by equation (2) below.                S   vu     =       1   4          C   u          C   v            ∑     x   =   0     7            ∑     y   =   0     7            s   yx        cos            (       2      x     +   1     )        u                 π     16        cos                       (       2      y     +   1     )        v                 π     16                     (   1   )                 S   yx     =       ∑     x   =   0     7            ∑     y   =   0     7            C   u          C   v          S   uv        cos            (       2      x     +   1     )        u                 π     16        cos                       (       2      y     +   1     )        v                 π     16                   (   2   )                                
     Quantized DCT coefficients Sq 00  to Sq 77  are obtained by dividing DCT coefficients corresponding to indices by Q′ 00  to Q′ 77  obtained by multiplying coefficients Q 00  to Q 77  shown in a quantization table in FIG. 9B with a quantization step correction coefficient F. 
     FIGS. 10A and 10B are views for explaining a method of coding quantized DCT coefficients. The quantized DCT coefficients Sq 00  to Sq 77  are zigzag-scanned in the order shown in FIG.  10 A. In this manner, the DCT coefficients are sorted from Sq 00  indicating a DC component of the block in the ascending order of spatial frequency. With this zigzag scan, as shown in FIG. 10B, Sq 00  indicating a DC component, i.e., a DC coefficient, and AC coefficients Sq 01  to Sq 77  indicating AC components are aligned. As a nature of a general image, an energy component having a high spatial frequency will often become small, and AC coefficients of high-frequency components often become zero by the above-mentioned quantization. Therefore, by Huffman-coding a pair of a run length of zeros between non-zero coefficients of zigzag-scanned AC coefficients, and a non-zero coefficient following the zeros, the data quantity of the AC coefficients can be compressed. On the other hand, the data quantity of a DC coefficient is compressed by Huffman-coding a DPCM predicted value as a difference from a DC coefficient of an adjacent block. In this case, the code quantity increases/decreased depending on the way of quantization. If coarse quantization is performed, since AC coefficients include many zero components, the data quantity decreases, but image quality deteriorates. 
     FIG. 5 is a chart showing a sequence as a comparative example for presenting the effect of this embodiment upon execution of compressed coding when the switch  124  is set in a continuous photographing mode. Coding using DCT is basically variable-length coding. However, a certain fixed-length coding method is normally adopted to record a predetermined number of images in a card. In order to achieve such fixed-length coding, a two-pass method is known. FIGS. 6 and 7 show an algorithm of the two-pass method. FIG. 6 shows the first step of the two-pass method, and FIG. 7 shows the second step of the two-pass method. 
     A fixed-length coding method will be briefly described below with reference to FIGS. 6 and 7. Prior to coding, a DCT calculation is performed to convert image data of each block into DCT coefficients, and the DCT coefficients are stored in the memory. In the first step, a quantization width is set by temporarily setting a quantization step correction coefficient F for the quantization table. Then, quantization, zigzag scan, and coding are performed. The code quantity of each block is calculated to predict a quantization step correction coefficient F in the second step so that the code quantity of the entire image becomes a target code quantity, and a maximum code quantity is assigned to each block so as to achieve the target code quantity, thus finishing the first step. In the second step, the quantization width is set based on the quantization step correction coefficient F set in the first step, and quantization, zigzag scanning, and coding are performed. Upon coding of AC coefficients, when the code quantity is about to exceed an assigned quantity of each block, coding of high-frequency components of the block is truncated to prevent the code quantity from exceeding a preset code quantity, thus achieving fixed-length coding. Various marker codes required in decoding are added to encoded data, thus finishing the second step. 
     In the above-mentioned method of the comparative example, since data compression is performed after two-step coding, the time required for data compression is prolonged. 
     A coding sequence in a continuous photographing mode according to the first embodiment of the present invention will be described below with reference to FIG.  1 . FIG. 2 is a flow chart showing coding by a one-pass method. 
     The operation of the first embodiment of the present invention will be described below with reference to FIGS. 1 and 2. When the release switch  123  is turned on while the mode change switch  124  is set in the continuous photographing mode, a continuous photographing operation is started. In the apparatus of this embodiment, the first image in the continuous photographing operation is coded by the one-pass method. Coding of the one-pass method is performed in a procedure shown in FIG.  2 . More specifically, the quantization step correction coefficient F is set in advance to be a predetermined value (S 101 ), and quantization (S 103 ), zigzag scanning (S 105 ), coding (S 107  to S 113 ), addition of marker codes (S 119 ), and calculation of a code quantity (S 115 ) are performed. The operation in the continuous photographing mode will be described below with reference to FIG.  1 . In this case, since the code quantity obtained by compressing the first image does not often coincide with a quantity assigned to each image, the first image is not recorded in the card. If the code quantity of an image assigned to each image is represented by L, an empty space L is assured on the card, and non-compressed image data is temporarily stored in the memory  106  until the end of the continuous photographing operation. Note that the memory  106  has enough capacity for two images. In the first image compression process, the quantization width (step) of the next image is determined. In the continuous photographing mode, since patterns do not largely change between two adjacent images, the quantization step for compression of the next image to be photographed can be determined to be an almost proper value by evaluating the image to be recorded first. If the code quantity of an image assigned to each image is represented by L, a code quantity obtained upon compression of the first image of the continuous photographing operations does not often coincide with L. However, as described above, since the quantization width (step) determined in the first image compression process is used, the code quantities of the second and subsequent images in the continuous photographing mode can be set to be almost equal to L. When the release switch  123  is turned off, the continuous photographing operation is finished. If the number of continuously photographed images is represented by n, the code quantity assigned to each image is represented by L, the code quantity of the second image is represented by L 2 , and the code quantity of an n-th image is represented by L n , compressed coding is performed by the above-mentioned two-pass method, so that L 1  becomes equal to a code quantity obtained by subtracting a sum of code quantities L 2  to L n  from a product nL of assigned code quantities per image in the continuous photographing mode. 
     FIG. 11 is a chart showing a coding sequence in a continuous photographing mode according to the second embodiment of the present invention. 
     The operation of this embodiment will be described below with reference to FIGS. 11 and 2. When the release switch  123  is turned on while the mode change switch  124  is set in the continuous photographing mode, a continuous photographing operation is started. In this case, the first image is coded by the above-mentioned one-pass method shown in FIG.  2 . In this embodiment, as shown in FIG. 11, if the code quantity assigned to each image is represented by L, the quantization step correction coefficient F is set, so that the code quantity of the first image becomes sufficiently smaller than  2 L. Note that even when the compressed code quantity of the first image does not coincide with the quantity L assigned to each image, the compressed data is recorded. In the compression process of the first image, the quantization width of the next image is determined. In the continuous photographing mode, since patterns do not largely change between two adjacent images, the quantization step for compression of the next image to be photographed can be determined to be an almost proper value by evaluating the image to be recorded first. If the code quantity assigned to each image is represented by L, although the code quantity of the first image in the continuous photographing mode does not often coincide with L, the code quantity of the second and subsequent images can be set to be almost equal to L. When the release switch  123  is turned off, the continuous photographing operation is finished. If the number of continuously photographed images is represented by n, the code quantity assigned to each image is represented by L, the code quantity of the first image is represented by L 1 , the code quantity of the (n−1)-th image is represented by L (n−1) , and the code quantity of the n-th image is represented by L n , compressed coding is performed by the two-pass method, so that L n  becomes equal to a code quantity obtained by subtracting a sum of code quantities L 1  to L (n−1)  from a code quantity as a product nL of code quantities assigned to each image in the continuous photographing mode. 
     Since the last image before the end of the continuous photographing operation is compressed after the end of continuous photographing operation, this operation can take a relatively long period of time. Therefore, in place of the two-pass method, coding by the one-pass method may be repeated while changing the quantization step correction coefficient F until the code quantity converges to L n . 
     The present invention is not limited to an electronic still camera but may be applied to an image filing apparatus, a color copying machine, and the like. 
     According to this embodiment, the time required for performing data compression coding of a code quantity per image in the continuous recording mode can be shortened, and the continuous recording speed can be increased. 
     A photographing sequence according to the third embodiment of the present invention will be described below with reference to FIG.  12 . 
     The hardware arrangement of this embodiment is the same as that of the embodiment shown in FIG. 3, and a detailed description thereof will be omitted. This embodiment adopts a different procedure of a photographing sequence, as shown in FIG.  12 . 
     FIG. 12 is a chart showing a photographing sequence according to the third embodiment of the present invention. 
     The operation of this embodiment will be described below with reference to FIG.  12 . 
     The operations up to time T 4 ′ are the same as those up to time T 4  in FIG.  4 . At time T 4 ′, the shutter  103  is opened to start a main exposure operation. At the same time, a signal exposed in the ante-exposure operation is read out from the memory  106 , and is subjected to a signal processing operation. During a time interval from time T 5 ′ to time T 6 ′, DCT conversion is performed. During a time interval from time T 6 ′ to time T 8 ′, the operations in the first step of compressed coding by the two-pass method shown in FIG. 6 are performed. The main exposure operation ends at time T 7 ′ (in some cases, the main exposure operation may end after the end of the first step of compressed coding depending on the exposure time). During a time interval from time T 8 ′ to T 9 ′, an exposure electric charge is read, and during a time interval from time T 9 ′ to time T 10 ′, a signal process for the main exposure signal is performed. Then, during a time interval from time T 10 ′ to T 11 ′, DCT conversion, and during a time interval from time T 11 ′ to time T 12 ′, the operations in the second step of compressed coding shown in FIG. 7 are performed. During a time interval from time T 12 ′ to time T 13 ′, compressed data is recorded in the memory card  121 . Since an image in the ante-exposure mode is almost equal to that in the main exposure mode, the time required for compression can be shortened by calculating an optimum quantization step for the main exposure mode on the basis of ante-exposure data during the main exposure operation. 
     In the above embodiments, DCT is used as an orthogonal transform method. However, the present invention is not limited to this. For example, Hadamard transform or K-L transform may be adopted. 
     In the above embodiments, the present invention is applied to an electronic still camera. However, the present invention is not limited to the electronic still camera, but may be similarly applied to an original reader as OA equipment such as a flat-bed scanner. 
     According to this embodiment, the time required for compression can be shortened, and the time required for data compression coding can be shortened, thus increasing the continuous photographing speed.