Patent Publication Number: US-2005122409-A1

Title: Electronic camera having color adjustment function and program therefor

Description:
CROSS REFERENCE TO RELATED APPLICATIONS  
      This application is based upon and claims the benefit of priority from Japanese Patent Application No: 2003-409055, filed on Dec. 8, 2003, and No. 2004-128721, filed on Apr. 23, 2004, the entire contents of which are incorporated herein by reference.  
     BACKGROUND OF THE INVENTION  
      1. Field of the Invention  
      The present invention relates to an electronic camera that performs color adjustments on a shot image as well as to a program for causing a computer to perform color adjustments.  
      2. Description of the Related Art  
      (Illumination Unevenness of a Flash)  
      In typical shooting with flash, an object is illuminated with complex light that is a mixture of a flash that is emitted from an electronic flash device and ambient light such as sunlight or light from streetlamps. The ratio between the flash illumination and the ambient light illumination varies in a complex manner depending on the distance to the object, the angle of the object, and other factors. Therefore, the color temperature of such mixed light varies greatly depending on the position in a frame.  
      For example, if a human object is shot with flash and with evening sunlight as backlight, it is mainly illuminated with flash. As a result, the human object exhibits a high color temperature (e.g., 5,000 K) of the flash. On the other hand, illuminated with evening sunlight, the background exhibits a low color temperature (e.g., 3,000 K).  
      Such color temperature unevenness in the same frame makes it very difficult to perform proper white balance adjustments.  
      Japanese Unexamined Patent Application Publication No. 8-051632 (hereinafter referred to as Reference 1) discloses an apparatus that performs white balance adjustments during flash shooting while dealing with the above problem.  
      This conventional apparatus makes preliminary shooting without flash and main shooting with flash. Then, it calculates a luminance difference on a pixel-by-pixel basis between the two shot images. A region with a large luminance difference is illuminated brightly with a flash and exhibits a high color temperature. On the other hand, a region with a small luminance difference is less affected by the flash and exhibits a low color temperature of ambient light.  
      In view of the above, the conventional apparatus performs white balance adjustment for flash shooting on image regions having large luminance differences; on the contrary, it performs white balance adjustment for shooting with ambient light on image regions having small luminance differences. It performs white balance adjustment for medium light between the flash and the ambient light on regions having medium luminance differences. Thus, the conventional apparatus calculates a pixel-based luminance variation that is caused by illumination/non-illumination with a flash and judges influences of the flash on the basis of magnitudes of the luminance variation.  
      However, the conventional apparatus cannot obtain an image captured with flash and an image captured without flash at the same time; the two images are always generated with a time difference. If an object moves or a camera shake occurs during this interval, the shot images do not completely coincide with each other in patterns. Such pattern deviations also cause the above-described luminance differences.  
      Therefore, for an object that moves at high speed in a frame, it is difficult to judge influences of a flash on the basis of luminance differences between two kinds of images and it is impossible to perform proper white balance adjustments.  
      In other words, to avoid the problem of the conventional apparatus, the object has to be stationary or the electronic camera need be fixed to a tripod, for example. Therefore, use of the conventional apparatus leads to limiting subjects or ways of shooting.  
      (Unevenness of Illumination by Fluorescent Lamps)  
      It is also known that a green fog may occur in an image which is shot under illumination with fluorescent lamps because of the wavelength characteristic of the fluorescent lamps.  
      Japanese Unexamined Patent Application Publication No. 2003-264850 (hereinafter referred to as Reference 2) discloses a technique for correcting such a green fog by white balance adjustments as well as a technique for weakening the green fog correction if the green color of an image is judged green of a plant based on a color analysis.  
      If the object is illuminated with fluorescent lamps unevenly, a green fog appears only in certain portions of the object and no green fogs appear in other portions that are illuminated with strong light of another kind (e.g., light from a light bulb or a flash).  
      For example, consider a case that a person is positioned in front of the camera with high-rise buildings (with many fluorescent lamps seen through the windows) in the background, and he/she is illuminated with light from a light bulb, and this scene is shot with slow synchronized shooting with flash of an electronic flash device. In this case, whereas a green fog due to the fluorescent lamps covers the light coming from the high-rise buildings that account for most of the background, almost no green fog covers a region in which the person stands in front of the camera because he/she is illuminated brightly with the light bulb or flash.  
      With a conventional green fog correction for such an image, a problem arises that an unnatural magenta fog occurs in the image region including the person which is free from the green fog, because the levels of red and blue components of the image region increase.  
      Heretofore, it has been impossible for an electronic camera to solve this problem automatically by image processing because it cannot judge properly whether green fogs occur in the entire image or only parts of it. That is because by the conventional technique color fogs are detected merely in limited regions of an image such as low-chroma regions. Therefore, it cannot be judged whether detected green fogs cover the entire image.  
     SUMMARY OF THE INVENTION  
      An object of the present invention is therefore to realize proper color balance adjustments on image data created by shooing under a complex illumination.  
      Another object of the invention is to provide a technique for judging influences of illumination unevenness reliably even for a moving object.  
      A further object of the invention is to provide a technique for properly judging whether color fogs due to a special light source (e.g., fluorescent lamp) have occurred in the entire image.  
      The invention will be summarized below.  
      (1) An electronic camera according to the invention includes the following imaging section, imaging control section, histogram calculating section, histogram correlation judging section, white balance calculating section, and white balance adjusting section.  
      The imaging section captures an image of an object. The imaging control section controls the imaging section to generate a test image captured without a flash and a main image captured with a flash.  
      The histogram calculating section generates respective histogram distributions for the test image and the main image.  
      The histogram correlation judging section judges correlation between the two histogram distributions.  
      The white balance calculating section determines a white balance adjustment value, placing importance on a color temperature of a flash, when judging that a flash has not illuminated an object evenly since the correlation is judged low, and determines a white balance adjustment value, placing importance on a color temperature of the main image, when judging that a flash has illuminated an object evenly or a flash has not reached an object evenly since the correlation is judged high.  
      The white balance adjusting section adjusts a white balance of the main image in accordance with the white balance adjustment value obtained by the white balance calculating section.  
      In the above operation, it is determined how similar shapes of histogram distributions of a test image and a main image have. It can be judged that more different shapes they have from each other, the more uneven variance in the luminance distribution between the test image and the main image is so that the flash illumination to the object or the reflectance of the objects has been uneven. In other words, it can be judged that the main image contains both regions illuminated brightly with the flash and regions which the flash has not reached.  
      If a color temperature of the light source is estimated from such a main image, a color temperature not of the image will be output erroneously because uneven color temperatures of the image are averaged. With reference to this erroneous color temperature, improper white balance adjustments will be done to both of the regions well-illuminated with flash and regions not illuminated with flash.  
      In view of the above, the electronic camera of the invention switches white balance adjustment to one with importance placed on the color temperature of the flash, upon detecting unevenness of flash illumination. This allows good white balance adjustments to be made on image regions illuminated brightly with the flash.  
      Generally, the user of an electronic camera intends to illuminate a major object brightly with a flash. Therefore, naturally the above-mentioned image regions illuminated brightly with a flash are likely to be a major object in the image. Accordingly, placing greater importance on the color temperature of the flash makes it possible to properly adjust white balance of the major object and to thereby improve the color reproduction performance of the major object.  
      Conversely, it can be judged that the more similar shapes the histogram distribution of the two images have, the more even the variations in the luminance distribution between the test image and the main image in a frame becomes, so that the object in the frame have been illuminated with the flash almost evenly.  
      In this case, the electronic camera of the invention performs white balance adjustments, placing greater importance on the color temperature of the main image. Since the object in the frame is illuminated evenly, an estimated color temperature that is obtained with reference to that of the main image well reflects an actual color temperature. As a result, it is made possible to perform proper white balance adjustments on the entire image by placing greater importance on the color temperature of the main image.  
      As described above, according to the invention, comparing histogram distributions of a test image and a main image makes it possible to accurately estimate the degree of evenness of flash illumination, enabling proper white balance adjustments according to an estimation result.  
      Further, the invention is advantageous than the conventional technique disclosed in Reference 1 in the following point.  
      The electronic camera of the invention compares histogram distributions of a test image and a main image. Generally, movement of a major object or a camera shake causes subtle pattern variations between the test image and the main image. However, the histogram distribution of the image hardly varies even if the patterns move subtly.  
      In the histogram comparison according to the invention, it is unnecessary to consider the pattern variations between the test image and the main image in contrast to the above-mentioned conventional apparatus. As such, even with some object movement or camera shake, the electronic camera of the invention is able to judge the evenness of flash illumination correctly and perform proper white balance adjustments according to a judgment result.  
      (2) It is preferable that the white balance calculating section calculate, as the white balance adjustment value, a weighted combination value of a first white balance adjustment value and a second white balance adjustment value. The first white balance adjustment value is determined with reference to the color temperature of the flash, and the second white balance adjustment value is determined with reference to the color temperature of the main image. The white balance calculating section increases the weight of the first white balance adjustment value if it is judged that the correlation is low. Conversely, if it is judged that the correlation is high, the white balance calculating section increases the weight of the second white balance adjustment value.  
      This operation makes it possible to obtain a proper white balance adjustment value even if the illumination distribution of a flash is in-between evenness and unevenness, with the intermediate evenness taken into consideration.  
      (3) It is preferable that the white balance calculating section determine a frequency of white saturation and/or black saturation in the main image, and refrain from judging the evenness of the flash illumination if the frequency is higher than a predetermined threshold value.  
      The white saturation and the black saturation occur when the signal levels of a main image changes to nonlinear due to illumination with an excessively strong flash, for example. It is difficult to judge the evenness of flash illumination by comparing such a main image with a test image.  
      In view of this, the electronic camera according to the invention stop judging the evenness of the flash illumination when the frequency of white saturation and/or black saturation in the main image is higher than a certain threshold value. This makes it possible to substantially lower the occurrence of an erroneous judgment on the evenness of the flash illumination.  
      (4) It is even preferable that the imaging section include a photometric image sensor for performing an imaging operation for divisional photometry and a recording image sensor for performing an imaging operation for recording. The imaging control section captures the test image without a flash by controlling the photometric image sensor, and captures the main image with a flash by controlling the recording image sensor.  
      This configuration is particularly suitable for single-lens electronic cameras. Single-lens electronic cameras are equipped with a photometric image sensor for divisional photometry and a recording image sensor for generating a main image for recording.  
      Among the two image sensors, the photometric image sensor is used for capturing a test image. In general, the photometric image sensor is smaller in the number of pixels and shorter in the time necessary for transfer readout and processing of a shot image than the recording image sensor. Therefore, capturing a test image with the photometric image sensor can make the operation sequence for the test image simpler and faster than capturing a test image separately with the recording image sensor.  
      (5) It is preferable that the histogram calculating section reduce a difference between the two histogram distributions due to a device difference between the photometric image sensor and the recording image sensor.  
      For example, the photometric image sensor and the recording image sensor have differences originating from image sensors in the number of pixels of an output image, a gradation, the number of quantization bits, or the like. Reducing such differences realizes more accurate judgment as to the evenness of the flash illumination.  
      (6) It is even preferable that the histogram correlation judging section detect correlation between the two histogram distributions generated by the histogram calculating section after removing frequencies lower than a predetermined frequency from the two histogram distributions.  
      For example, it is possible to eliminate low frequencies corresponding to noise from the histogram distributions through the above removal operation. This in turn enables prevention of an erroneous judgment due to noise at the time of the correlation detection of the histogram distributions, thereby realizing more accurate judgment on the evenness of the flash illumination.  
      It is also possible to remove low frequencies from the histogram distributions so as to keep only high frequencies in the images. In this case, the histogram distributions are compared with each other by extracting only high frequency regions, that is, large-area regions in the same gradation range. It is highly probable that image regions extracted in this manner are conspicuous in the images. Judging the evenness of the flash illumination to these regions means that a judgment as to the evenness of the flash illumination is made with greater importance on conspicuous, large-area regions. As a result, it is able to realize white balance adjustments in accordance with the characteristics of the human vision.  
      (7) An electronic camera according to another aspect of the invention includes an imaging section, an imaging control section, a histogram calculating section, a histogram correlation judging section, a special light source determining section, and a color balance adjusting section.  
      The imaging section captures an image of an object. The imaging control section controls the image section to generate a test image captured without a flash and a main image captured with a flash.  
      The histogram calculating section generates respective histogram distributions for the test image and the main image. The histogram correlation judging section judges correlation between the two histogram distributions.  
      The special light source determining section detects a green fog due to illumination by a fluorescent lamp, upon determining that chromaticity of a low-chroma region in the main image is separated from the black body locus.  
      The color balance adjusting section corrects a green fog by increasing red and blue components of the main image relatively to a green component thereof, upon judging that that the fluorescent lamp illumination is even because the histogram correlation is judged high and the green fog is detected in the low-chroma region. The color balance adjusting section weakens the green fog correction, upon judging that the fluorescent lamp illumination is not even because the histogram correlation is judged low and the green fog is detected in the low-chroma region.  
      Through the above operation, it is able to know occurrence of a green fog in a wide range of the main image due to the fluorescent lamp illumination in a case where a green fog is detected in a part (i.e., a low-chroma region) of the main image in which the illumination is judged even from the histogram correlation. In this case, the green fogs are corrected positively by increasing the red and blue components of the main image relatively to its green component. This results in reliably reducing the green fog occurring in the wide range of the image and acquiring a natural main image with less green fog covering on the entire frame.  
      On the other hand, if a green fog is detected in a part (i.e., a low-chroma region) of the main image in which the illumination is judged uneven, it is able to know occurrence of a green fog in only a part of the main image. In this case, the above-described green fog correction is weakened. This prevents a problem that magenta fogs might otherwise occur in regions other than the green fog region.  
      (8) It is even preferable that the color balance adjusting section calculates a weighted combination value of a white balance adjustment value and a color balance adjustment value if a condition that the histogram correlation is low and a green fog is detected is satisfied, and performs a color balance adjustment on the main image by using the weighted combination value.  
      The above-mentioned white balance adjustment value is determined with reference to a correlation color temperature (i.e., a color temperature obtained by mapping to the black body locus) of the main image. The above-mentioned color balance adjustment value is for the green fog correction.  
      Green fogs due to illumination by a fluorescent appear such that the color shifts from the black body locus toward green. Therefore, mapping on the black body locus makes it possible to eliminate the color shift toward green and to thereby obtain a correlation color temperature without being influenced by the green fogs. Using a white balance adjustment value, which is determined with reference to this correlation color temperature, allows proper color reproduction in regions free of the green fogs (in the above-described example, the region corresponding to the major object in front of the camera).  
      The color balance adjustment value is shifted from its original value to weaken the green fog correction by weighting and combining this white balance adjustment value with the color balance adjustment value for the green fog. This results in reducing the degree of magenta fog that is by-products of the green fog correction. This can also improve the color reproduction performance in the regions that are free of the green fogs since the white balance adjustment value includes the weighted combination value.  
      (9) It is preferable that for the calculation of the weighted combination value, the color balance adjusting section decrease the weight of the color balance adjustment value as the histogram correlation lowers.  
      In general, it is considered that the lower the degree of histogram correlation is, the smaller, more limited regions covered with the green fogs. Decreasing the weight of the color balance adjustment value can further weaken the green fog correction, thereby positively preventing magenta fogs that might otherwise occur in a wide range of the image.  
      (10) It is even preferable that the color balance adjusting section prepare predetermined, plural sets of data on correspondence between a color of a low-chroma region and a color balance adjustment value in accordance with kinds of color rendering performance of fluorescent lamps, calculate a color balance adjustment value by using a set of data for higher color rendering performance as the histogram correlation becomes lower, and adjust a color balance of the main image in accordance with the calculated color balance adjustment value.  
      In general, fluorescent lamps exhibiting high color rendering performance cause less green fogs. Therefore, the green fog correction is weakened by using a set of correspondence data for a fluorescent lamp exhibiting high color rendering performance. In other words, the lower the histogram correlation, i.e., the smaller the region with a green fog, the more weakened the green fog correction will be. This makes it possible to positively prevent magenta fogs that might otherwise occur in a wide range of the image.  
      (11) An electronic camera according to a further aspect of the invention includes an imaging section, a special light source determining section, an even illumination judging section, and a color balance adjusting section.  
      The imaging section generates an image by shooting an object. The special light source determining section detects a color fog caused by a special light source upon determining that chromaticity of a low-chroma region in the image is separated from the black body locus. The even illumination judging section judges evenness of illumination to the image.  
      The color balance adjusting section corrects a color fog in such a manner as to reduce the separation of the chromaticity of the shot image from the black body locus if the illumination to the image is judged even and the color fog is detected in the low-chroma region. The color balance adjusting section weakens the color fog correction if the illumination to the image is judged uneven and the color fog is detected in the low-chroma region.  
      In the above operation, first, a low-chroma region is extracted from a shot image, and a color fog caused by a special light source is detected by judging a separation of chromaticity of the low-chroma region from the black body locus. Then, the evenness of the illumination to the shot image is judged. This judgment is preferably made by performing such processing as the above-described histogram comparison, determination of a luminance distribution by multi-pattern photometry, or comparison of average luminances of a plurality of locations of the shot image.  
      Here, it is able to know occurrence of a color fog caused by the special light source in a wide range of the shot image in a case where a color fog is detected in a part (i.e., a low-chroma region) of the shot image in which the illumination is judged even. In this case, the electronic camera corrects the color fog by adjusting the color balance to reduce the separation of the chromaticity of the shot image from the black body locus. As a result, the degrees of the color fogs occurring in the wide range of the image can be lowered reliably.  
      On the other hand, if a color fog is detected in a part (i.e., a low-chroma region) of the shot image in which the illumination is judged uneven, it is able to know that color fogs caused by the special light source have occurred in only a part of the shot image. In this case, the electronic camera performs a weak color fog correction. This prevents occurrence of a problem that new color fogs might otherwise occur by the color fog correction.  
      (12) The invention provides a program for causing a computer to function as the histogram calculating section, the histogram correlation judging section, the white balance calculating section, and the white balance adjusting section that are recited in the above item (1).  
      (13) The invention provides another program for causing a computer to function as the histogram calculating section, the histogram correlation judging section, the special light source determining section, and the color balance adjusting section that are recited in the above item (7).  
      (14) The invention provides a further program for causing a computer to function as the special light source determining section, the even illumination judging section, and the color balance adjusting section that are recited in the above item (11). 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS  
      The nature, principle, and utility of the invention will become more apparent from the following detailed description when read in conjunction with the accompanying drawings in which like parts are designated by identical reference numbers, in which:  
       FIG. 1  shows an arrangement of components of an electronic camera  11 ;  
       FIG. 2  is a block diagram showing image processing that is performed by the electronic camera  11 ;  
       FIG. 3  is a flowchart showing the operation of a first embodiment;  
       FIG. 4  shows two exemplary histogram distributions A and B;  
       FIG. 5  shows an exemplary relationship between the correlation between histogram distributions A and B and the weights of white balance adjustment values and the Euclid distance D; and  
       FIG. 6  is a flowchart showing the operation of a second embodiment. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENTS  
      Embodiments of the present invention will be hereinafter described in detail with reference to the drawings.  
     [1] First Embodiment  
     Configuration of First Embodiment  
       FIG. 1  shows an arrangement of components of an electronic camera  11 . As shown in  FIG. 1 , the electronic camera  11  is equipped with an electronic flash device  12  and an objective lens  13 . A quick return mirror  15  is provided in the image space of the objective lens  13 . A diffuser  16  is disposed at the image forming position of light that originates from an object and is reflected by the mirror  15 . The user observes an object image formed on the diffuser  16  via a finder optical system  17 . Light originating from the diffuser  16  is introduced to the imaging surface of a photometric image sensor  18  that is disposed in a corner of the space where the finder optical system  17  is provided, and an object image is formed again on the imaging surface. A shutter  19   a , a recording image sensor  19 , etc. are disposed behind the mirror  15 .  
       FIG. 2  is a block diagram showing image processing that is performed by the electronic camera  11 . As shown in  FIG. 2 , an output of the photometric image sensor  18  is supplied to an image memory  22  via an A/D conversion section  20 . An output of the recording image sensor  19  is supplied to the image memory  22  via an A/D conversion section  21 . The image memory  22  is connected to a bus  23 . An image processing section  24 , a compression recording section  25 , an imaging control section  27 , a flash control section  28 , a microprocessor  29 , etc. are connected to the bus  23 .  
      Among the above components and sections, the compression recording section  25  compression-records image data in a detachable memory card  26 . The microprocessor  29  is given a manipulation input from a release button  29   a  or the like.  
      Relationship with Claims  
      A relationship between the claims and the first embodiment will be described below.  
      This relationship is just one interpretation for reference and should not be used for restricting the invention unduly.  
      The imaging section in the claims corresponds to the photometric image sensor and the recording image sensor  19 .  
      The imaging control section in the claims corresponds to the imaging control section  27 .  
      The histogram calculating section in the claims corresponds to a function, of the microprocessor  29 , of histogram-analyzing image data and thereby generating a histogram distribution.  
      The histogram correlation calculating section in the claims corresponds to a function, of the microprocessor  29 , of comparing two histogram distributions and thereby detecting their correlation. The white balance calculating section in the claims corresponds to a function, of the microprocessor  29 , of determining a white balance adjustment value in accordance with correlation between histogram distributions.  
      The white balance adjusting section in the claims corresponds to a function, of the image processing section  24 , of adjusting the white balance of a main image.  
     Operation of First Embodiment  
       FIG. 3  is a flowchart showing the operation of the first embodiment. The operation of the electronic camera  11  will be described below in order of step numbers shown in  FIG. 3 .  
      [Step S 1 ] When the main power of the electronic camera  11  is turned on, the microprocessor  29  starts initialization processing to be performed at the time of power application. In the initialization processing, the microprocessor  29  acquires information relating to a color temperature of a flash from the electronic flash device  12  and calculates a first white balance adjustment value suitable for the color temperature.  
      [Step S 2 ] The microprocessor  29  judges whether the electronic camera  11  is in a flash-shooting mode.  
      If the flash-shooting mode is not set, the microprocessor  29  makes a transition to an ordinary photographing routine (not shown) to perform known ordinary photographing. In the ordinary photographing routine, an image shot with the photometric image sensor  18  is used for divisional photometry, for example.  
      On the other hand, if the flash shooting mode is set, the microprocessor  29  moves to step S 3 .  
      [Step S 3 ] At this point of time, the mirror  15  is at the low position. Therefore, after passing through the objective lens  13 , object light goes through the diffuser  16  and the finder optical system  17  and forms an object image on the imaging surface of the photometric image sensor  18 .  
      In this state, the microprocessor  29  gives a drive signal to the photometric image sensor  18  using the imaging control section  27 . The photometric image sensor  18  outputs a test image that has been picked up without flash. The test image is digitized on a pixel-by-pixel basis by the A/D conversion section  20  and then stored in the image memory  22  (temporary storage).  
      [Step S 4 ] The microprocessor  29  accesses the image memory  22  and calculates a luminance component of each small region (e.g., each pixel) of the test image.  
      It is preferable to generate a luminance component by subjecting color components of the test image to weighted addition according to their proportions in constituting a luminance component (e.g., R:G:B=0.29:0.587:0.114). Alternatively, a color component (e.g., green component) that greatly contributes to a luminance component of the test image may be regarded as a luminance component as it is.  
      The microprocessor  29  roughly divides the thus-calculated luminance component values of the test image into luminance ranges and determines a frequency for each of the luminance ranges. A histogram distribution A of the test image is thus obtained as shown in  FIG. 4 .  
      Data modification such as noise elimination or extraction of a large-area region may be performed by removing frequencies that are lower than a predetermined value from the histogram distribution A.  
      [Step S 5 ] The microprocessor  29  judges whether the release button  29   a  has been pressed fully. If the release button  29   a  has been pressed fully, the microprocessor  29  moves to step S 6 .  
      On the other hand, if the release button  29   a  has not been pressed fully (i.e., has been half pressed or has not been pressed at all), the microprocessor  29  returns to step S 3 .  
      [Step S 6 ] The microprocessor  29  performs known preliminary flashing in the following manner. First, the microprocessor  29  causes the mirror  15  to jump up so that an object image is projected onto the shutter blades of the shutter  19   a . In this state, using the flash control section  28  the microprocessor  29  causes the electronic flash device  12  to emit a weak preliminary flash. The microprocessor  29  measures brightness of the shutter blades at the time of the preliminary flashing using a photometric element (not shown) that is disposed at such a position as to fully cover the shutter  19   a . The microprocessor  29  determines a target light quantity of main flash in accordance with the brightness of the shutter blades at the time of the preliminary flashing. The determined target light quantity of main flash is transmitted to the electronic flash device  12 .  
      [Step S 7 ] The microprocessor  29  opens the leading blade of the shutter  19   a  and thereby starts to project an object image onto the imaging surface of the recording image sensor  19 .  
      In the case of single-shot main flashing, the microprocessor  29  causes the electronic flash device  12  to start main flash when the shutter  19   a  has been fully opened. Monitoring the light quantity of the main flash, the electronic flash device  12  stops the main flash at a point of time when the light quantity has reached the pre-informed target value.  
      When a preset shutter time has elapsed, the microprocessor  29  closes the trailing blade of the shutter  19   a . After the shutter  19   a  is fully closed in this manner, the microprocessor  29  lowers the mirror  15 .  
      [Step S 8 ] The microprocessor  29  gives a drive signal to the recording image sensor  19  using the imaging control section  27 . The recording image sensor  19  outputs a main image that has been picked up with flash. The main image is digitized on a pixel-by-pixel basis by the A/D conversion section  21  and then stored in the image memory  22  (temporary storage).  
      [Step S 9 ] The microprocessor  29  accesses the image memory  22 , reads out the main image, and generates an image for processing that is suitable for comparison with the test image.  
      For generation of the image for processing, it is preferable to perform the following processing for decreasing differences between devices:  
      (1) Processing of cutting out an image for processing from the main image in accordance with an angle of view of imaging of the test image.  
      (2) Processing of dividing the main image into pixel blocks that correspond to the positions of the respective small regions (refer to step S 4 ) of the photometric image sensor  18 , and calculating luminance component values (including quasi-luminance component values such as green component values) for the respective pixel blocks.  
      (3) Processing of normalizing a maximum gradation value, an average gradation value, a highest frequency gradation value, a minimum gradation value, etc. of the main image so that they conform to those of the test image.  
      (4) Processing of converting the number of gradation steps and a gradation curve of the main image in accordance with a gradation characteristic of the test image.  
      [Step S 10 ] The microprocessor  29  histogram-analyzes luminance component values of the image for processing generated from the main image in the same manner as the test image was done, and thereby generates a histogram distribution B as shown in  FIG. 4 .  
      Data modification such as noise elimination or extraction of a large-area region may be performed by removing frequencies that are lower than a predetermined value from the histogram distribution B.  
      [Step S 11 ] The microprocessor  29  determines a frequency of white saturation and black saturation from the histogram distribution B.  
      If this frequency is higher than a predetermined threshold value, it means that the signal levels of the main image vary nonlinearly (e.g., they are saturated). Therefore, it can be judged that the main image and the test image are not suitable for comparison objects. In this case, the microprocessor  29  moves to step S 12 .  
      On the other hand, if this frequency is lower than the prescribed threshold value, the microprocessor  29  moves to step S 13 .  
      [Step S 12 ] The microprocessor  29  does not perform histogram comparison between the main image and the test image and increases the weight of a second white balance adjustment value. Then, the microprocessor  29  moves to step S 15 .  
      [Step S 13 ] The microprocessor  29  compares the shapes of the two histogram distributions A and B and thereby calculates correlation between them.  
      For example, correlation between the histogram distributions A and B may be obtained by calculating a Euclid distance D according to the following equation. In this case, it can be judged that the shorter the Euclid distance D is, the higher the degree of correlation.  
             D   =         ∑   i     ⁢       (     Ni   -   Mi     )     2                 (   1   )             
 
 where Ni and Mi are frequencies of the histogram distributions A and B for the same luminance range i. 
 
      Alternatively, correlation between the histogram distributions A and B may be detected from their similarity by performing pattern matching on their shapes.  
      As a further alternative, correlation may be obtained by judging the degree of coincidence of the histogram distributions A and B in the number of peaks, peak intervals, magnitude relationships between a plurality of peaks, peak shapes, or the like.  
      [Step S 14 ] The microprocessor  29  gives a heavier weight to a second white balance adjustment value to be calculated at step S 14  as the obtained degree of correlation is higher.  
      In other words, the microprocessor  29  gives a heavier weight to the first white balance adjustment value as the obtained degree of correlation is lower.  
       FIG. 5  shows an exemplary relationship between the weights and the Euclid distance D that is calculated according to Equation (1).  
      [Step S 15 ] The microprocessor  29  estimates a light source color temperature on the basis of the main image that is stored in the image memory  22  and calculates a second white balance adjustment value suitable for the estimated light source color temperature.  
      For example, a light source color temperature may be estimated by calculating average values of the respective color components in the entire main image or a certain region of it. In this case, it is appropriate to determine a second white balance adjustment value so that an average color thus determined becomes an achromatic color.  
      Alternatively, a light source color temperature may be estimated by extracting pixels that are close to achromatic colors and calculating an average color of the extracted pixels. In this case, it is appropriate to determine a second white balance adjustment value so that the average color of the extracted pixels becomes an achromatic color.  
      If the weight of a second white balance adjustment value is zero at step S 14 , it is preferable to omit execution of step S 15 .  
      [Step S 16 ] The microprocessor  29  combines the first and second white balance adjustment values while applying the calculated weights to them. The microprocessor  29  communicates a resulting combination value to the image processing section  24  as a white balance adjustment value.  
      The image processing section  24  performs white balance adjustments on the main image in the image memory  22  according to the white balance adjustment value.  
      [Step S 17 ] The main image that has been subjected to the white balance adjustments at step S 16  is image-compressed and recorded on the memory card  26  by the compression recording section  25 .  
     Advantages etc. of First Embodiment  
      In the first embodiment, with the above-described operation, histogram distributions of a test image produced without flash and a main image produced with flash are compared with each other. It can be judged that the more similar shapes the histogram distributions have, the higher the degree of evenness of the flash illumination is. Conversely, it can be judged that the less similar shapes the histogram distributions have, the lower the degree of evenness of the flash illumination is.  
      In the first embodiment, based on these judgments, the electronic camera switches a white balance adjustment to one with greater importance placed on an estimated color temperature of the main image if the degree of uniformity of the flash illumination is high.  
      In this case, the estimated color temperature correctly reflects a color temperature of mixed light that is used at the time of flash shooting. Therefore, the white balance can be adjusted properly over the entire image by performing white balance adjustments, placing greater importance on the estimated color temperature of the main image.  
      In the first embodiment, white balance adjustment switching is made in order to place greater importance on a color temperature of a flash when the degree of uniformity of the flash illumination is low. In this case, an image region that is illuminated brightly with the flash, that is, a region that corresponds to, at a high probability, the white balance of a major object that is close to the camera, can be adjusted properly.  
      In particular, the above comparison between histogram distributions makes it possible to disregard subtle pattern differences between a test image and a main image. Therefore, unlike in the conventional apparatus disclosed in Reference 1, proper white balance adjustments can be performed receiving almost no influences of an object movement, a camera shake, or the like.  
      Incidentally, there may occur a phenomenon that the signal levels of a main image vary nonlinearly because of too bright flash illumination. In this case, the main image cannot be compared with a test image correctly and hence the degree of uniformity of the flash illumination cannot be judged correctly. In view of this, in the first embodiment, if there are many regions with white saturation and black saturation in a main image, the degree of uniformity of the flash illumination is not judged and white balance adjustment switching is made to place greater importance on the color temperature of the main image. In this case, although the main image contains regions with white and black saturation, they are not likely to cause errors in estimating a light source color temperature on the basis of the main image because those nonlinear regions are low in chroma. Therefore, even if white balance adjustments are performed with reference to the main image containing regions with white/black saturation, a new main image can be produced with relatively high reproduction performance.  
      In the first embodiment, a test image is picked up with the photometric image sensor  18  for divisional photometry. Since the photometric image sensor  18  is smaller than the recording image sensor  19  in the number of pixels, it is possible to save the time necessary for the image pickup and image processing (histogram generation etc.) on a test image. As a result, the increase in the processing load is small even if the operation of determining a white balance adjustment value (described above) is taken into account, and hence the shooting operation of the electronic camera can be kept nimble.  
      At step S 9  of the first embodiment, the main image is processed and made suitable for comparison with the test image. As a result, the main image and the test image can be compared with each other properly though the different image sensors are used, which makes it possible to judge the degree of uniformity of flash illumination more accurately.  
      Further, in the first embodiment, two histogram distributions A and B are compared with each other after frequencies lower than the predetermined value are removed from the histogram distributions A and B. This removal processing makes it possible to lower noise influences and to thereby judge the degree of uniformity of flash illumination more accurately. It is also possible to remove low frequencies from histogram distributions so as to leave only particularly high frequencies in images. In this case, the degree of uniformity of flash illumination can be judged by using only high-frequency regions that are conspicuous in images. As a result, white balance adjustments can be realized that are targeted on visually conspicuous high-frequency regions.  
      Next, another embodiment will be described.  
     [2] Second Embodiment  
     Configuration of Second Embodiment  
      The configuration of a second embodiment is the same as that of the first embodiment (see  FIGS. 1 and 2 ) and hence will not be described to avoid redundancy.  
      Relationship with Claims  
      A relationship between the claims and the second embodiment will be described below. This relationship is just one interpretation for reference and should not be used for restricting the invention unduly.  
      The imaging section in the claims corresponds to the photometric image sensor  18  and the recording image sensor  19 .  
      The imaging control section in the claims corresponds to the imaging control section  27 .  
      The histogram calculating section in the claims corresponds to a function, of the microprocessor  29 , of histogram-analyzing image data and thereby generating a histogram distribution.  
      The histogram correlation calculating section in the claims corresponds to a function, of the microprocessor  29 , of comparing two histogram distributions and thereby detecting their correlation.  
      The special light source determining section in the claims corresponds to a function, of the microprocessor  29 , of detecting color fogs of a special light source (e.g., green fogs due to fluorescent lamps) by extracting low-chroma regions from a main image produced by the recording image sensor  19  and judging a separation of the center of chromaticity distribution of the low-chroma regions from the black body locus.  
      The color balance adjusting section in the claims corresponds to a function, of the image processing section  24 , of adjusting the color balance of a main image in accordance with the degree of uniformity of an illumination state and a result of detection of color saturation in low-chroma regions.  
      The illumination uniformity judging section in the claims corresponds to a function, of the image processing section  24 , of judging the degree of uniformity of illumination by generating histogram distributions on the basis of image data before and after flash and detecting correlation between the two histogram distributions.  
     Operation of Second Embodiment  
       FIG. 6  is a flowchart showing the operation of the second embodiment. The operation of the electronic camera  11  will be described below in order of step numbers shown in  FIG. 6 .  
      [Steps S 31 -S 36 ] Steps S 31 -S 36  are the same as steps S 3 -S 8  of the first embodiment and hence will not be described to avoid redundancy.  
      [Step S 37 ] The microprocessor  29  accesses the image memory  22  and reads low-chroma regions (i.e., regions where the chroma is lower than a prescribed value). The microprocessor  29  determines chromaticity (R/G and B/G) of each small region (e.g., each pixel) using RGB components in the low-chroma regions, and determines the center of distribution of those sets of chromaticity values. Then, the microprocessor  29  calculates a separation between the distribution center and the black body locus on the chromaticity plane.  
      [Step S 38 ] The microprocessor  29  judges whether the separation calculated at step S 37  is greater than a threshold value. The threshold value, which is used for judging whether the separation is such as to be detected as color fogs, can be determined by, for example, conducting a subjective evaluation experiment on images.  
      If the separation is smaller than or equal to the threshold value, it can be judged that the separation is such as not to be detected as color fogs. In this case, the microprocessor  29  moves to ordinary color balance adjustments.  
      On the other hand, if the separation is greater than the threshold value, the microprocessor  29  judges that the light source is a special one (e.g., a fluorescent lamp or a sodium-vapor lamp) whose wavelength profile is much distant from the black body locus. In this case, the microprocessor  29  moves to color balance adjustments of step S 39  and the following steps.  
      [Step S 39 ] The microprocessor  29  calculates a temporary color balance adjustment value for making the color of the low-chroma regions closer to an achromatic color by setting the color component adjustment gains such that the separation from the black body locus is decreased.  
      For example, in the case of green fogs of fluorescent lamps, a color balance adjustment value is calculated by setting the adjustment gains so that the red and blue components are made relatively large to decrease a separation toward green from the black body locus.  
      [Steps S 40  and S 41 ] Steps S 40  and S 41  are the same as steps S 9  and S 10  of the first embodiment and hence will not be described to avoid redundancy.  
      [Step S 42 ] The microprocessor  29  calculates correlation between the two histogram distributions A and B in the same manner as in step S 13  of the first embodiment. The following judgment can be made depending on the degree of correlation.  
      (Case of High Histogram Correlation)  
      First, if the histogram correlation is high, it means that the object arrangement is such that a flash reaches the objects uniformly or the objects are so distant uniformly as to be out of an effective range of a flash. With such an object arrangement, it can be judged that the unevenness of illumination light is low, that is, the degree of uniformity of the illumination is high.  
      On the other hand, color fogs have already been detected in low-chroma regions of the image at step S 38 . Based on these facts, it can be judged that the color fogs due to the special light source are also highly uniform and exist in a wide area of the image.  
      (Case of Low Histogram Correlation)  
      Conversely, if the histogram correlation is low, it can be judged that the object arrangement is such as to have unevenness in the way a flash reaches objects and the luminance distribution has been changed greatly by the flash. An example is such that nearby objects that are brightly illuminated with a flash and distant objects that are hard to illuminate effectively with the flash are mixed in the same frame. With such an object arrangement, particular illumination light (from the sun, streetlamps, the flash device, fluorescent lamps, or the like) does unevenly reach the objects and the degree of uniformity of the illumination can be judged low.  
      On the other hand, color fogs have already been detected in low-chroma regions of the image at step S 38 . Based on these facts, it can be judged that the color fogs due to the special light source are non-uniform and exist in only parts of the image.  
      [Step S 43 ] The microprocessor  29  changes the color balance adjustment value such that the lower calculated histogram correlation is, more weakened color fog correction is. In the case of a green fog correction, for example, when the histogram correlation is low, the correction is weakened by somewhat decreasing the adjustment gains of the red and blue components.  
      Methods for weakening the color fog will be described below in detail.  
      (Color Fog Correction Adjusting Method-1)  
      The microprocessor  29  calculates a correlation color temperature by mapping the center of the chromaticity distribution of the low-chroma regions that was calculated at step S 37  to the black body locus. This correlation color temperature is a color temperature on the black body locus in which green fogs in the separation direction are not taken into consideration. The microprocessor  29  calculates a white balance adjustment value for conversion of this correlation color temperature into a standard color temperature. The microprocessor  29  combines this white balance adjustment value and the previously calculated color balance adjustment value (step S 39 ) while applying weights to them. This weighted combining can weaken the color fog correction on the color balance adjustment value, which in turn makes it possible to suppress occurrence of new color fogs (e.g., magenta fogs) that would otherwise be caused by the color fog correction. Further, since the value obtained by the weighted addition reflects the white balance adjustment value, the color temperature can be made closer to a standard color temperature in regions that are free of color fogs (e.g., an object in front of the camera that is illuminated with a flash) and the color reproduction performance of the main image can thereby be enhanced.  
      (Color Fog Correction Adjusting Method-2)  
      As in the case of the above-described adjusting method-1, the microprocessor  29  combines the white balance adjustment value that has been calculated on the basis of the correlation color temperature with the color balance adjustment value for the color fog correction while applying weights to them. The microprocessor  29  changes the ratio of the weighted combining in accordance with the histogram correlation that was calculated at step S 42 , that is, decreases the weight of the color balance adjustment value as the histogram correlation becomes lower. As a result, the color fog correction can be made weaker as the histogram correlation becomes lower and hence the uniformity of color fogs in the image becomes lower (i.e., color fogs are localized more), whereby occurrence of new color fogs can be suppressed strongly that would otherwise be caused by the color fog correction. Conversely, the microprocessor  29  increases the weight of the color balance adjustment value as the histogram correlation becomes higher. As a result, the color fog correction can be made stronger as the histogram correlation becomes higher and hence the uniformity of color fogs in the image becomes higher (i.e., the area of color fogs becomes wider), whereby color fogs in a wide area of the image can be eliminated properly.  
      (Color Fog Correction Adjusting Method-3)  
      For example, fluorescent lamps are classified into a plurality of groups that are different in color rendering performance.  
      The microprocessor  29  stores, for each color rendering performance group, correspondence data between color distribution centers (calculated at step S 37 ) and color balance adjustment values for the green fog correction. For example, the correspondence data can be obtained by repeatedly conducting, for each color rendering performance group, subjective evaluation experiments for the color balance adjustment on a main image. In this case, green fogs are eliminated at a higher degree when the correspondence data of a group of lower color rendering performance are used. In other words, green fogs are eliminated at a lower degree when the correspondence data of a group of higher color rendering performance are used. Therefore, the microprocessor  29  determines a color balance adjustment value using the correspondence data of a group of higher color rendering performance as the histogram correlation becomes lower. As a result, the color fog correction can be weakened and occurrence of new color fogs that would otherwise be caused by the color fog correction can be suppressed more strongly as the histogram correlation becomes lower and the uniformity of color fogs in the image becomes lower (i.e., color fogs are localized more).  
      [Step S 44 ] The microprocessor  29  performs color balance adjustments on the main image in accordance with the adjustment value that was changed at step S 43  to adjust the strength of the color fog correction.  
      [Step S 45 ] The main image on which the color balance adjustments were performed at step S 44  is image-compressed by the compression recording section  25  and stored in the memory card  26 .  
     Advantages etc. of Second Embodiment  
      As described above, in the second embodiment, the judgment of the uniformity of the illumination state and the detection of color fogs in low-chroma-regions are combined together. This makes it possible to judge whether color fogs exist in a wide area of an image or are restricted in a small area of the image.  
      In the second embodiment, the strength of the color fog correction is adjusted in accordance with the expanse of color fogs that is judged in the above manner. This makes it possible to properly prevent the undesired phenomenon that new color fogs appear after the correction.  
      In the second embodiment, histogram distributions of a test image produced without flash and a main image produced with flash are generated. Even if there occur some differences in patterns between the test image and the main image because of a time difference between them, the histogram distributions receive almost no influences from those differences and make it possible to judge the uniformity of the illumination state properly.  
      In the second embodiment, a test image is picked up with the photometric image sensor  18  for divisional photometry. Since the photometric image sensor  18  is smaller in the number of pixels than the recording image sensor  19 , the use of the photometric image sensor  18  saves the time that is necessary for the pickup and image processing (histogram generation etc.) of a test image. As a result, the increase in the processing load is small even if the operation of determining a color balance adjustment value (described above) is taken into account, and hence the shooting operation of the electronic camera  11  can be kept nimble.  
      In particular, in the second embodiment, at step  540 , the main image is processed and made suitable for comparison with the test image. As a result, the main image and the test image can be compared with each other properly though the different image sensors  18  and  19  are used, which makes it possible to judge the degree of uniformity of illumination state more accurately.  
      Further, in the second embodiment, two histogram distributions A and B are compared with each other after frequencies lower than the predetermined value are removed from the histogram distributions A and B. This removal processing makes it possible to lower noise influences and to thereby judge the degree of uniformity of the illumination state more accurately. It is also possible to remove low frequencies from histogram distributions so as to leave only particularly high frequencies in images. In this case, the degree of uniformity of the illumination state can be judged by using only high-frequency regions that are conspicuous in images. As a result, color balance adjustments can be realized that are targeted on visually conspicuous high-frequency regions.  
     [3] Supplements to Embodiments  
      Although the above embodiments are directed to the single-lens electronic camera  11 , the invention is not limited to such a case. For example, the invention can also be applied to a compact electronic camera. In this case, it is preferable to pick up a test image with the recording image sensor. In this configuration, since the photometric image sensor  18  is not necessary, the structure of the imaging section can be simplified.  
      Although in the above embodiments a single adjustment value is determined for the entire image, the invention is not limited to such a case. A configuration is possible in which the screen is divided into a plurality of regions and adjustment values according to the invention are determined for the respective regions. In this case, the uniformity of an illumination state is judged for each region and a proper adjustment value can be determined for each region according to a result of the uniformity judgment.  
      Although the above embodiments are directed to the case of using the built-in electronic flash device  12 , the invention is not limited to such a case. The invention may be applied to a case of using an external electronic flash device.  
      Although the above embodiments are directed to the case of performing color adjustments in the electronic camera, the invention is not limited to such a case. For example, a program for performing part of all of the processing shown in  FIG. 3  or  6  may be generated. The above-described image processing can be performed on an external computer by executing the program thereon.  
      In many cases, uneven illumination of flash shooting occur in a situation that a nearby object is bright and a distant background is dark. Therefore, the uniformity of an illumination state can be judged lower as the brightness difference (e.g., the standard deviation of a luminance distribution) of an image picked up with flash increases.  
      In particular, the uniformity of illumination becomes much low when the ratio of ambient light to a flash is small. In view of this, it is preferable to employ, as an index of the non-uniformity of illumination, a value obtained by dividing the standard deviation of a luminance distribution by the luminance. With this index, the degree of non-uniformity lowers as the ambient light becomes brighter even if the brightness difference of an image (i.e., the standard deviation of a luminance distribution) is the same. That is, the degree of non-uniformity is low if objects are brightly illuminated with ambient light and the luminance is high on average as in the case of synchronized shooting during the daytime. Conversely, the degree of non-uniformity is high if the luminance is low on average as in the case of flash shooting in darkness.  
      The expanse of color fogs in an image can also be judged on the basis of results of such a judgment of the uniformity of illumination and the detection of color fogs.  
      In the above embodiments, a main image for histogram comparison may be picked up separately from a main image for recording. In this case, the main image for histogram comparison may be a low-resolution image. For example, a low-resolution main image may be read from the photometric image sensor  18  with pre-flashing of the electronic flash device  12 . Alternatively, a low-resolution main image may be read out by driving the recording image sensor  19  in a draft mode (thinned-out reading mode) with pre-flashing of the electronic flash device  12 .  
      Although both of white saturation and black saturation are detected in the first embodiment, the invention is not limited to such a case. The judgment of the uniformity of flash illumination may be canceled when a high frequency of white or black saturation is detected. Further, a gradation range corresponding to a frequency of white or black saturation in a main image may be detected from the white side or black side of a histogram distribution of a test image. In this case, a detected gradation range may be removed from the histogram distribution of the test image (the highest and/or lowest gradation range is removed) or a plurality of detected gradation ranges may be combined into a single gradation range. Modifying a histogram distribution of a test image in this manner makes the histogram comparison more accurate. This operation makes it possible to judge the uniformity of flash illumination accurately irrespective of occurrence of white or black saturation in a main image.  
      The invention is not limited to the above embodiments and various modifications may be made without departing from the spirit and scope of the invention. Any improvement may be made in part or all of the components.