Abstract:
An electronic camera includes: an image sensor for converting an optical image relating to a photographic object into electric signals; a processor for compress-processing image data corresponding to the electric signals at a predetermined compression ratio for each of a plurality of blocks to obtain compressed image data. The processor compares a data amount of the compressed image data with a predetermined amount of data, and compress-processes again the image data at a compression ratio greater than the predetermined compression ratio only when the data amount of the compressed image data exceeds the predetermined amount of data. The electronic camera further includes a recorder for storing the compressed image data compress-processed by the processor in a memory medium.

Description:
BACKGROUND OF THE INVENTION  
         [0001]    This invention relates to an image processing technology, and in particular, to an image processing technology for use in an electronic camera.  
           [0002]    Accompanied by the improvement of the electronic technology, an electronic camera which converts an image sensed into digital data to memorize them has been developed and already on the market. A user can display an image that has been sensed by an electronic camera on the display of his own personal computer for example, and further, can print the image through a printer; therefore, its range of application has become broad.  
           [0003]    Incidentally, an image which has been sensed by an electronic camera is converted into image data, which are stored in a memory as compressed. In this case, the image data volume after compression processing (what is called the file size) usually varies in accordance with the photographic object sensed. That is, a low frequency image such as the sky is compressed with its file size made comparatively small, and a high frequency image such as a woods is compressed with its file size made comparatively large. Such compression processing is called compression processing of variable length.  
           [0004]    Owing to such a characteristic of compression as mentioned above, assuming that the memory capacity of the memory medium of an electronic camera is constant, there is a problem that it cannot be known until image sensing has been completed how many image frames can be stored in such a memory medium; this is different from a camera for a silver halide film.  
           [0005]    For such kind of a problem, compression processing of fixed length has been developed. According to such compression processing of fixed length, for example, in the case where the file size is fixed at 100 KB, because all images are stored as compressed to 100 KB, 80 image frames can be stored in the case where a memory medium of 8 MB is used; therefore, a user of an electronic camera can immediately understand how many image frames are left to be sensed, which is convenient to him.  
           [0006]    However, in the compression processing of fixed length, there is a problem that it needs pre-processing in which the frequency component of the image is analyzed beforehand so as to determine the ratio of compression, which makes the processing time increase. For such a problem, it has been also considered that a high ratio of compression is set beforehand in order that an image of any kind may be made always to have a file size of 100 KB or under. However, if the ratio of compression is set at a high value, image quality becomes low in proportion to it; therefore, the actual situation is that compression processing of an excessively high compression ratio should be avoided.  
         SUMMARY OF THE INVENTION  
         [0007]    This invention has been made in view of the above-mentioned problems in the conventional technology, and it is an object of the invention to provide an image data processing method and an electronic camera which is capable of securing the number of image frames of the image data to be stored in the memory medium while suppressing the processing time for image data.  
           [0008]    In order to accomplish the above-mentioned object, the invention has any one of the following structures:  
           [0009]    1. An electronic camera comprising: an image sensor for converting an optical image of a photographic object into an electrical signal to be obtained; a processor for applying compression processing to the image data corresponding to the electrical signal at a specified compression ratio for each of a plurality of blocks to obtain compressed image data, wherein the processor compares the data volume of the compressed image data with a specified data volume, and only when the data volume of the compressed image data exceeds the specified data volume, the processor applies compression processing again to the image data at a compression ratio higher than the specified compression ratio; and a recording means for storing the compressed image data which have been compression-processed by the processor in a memory medium.  
           [0010]    2. An image data processing apparatus comprising: input means for inputting image data; and a processor for applying compression processing to the image data for each of a plurality of blocks at a specified compression ratio to obtain compressed image data, wherein the processor compares the data volume of the compressed image data with a specified data volume, and only when the data volume of the compressed image data exceeds the specified data volume, the processor applies compression processing again to the image data at a compression ratio higher than the specified compression ratio.  
           [0011]    3. A method of processing image data comprising the steps of: inputting image data; and applying compression processing to the image data for each of a plurality of blocks at a specified compression ratio to obtain compressed image data, wherein the step of obtaining compressed image data comprises comparing the data volume of the compressed image data with a specified data volume, and only when the data volume of the compressed image data exceeds the specified data volume, practicing compression processing again the image data at a compression ratio higher than the specified compression ratio.  
           [0012]    Further, it is preferable that the method of processing image data of this invention comprises the steps of sensing an image of a photographic object, converting it into image data corresponding to it, carrying out compression processing of said image data at a specified compression ratio for each of a plurality of blocks, comparing the data volume of the image data that have been compression-processed with a specified data volume, and if it exceeds the specified data volume, carrying out compression processing of said image data again at a compression ratio higher than said specified compression ratio.  
           [0013]    The examples of preferable structures are as follows.  
           [0014]    (1) A method of processing image data characterized in that an image of a photographic object is sensed, and is converted into corresponding image data, which are compression-processed at a specified compression ratio for each of a plurality of blocks, and the data volume of the image data which have been compression-processed is compared with a specified data volume, and only when the former exceeds the latter, the image data are again compression-processed at a compression ratio higher than the specified compression ratio.  
           [0015]    (2) The method of processing image data set forth in the structure (1) characterized in that the alteration of the quantization table is carried out when the image data are again compression-processed.  
           [0016]    (3) The method of processing image data set forth in the structure (1) or (2) characterized in that the data volume of the image data which have been again compression-processed is changed on the basis of at least one of the number of blocks which have been compression-processed and the coefficient.  
           [0017]    (4) The method of processing image data set forth in the structure (1) characterized in that the data volume of the image data which have been again compression-processed is changed on the basis of at least one of the proportion of the number of blocks which have been compression-processed to the number of total blocks and the coefficient.  
           [0018]    (5) The method of processing image data set forth in the structure (3) or (4) characterized in that the coefficient is changed on the basis of the data volume of the image data.  
           [0019]    (6) The method of processing image data set forth in any one of the structures (3) to (5) characterized in that the coefficient is changed on the basis of the specified data volume.  
           [0020]    (7) The method of processing image data set forth in any one of the structures (3) to (6) characterized in that the coefficient is changed in accordance with the number of times of the change.  
           [0021]    (8) An electronic camera practicing the method of processing image data set forth in any one of structures (1) to (7) characterized in that the compression-processed image data are stored in a memory medium.  
           [0022]    (9) An electronic camera as set forth in the structure (8) characterized in that the specified data volume is changed in accordance with the remaining memory capacity of the memory medium.  
           [0023]    According to the method of processing image data of the invention, when data volume of the image data after being compressed at the specified compression ratio, is small, the image data are stored as they are, which secures the rapidity of the processing and the image quality, and on the other hand, only when the image data have a large data volume after being compressed at the specified compression ratio, the image data are compressed again, which makes it possible to store more image data even when the storing capacity of a memory medium is limited.  
           [0024]    Further, it is preferable that the alteration of the quantization table is carried out when the image data are compressed again.  
           [0025]    Further, it is preferable that the data volume of the aforesaid image data which have been compression-processed again is altered on the basis of at least one of the number of the blocks that have been compression-processed and the coefficient.  
           [0026]    Further, it is preferable that the data volume of the aforesaid image data which have been compression-processed again is changed on the basis of at least one of the proportion of the number of the blocks that have been compression-processed to the number of all blocks and the coefficient, because the processing can be carried out rapidly.  
           [0027]    Further, it is preferable that the aforesaid coefficient is changed on the basis of the data volume of the aforesaid image data.  
           [0028]    Further, it is preferable that the aforesaid coefficient is changed on the basis of the aforesaid specified data volume.  
           [0029]    Further, it is preferable that the aforesaid coefficient is changed in accordance with the number of times of the change.  
           [0030]    Further, in an electronic camera, it is preferable that the aforesaid method of image data processing is practiced, and the aforesaid image data which have been subjected to compression processing are stored in a memory medium. The reason of this is that, in an electronic camera, a memory medium having a limited capacity is used in most cases.  
           [0031]    In this case, it is preferable that the aforesaid specified data volume is changed in accordance with the remaining memory capacity of the aforesaid memory medium, because a user can be informed of, for example, how many frames more can be sensed.  
       
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS  
       [0032]    [0032]FIG. 1 is a block diagram showing the structure of an electronic camera according to this embodiment of the invention;  
         [0033]    [0033]FIG. 2 is a drawing showing an example of an image photographed by an electronic camera;  
         [0034]    [0034]FIG. 3 is a flow chart showing the operation practiced in the image processing means  2 ; and  
         [0035]    [0035]FIG. 4( a )- 1  to FIG. 4( c )- 4  are drawings showing examples of the relation between quantization tables and file sizes; and  
         [0036]    [0036]FIG. 5( a ) and FIG. 5( b ) are drawings showing a quantization table before alteration (FIG. 4( a )) and a quantization table after alteration (FIG. 4( b )) in comparison. 
     
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT  
       [0037]    In the following, an embodiment of this invention will be explained by referring to the drawings.  
         [0038]    [0038]FIG. 1 is a block diagram showing the structure of an electronic camera according to this embodiment of the invention. In FIG. 1, the image sensing system  1  including a photographing lens and an image sensing device such as a CCD sensor converts an image of a photographic object into image data and outputs them, on the basis of a drive signal from the user interface  3  including a release switch etc. The outputted image data are once stored in the memory  5  temporarily, and then, after they are subjected to compression processing and gradation correction in the image processing means  2 , they are supposed to be stored as stored in the memory medium  4  such as a memory card. In addition, in this embodiment, the image processing means  2  is also used as the recording means for performing the data recording in the memory medium  4 .  
         [0039]    Next, the method of image data processing in an electronic camera of this embodiment will be explained. FIG. 2 is a drawing showing an example of an image photographed by an electronic camera, and FIG. 3 is a flow chart showing the operation practiced in the image processing means  2 .  
         [0040]    First, it is assumed that image data are obtained by the image sensing system  1  and stored in the memory  5 . Such image data are divided into a plurality of blocks by the image processing means  2  for the convenience of processing in it. In the step S 101  in FIG. 3, the image processing means  2  starts compression processing on the basis of the preset quantization table. Because the image data are arranged in lines from the upper left portion of the image G in FIG. 2 toward the right direction in such a manner as to connect the lines to one another, compression processing is carried out in this order.  
         [0041]    After the compression processing for the first block ( 1 ) is finished (step S 102 ), the image processing means  2  judges, in the step S 103 , whether the file size of the block ( 1 ) which has been just compression-processed exceeds the specified file size or not. In the above statement, the specified file size means a target file size in the case where all the blocks of the image G, for example, are subjected to compression processing.  
         [0042]    If the image processing means  2  judges that the file size of the compression-processed block ( 1 ) does not exceeds the specified file size, it continues to carry out compression processing on and after the succeeding block ( 2 ). On the other hand, if it judges that the file size of the block ( 1 ) exceeds the specified file size, it alters the quantization table to make the ratio of compression higher (step S 104 ).  
         [0043]    [0043]FIG. 4( a )- 1  to FIG. 4( c )- 4  are drawings showing the examples of the relation between quantization tables and file sizes.  
         [0044]    The scene ( 1 ) shown in FIG. 4( a ) is a high frequency image, the scene ( 3 ) is a low frequency image, and the scene ( 2 ) is an image having a frequency intermediate between the scene ( 1 ) and scene ( 3 ). The results presenting the file sizes after compression processing when compression processing using the quantization tables ( 1 ) to ( 4 ) shown in FIG. 4( c )- 1  to FIG. 4( c )- 4  respectively is applied to the image data obtained by photographing these images are shown in FIG. 4( b ). The quantization tables shown in FIG. 4( c )- 1  to FIG. 4( c )- 4  give compression ratio which are made larger in the order from ( 1 ) to ( 4 ). Moreover, as clearly understood from FIG. 4( b ), the file size after compression processing becomes smaller the higher compression ratio is raised, and the file size after compression processing becomes larger the higher the frequency of the image data becomes.  
         [0045]    [0045]FIG. 5( a ) and FIG. 5( b ) are drawings showing the quantization table before alteration and the quantization table after alteration in comparison. The quantization table to be set after n-th alteration is determined on the basis of the following expression: 
         n-th quantization table=(quantization table determined by the (n−1)th alteration)×αn, 
         [0046]    where αn denotes an arbitrary coefficient. Further, it is preferable that the n-th quantization table is expressed by the following equation by substituting ((number of total blocks)/(number of processed blocks))×(n-th coefficient) for αn: 
         n-th quantization table=(quantization table determined by (n−1)th alteration)×((number of total blocks)/(number of processed blocks))×(n-th coefficient). 
         [0047]    In the above expression, when n=1, the “quantization table determined by (n−1)th alteration” means the specified quantization table that has been stored.  
         [0048]    Further, the “number of total blocks” means the total number of divisional blocks when the image data are divided into blocks, and the “number of processed blocks” means the cumulative number of blocks to which compression processing has been applied by using the quantization table before the alteration of the quantization table.  
         [0049]    To take the value of the last element in the quantization table, in the example shown in FIG. 5( a ) and FIG. 5( b ), for example, in the case where the number of total blocks is 7500 and the number of processed blocks is 5200, after n-th coefficient is made 2, the values are substituted for the terms in the right-hand side of the above expression; then, 10 (the last element value in the quantization table before alteration)×7500/5200×2=28 (the last element value in the quantization table after alteration) can be obtained.  
         [0050]    It is preferable that the n-th coefficient is a value that increases in accordance with the number of times of alteration of the quantization table. If this is made to be constant, in the case where the file size of image data after compression processing is considerably large, it becomes necessary to alter the quantization table several times until the file size becomes the specified file size or under, and a long time is estimated for the procedure. Therefore, it is judged that the file size becomes larger the more the number of times of alteration becomes, and unnecessary compression processing can be avoided by making the n-th coefficient variable to increase in accordance with the number of times of alteration (for example, to make it power of n).  
         [0051]    Further, for the technique of determining the n-th coefficient, it can be also considered to make it a value that is proportional to the difference between the file size of the block before compression processing and the specified file size.  
         [0052]    As explained in the foregoing, the operation such that the sum of the file sizes of the blocks which have been compression-processed block by block is successively compared with the specified file size is continued until the last block (step S 105 ); then, if the file size after compression processing does not exceed the specified file size, the image processing means  2  completes compression processing, and the image data that have been compression-processed are stored in the memory medium  4 .  
         [0053]    The method of image data processing of this embodiment is practically effective in a use to be described in the following. That is, the maximum file sizes in the respective image quality modes of an electronic camera are made to be 800 KB (superfine mode), 400 KB (fine mode), and 100 KB (normal mode), and only image data that exceeds the above size concerned are to be subjected to compression processing. By doing this way, it is understood that, in the case where image data are stored in a memory medium of 8 MB, 10 image frames and more (in superfine mode), 20 image frames and more (in fine mode), and 80 image frames and more (in normal mode) can be sensed without fail.  
         [0054]    Further, when the remaining capacity of the memory medium becomes small, 700 KB for example, in the case where image sensing is done in the superfine mode, by changing the specified file size to 700 KB, the remaining number of frames for photographing can be exactly displayed as one frame for example. In this case, it can also be considered to change the above-mentioned n-th coefficient. On the other hand, in the case where image sensing is done in the fine mode, by making the image data of the first frame 400 KB or under and the image data of the second frame 300 KB, the remaining number of frames to be photographed can be exactly displayed as two frames, and this can be actualized; therefore, an electronic camera that is more friendly to users can be provided.  
         [0055]    According to the method of processing image data of this embodiment, a pre-processing which has been necessary for a conventional compression processing of fixed length is not required, it is also unnecessary to take the trouble to make image data having small file size large, and it is possible to secure the number of image frames to be stored in a memory medium of constant memory capacity by applying compression processing to image data having a large file size only.  
         [0056]    Up to now, this invention has been explained by referring to an embodiment, but this invention should not be construed as limited to the above-mentioned embodiment, and it is a matter of course that the invention can be suitably altered and improved.  
         [0057]    According to this invention, it is possible to provide an image data processing method and an electronic camera which is capable of securing the number of image frames of the image data to be stored in the memory medium while supressing the processing time for image data.