Abstract:
A proposition is to provide a color photographing apparatus capable of reducing the failure probability of white balance adjusting. For this purpose, the color photographing apparatus includes a discriminating unit calculating an accuracy of a shooting scene belonging to a specific group having a similar illumination color based on a feature vector of the shooting scene and a discriminant criterion preliminarily calculated by supervised learning, and a calculating unit calculating an adjusting value of the white balance adjusting to be performed on an image shot in the shooting scene based on the calculated accuracy and the image.

Description:
CROSS-REFERENCE TO RELATED APPLICATION 
       [0001]    This application is based upon and claims the benefit of priority from Japanese Patent Application No. 2007-20281 9, filed on Aug. 3, 2007, the entire contents of which are incorporated herein by reference. 
       BACKGROUND 
       [0002]    1. Field 
         [0003]    The present invention relates to a color photographing apparatus incorporating a white balance adjusting function. 
         [0004]    2. Description of the Related Art 
         [0005]    Patent document 1 discloses a method for discriminating a kind of illumination used for shooting an image, for calculating an adjusting value of white balance adjusting to be performed on the image. This method calculates preliminarily a discriminant criterion by supervised learning making a specific color component (e.g., R component) of the image to be a feature value, and discriminates whether or not the kind of illumination used for shooting is a specific kind of illumination, based on the discriminant criterion and the feature value extracted from each image (Patent document 1: Japanese Unexamined Patent Application Publication No. 2006-129442). 
         [0006]    However, since the discrimination for the image having a delicate color is difficult when multiple kinds of illumination are used for the shooting, or the like, there is a high probability that a false discrimination occurs and the white balance adjusting fails. 
       SUMMARY 
       [0007]    Accordingly, a proposition of the present invention is to provide a color photographing apparatus capable of reducing the failure probability of the white balance adjusting. 
         [0008]    For this purpose, a color photographing apparatus of the present invention includes a discriminating unit calculating an accuracy of a shooting scene belonging to a specific group having a similar illumination color, based on a feature vector of the shooting scene and a discriminant criterion calculated preliminarily by supervised learning, and a calculating unit calculating an adjusting value of white balance adjusting to be performed on an image shot in the shooting scene based on the calculated accuracy and the image. 
         [0009]    Note that the discriminating unit preferably calculates the Euclidean distance between the feature vector and the discriminant criterion in a vector space as an index for the accuracy. 
         [0010]    Further, the discriminating unit may calculate the accuracy for each of a plurality of specific groups having different illumination colors. 
         [0011]    Still further, the calculating unit calculates the adjusting value based on a frequency of each color existing in the image and may perform weighting for the frequency of the each color according to the accuracy calculated for each of the plurality of specific groups. 
         [0012]    Yet still further, the calculating unit may determine a weight value to be provided to the frequency of the each color according to the accuracy calculated for each of the plurality of specific groups and a similarity degree between the illumination color of the specific group and the each color. 
         [0013]    Yet still further, the calculating unit may emphasize, among the plurality of specific groups, the accuracy calculated for a specific group which is easy to discriminate from other groups than the accuracy calculated for a specific group which is difficult to discriminate from other groups. 
         [0014]    Yet still further, the plurality of specific groups may be any three among a group having the illumination color which would belong to a chromaticity range of a low-color-temperature illumination, a group having the illumination color which would belong to the chromaticity range of a fluorescent lamp or a mercury lamp, a group having the illumination color which would belong to the chromaticity range of a fluorescent lamp with good color rendering properties or natural sunlight, and a group having the illumination color which would belong to the chromaticity range of a shadow area or cloudy weather. 
         [0015]    Yet still further, the discriminating unit preferably performs the calculation of the accuracy during a period before shooting and the calculating unit preferably performs the calculation of the adjusting value immediately after shooting. 
         [0016]    Yet still further, the discriminating unit is preferably a support vector machine. 
         [0017]    Yet still further, any of the color photographing apparatus of the present invention may additionally include an adjusting unit performing the white balance adjusting on the image using the adjusting value calculated by the calculating unit. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0018]      FIG. 1  is a schematic diagram showing a configuration of an optical system in an electronic camera. 
           [0019]      FIG. 2  is a block diagram showing a circuit configuration of the electronic camera. 
           [0020]      FIG. 3  is a diagram showing an achromatic detection range in a first embodiment. 
           [0021]      FIG. 4  is a diagram showing a distribution example of learning samples in a vector space. 
           [0022]      FIG. 5  is a diagram showing a relationship (one example) between a distance d 1  and the number of samples. 
           [0023]      FIG. 6  is a diagram showing a relationship (one example) between a distance d 2  and the number of samples. 
           [0024]      FIG. 7  is a diagram showing a relationship (one example) between a distance d 3  and the number of samples. 
           [0025]      FIG. 8  is an operational flowchart of a CPU  29  in the first embodiment regarding shooting. 
           [0026]      FIG. 9  is an operational flowchart of the CPU  29  in a second embodiment regarding shooting. 
           [0027]      FIG. 10  is a diagram showing a relationship between a weight coefficient W D1  and the distance d 1 . 
           [0028]      FIG. 11  is a diagram showing a relationship between a weight coefficient W D2  and the distance d 2 . 
           [0029]      FIG. 12  is a diagram showing a relationship between a weight coefficient W D3  and the distance d 3 . 
           [0030]      FIG. 13  is a diagram showing a magnitude correlation of a coefficient K. 
       
    
    
     DETAILED DESCRIPTION OF THE EMBODIMENTS 
     First Embodiment 
       [0031]    The present embodiment is an embodiment for an electronic camera. Here, the electronic camera is assumed to be a monocular reflex type. 
         [0032]    First, a shooting mechanism of the electronic camera will be described.  FIG. 1  is a schematic diagram showing a configuration of an optical system in the electronic camera. As shown in  FIG. 1 , the electronic camera includes a camera body  11 , and a lens unit  13  containing a shooting lens  12 . The lens unit  13  is interchangeably attached to the camera body  11  via a not-shown mount. 
         [0033]    A main mirror  14 , a mechanical shutter  15 , a color image sensor  16  and a viewfinder optical system ( 17  to  20 ) are disposed in the camera body  11 . The main mirror  14 , the mechanical shutter  15 , and the color image sensor  16  are disposed along the optical axis of the shooting lens  12 , and the viewfinder optical system ( 17  to  20 ) is disposed in the upper region of the camera body  11 . 
         [0034]    The main mirror  14  rotates around a not-shown rotation axis and thereby is switched between an observing mode and a disembarrassing mode. The main mirror  14  in the observing mode is disposed obliquely in front of the mechanical shutter  15  and the color image sensor  16 . This main mirror  14  in the observing mode reflects a light flux captured by the shooting lens  12  upward and guides the light flux to the viewfinder optical system ( 17  to  20 ). Note that the center part of the main mirror  14  has a half mirror and a part of the light flux transmitted through the main mirror  14  in the observing mode is guided to a not-shown focus detecting unit by a sub-mirror. 
         [0035]    Meanwhile, the main mirror  14  is flipped upward in the disembarrassing mode and disposed in a position apart from a shooting optical path. When the main mirror  14  is in the disembarrassing mode, the light flux captured by the shooting lens  12  is guided to the mechanical shutter  15  and the color image sensor  16 . 
         [0036]    The viewfinder optical system ( 17  to  20 ) includes a focusing glass  17 , a condensing lens  18 , a pentagonal prism  19 , and an eyepiece lens  20 . A re-image forming lens  21  and a divided photometric sensor  22  are disposed in the neighborhood of the pentagonal prism  19  thereamong. 
         [0037]    The focusing glass  17  is located above the main mirror  14 . The light flux focused on this focusing glass  17  enters an incident plane at the bottom of the pentagonal prism  19  via the condensing lens  18 . A part of the light flux having entered the incident plane, after reflected by inner surfaces of the pentagonal prism  19 , is output from an exit plane perpendicular to the incident plane to the outside of the pentagonal prism  19  and is directed toward the eyepiece lens  20 . 
         [0038]    Further, another part of the other light flux having entered the incident plane, after reflected by the inner surfaces of the pentagonal prism  19 , is output from the exit plane to the outside of the pentagonal prism  19  and is guided to the divided photometric sensor  22  via the re-image forming lens  21 . 
         [0039]    Next, a circuit configuration of the electronic camera will be described.  FIG. 2  is a block diagram showing the circuit configuration of the electronic camera. As shown in  FIG. 2 , the camera body  11  includes the color image sensor  16 , an AFE  16   a,  the divided photometric sensor  22 , an A/D-converting circuit  22   a,  an image-processing circuit  23 , a buffer memory (MEM)  24 , a recording interface (recording I/F)  25 , an operating switch (SW)  26 , a CPU  29 , a RAM  28 , a ROM  27 , and a bus  31 . Among these components, the image-processing circuit  23 , buffer memory  24 , recording interface  25 , CPU  29 , RAM  28 , and ROM  27  are coupled with each other via the bus  31 . Further, the operating switch  26  is coupled to the CPU  29 . 
         [0040]    The color image sensor  16  is a color image sensor provided for generating an image for recording (main image). The color image sensor  16  generates an analog image signal of the main image by performing photoelectric conversion on a field image formed on an imaging plane thereof. Note that, on the imaging plane of the color image sensor  16 , three kinds of color filters, red (R), green (G), and blue (B), are disposed in the Bayer arrangement, for example, for detecting colors of the field image. Thereby, the analog image signal of the main image is made up of three components, an R component, a G component, and a B component. 
         [0041]    The AFE  16   a  is an analog front end circuit performing signal processing on the analog image signal generated by the color image sensor  16 . This AFE  16   a  performs correlated double sampling of the image signal, gain adjustment of the image signal, and A/D conversion of the image signal. The image signal (digital image signal) output from this AFE  16   a  is input into the image-processing circuit  23  as image data of the main image. 
         [0042]    The divided photometric sensor  22  is a color image sensor provided for monitoring chromaticity distribution and luminance distribution of a field in a non-shooting mode. On the imaging plane of the divided photometric sensor  22 , a field image is formed to have the same range as that of the field image formed on the imaging plane of the color image sensor  16 . The divided photometric sensor  22  generates an analog image signal of the field image by performing photoelectric conversion on the field image formed on the imaging plane thereof. Note that color filters are disposed on the imaging plane of the divided photometric sensor  22  for detecting the colors of the field image. Thereby, an image signal of this field image is also made up of the three components, the R component, the G component, and the B component. Note that the analog image signal of the field image output from this divided photometric sensor  22  is input into the CPU  29  via the A/D-converting circuit  22   a.    
         [0043]    The image-processing circuit  23  performs various kinds of image processing (color interpolation processing, gradation conversion processing, contour emphasis processing, white balance adjusting, etc.) on the image data of the main image input from the AFE  16   a.  Parameters in each of the various kinds of processing (gradation conversion characteristic, contour emphasis strength, white balance adjusting value, etc.) are calculated appropriately by the CPU  29 . Among these parameters, the white balance adjusting value includes an R/G-gain value and B/G-gain value. 
         [0044]    The buffer memory  24  stores temporarily the image data of the main image at a required timing during operation of the image-processing circuit  23  for compensating processing speed differences among the various kinds of processing in the image-processing circuit  23 . 
         [0045]    The recording interface  25  is provided with a connector for coupling a recording medium  32  with each other. The recording interface  25  accesses the recording medium  32  coupled to the connector and performs write-in and read-out of the image data of the main image. Note that the recording medium  32  is configured by a hard disk or a memory card containing a semiconductor memory. 
         [0046]    The operating switch  26  is configured with a release button, a command dial, a cross-shaped cursor key, etc. and provides a signal to the CPU  29  according to operation contents by a user. For example, the user provides a shooting instruction to the CPU  29  by fully pressing the release button. Further, the user provides an instruction to the CPU  29  for switching recording modes by manipulating the operating switch  26 . 
         [0047]    Note that there are a normal-recording mode and a RAW-recording mode for the recording modes, and the normal-recording mode is a recording mode in which the CPU  29  records the image data of the main image after the image processing into the recording medium  32  and the RAW-recording mode is a recording mode in which the CPU  29  records the image data of the main image (RAW-data) before the image processing into the recording medium  32 . 
         [0048]    The CPU  29  is a processor controlling the electronic camera collectively. The CPU  29  reads out a sequence program preliminarily stored in the ROM  27  to the RAM  28 , and calculates parameters of the individual processing or controls each part of the electronic camera by executing the program. At this time, the CPU  29  acquires lens information, if necessary, from a not-shown lens CPU in the lens unit  13 . This lens information includes information such as the focal distance, the subject distance, and the f-number of the shooting lens  12 . 
         [0049]    Further, the CPU  29  functions as a support vector machine (SVM) performing calculation of an accuracy that a present shooting scene belongs to a specific group D 1  (first discrimination), by executing the program. In addition, this SVM can also perform calculation of an accuracy that the present shooting scene belongs to another group D 2  (second discrimination) and calculation of an accuracy that the present shooting scene belongs to a group D 3  (third discrimination). 
         [0050]    Here, the group D 1 , group D 2 , or group D 3  is an individual group formed by grouping various shooting scenes by illumination colors thereof. Further, respective discriminant criteria of the first discrimination, the second discrimination, and the third discrimination in the SVM are calculated preliminarily by supervised learning of the SVM. These discriminant criteria are stored preliminarily in the ROM  27  as data of discriminant planes S 1 , S 2 , and S 3 . 
         [0051]    Next, each of the groups will be described in detail.  FIG. 3  shows a diagram expressing various achromatic detection ranges on chromaticity coordinates. The data of these achromatic detection ranges is preliminarily stored in the ROM  27 . These achromatic detection ranges are made up of achromatic ranges distributed in the neighborhood of a blackbody radiation locus, C L , C SSL , C FL1 , C FL2 , C HG , C S , C CL , and C SH , described below. 
         [0052]    Achromatic detection range C L : Chromaticity range of an electrical light bulb (=Chromaticity range of an achromatic object illuminated by an electrical light bulb) 
         [0053]    Achromatic detection range C SSL : Chromaticity range of sunset (=Chromaticity range of an achromatic object illuminated by sunset light) 
         [0054]    Achromatic detection range C FL1 : Chromaticity range of a first fluorescent lamp (=Chromaticity range of an achromatic object illuminated by a first fluorescent lamp) 
         [0055]    Achromatic detection range C FL2 : Chromaticity range of a second fluorescent lamp (=Chromaticity range of an achromatic object illuminated by a second fluorescent lamp) 
         [0056]    Achromatic detection range C HG : Chromaticity range of a mercury lamp (=Chromaticity range of an achromatic object illuminated by a mercury lamp) 
         [0057]    Achromatic detection range C S : Chromaticity range of clear weather (=Chromaticity range of an achromatic object existing in clear weather) 
         [0000]    Note that the chromaticity of a fluorescent lamp having good color rendering properties belongs to this chromaticity range. 
         [0058]    Achromatic detection range C CL : Chromaticity range of cloudy weather (=Chromaticity range of an achromatic object existing in cloudy weather) 
         [0059]    Achromatic detection range C SH : Chromaticity range of a shadow area (=Chromaticity range of an achromatic object existing in a shadow area) 
         [0060]    Then, the groups D 1 , D 2 , and D 3  are defined as follows. 
         [0061]    Group D 1 : Group of shooting scenes where the illumination colors would belong to either of the achromatic detection ranges C L  and C SSL  having a comparatively low color temperature 
         [0062]    Group D 2 : Group of shooting scenes where the illumination colors would belong to any of the achromatic detection ranges C FL1 , C FL2 , and C HG    
         [0063]    Group D 3 : Group of shooting scenes where the illumination colors would belong to the achromatic detection range C S    
         [0064]    Further, Groups D 4  and D 0  are defined as follows. 
         [0065]    Group D 4 : Group of shooting scenes where the illumination colors would belong to either of the achromatic detection ranges C CL  and C SH    
         [0066]    Group D 0 : Group of shooting scenes where the illumination colors would belong to any of the achromatic detection ranges C L , C SSL , C FL1 , C FL2 , C HG , C S , C CL , and C SH    
         [0067]    Next, contents of the supervised learning for calculating the discriminant planes S 1 , S 2 , and S 3  will be described. 
         [0068]    Learning samples used in this learning are a number of shooting scenes expected for the electronic camera, and have labeling indicating to which group the samples belongs among the group D 1 , group D 2 , group D 3 , and group D 4 . 
         [0069]    From each of the learning samples, there is extracted a 15-dimensional feature vector having vector components x 1 , x 2 , . . . , x 15 . Each of the vector components is made of the following values. 
         [0070]    x 1 =Mean B v -value of a field 
         [0071]    x 2 =Maximum B v -value of the field 
         [0072]    x 3 =Minimum B v -value of the field 
         [0073]    x 4 =Standard deviation of B v -value of the field 
         [0074]    x 5 =Mean B/G-value of the field 
         [0075]    x 6 =Maximum B/G-value of the field 
         [0076]    x 7 =Minimum B/G-value of the field 
         [0077]    x 8 =Standard deviation of B/G-value of the field 
         [0078]    x 9 =Mean R/G-value of the field 
         [0079]    x 10 =Maximum R/G-value of the field 
         [0080]    x 11 =Minimum R/G-value of the field 
         [0081]    x 12 =Standard deviation of R/G-value of the field 
         [0082]    x 13 =Edge amount existing in the field 
         [0083]    x 14 =Focal distance of a shooting lens 
         [0084]    x 15 =Subject distance of the shooting lens 
         [0085]    Among these vector components, the vector components x 1  to x 13  are calculated based on the image signal generated by the divided photometric sensor  22 . Meanwhile, the vector components x 14  and x 15  are determined by the lens information acquired from the lens CPU. Further, the vector component x 13  is calculated as follows. 
         [0086]    First, the G component of the image signal generated by the divided photometric sensor  22  is subjected to edge filter processing in the X direction and edge filter processing in the Y direction. Thereby, the edge amount in the X direction and the edge amount in the Y direction are calculated for the field. Then, a sum of the edge amount in the X direction and the edge amount in the Y direction is calculated. The sum becomes the vector component x 13 . 
         [0087]    In the learning, the feature vectors of all the learning samples are expressed as points in a vector space. Among these feature vectors, the feature vector of each learning sample belonging to the group D 1  and the feature vector of each learning sample not belonging to the group D 1  have different distribution regions as shown by dotted lines in  FIG. 4 . Here in  FIG. 4 , the 15-dimensional vector space P is expressed as a two-dimensional space for simplicity. 
         [0088]    Next, a hyper plane is calculated such that margins between the learning samples belonging to the group D 1  and the learning samples not belonging to the group D 1  are maximized, and the hyper plane is determined to be a discriminant plane S 1 . The data of this discriminant plane S 1  is written into the ROM  27 . 
         [0089]    Here, the Euclidean distance d 1  from the discriminant plane S 1  to each of the learning samples is considered as shown in  FIG. 4 . Note that the polarity of the distance d 1  is determined to be positive for a side where many of the learning samples not belonging to the group D 1  are distributed and is determined to be negative for a side where many of the learning samples belonging to the group D 1  are distributed. 
         [0090]      FIG. 5  is a diagram showing a relationship between this distance d 1  and the number of samples m. As shown in  FIG. 5 , while the distances d 1  become negative for many of the learning samples belonging to the group D 1  and the distances d 1  become positive for many of the learning samples not belonging to the group D 1 , there are learning samples which have positive distances d 1  even though belonging to the group D 1  and the learning samples which have negative distances d 1  even though not belonging to the group d 1 . Here, a range Zg 1  for the distance d 1  of such a learning sample is called “gray area Zg 1 ”. If this gray area Zg 1  is narrower, discriminant capability of the first discrimination is assumed to be higher (that is, the group D 1  is easy to discriminate from other groups). 
         [0091]    Accordingly, the present embodiment calculates a plus-side boundary value Th pos1 , and a minus-side boundary value Th neg1  for this gray area Zg 1  when calculating the discriminant plane S 1 . The data of these boundary values Th pos1  and Th neg1  is written into the ROM  27  together with the data of the discriminant plane S 1 . 
         [0092]    Next, a hyper plane is calculated in the vector space P such that the margins between the learning samples belonging to the group D 2  and the learning samples not belonging to the group D 2  are maximized, and the hyper plane is determined to be a discriminant plane S 2 . Further, a gray area Zg 2  in the neighborhood of the discriminant plane S 2  is calculated, and a plus-side boundary value Th pos2  and a minus-side boundary value Th neg2  for the gray area Zg 2  are calculated (refer to  FIG. 6 ). The data of these discriminant plane S 2 , boundary values Th pos2  and Th neg2  is written into the ROM  27 . 
         [0093]    Note that the gray area Zg 2  shown in  FIG. 6  is assumed to be larger than the gray area Zg 1  shown in  FIG. 5 . That is, the discriminant capability of the second discrimination is lower than that of the first discrimination (the group D 2  is more difficult to discriminate from the other group than the group D 1 ). 
         [0094]    Next, a hyper plane is calculated in the vector space P such that the margins between the learning samples belonging to the group D 3  and the learning samples not belonging to the group D 3  are maximized, and the hyper plane is determined to be a discriminant plane S 3 . Further, a gray area Zg 3  in the neighborhood of the discriminant plane S 3  is calculated, and a plus-side boundary value Th pos3  and a minus-side boundary value Th neg3  for the gray area Zg 3  are calculated (refer to  FIG. 7 ). The data of these discriminant plane S 3 , boundary values Th pos3  and Th neg3  is written into the ROM  27 . 
         [0095]    Note that the gray area Zg 3  shown in  FIG. 7  is assumed to be larger than the gray area Zg 2  shown in  FIG. 6 . That is, the discriminant capability of the third discrimination is lower than that of the second discrimination (the group D 3  is more difficult to discriminate from the other group than the group D 2 ). 
         [0096]    Next, an operational flow of the CPU  29  regarding shooting will be described.  FIG. 8  is an operational flowchart of the CPU  29  regarding shooting. Here, it is assumed that an auto-white-balance function of the electronic camera is switched on and the recording mode of the electronic camera is set to the normal-recording mode. Further, it is assumed that the main mirror  14  is in the observing mode and a user can observe a field through the eyepiece lens  20  at the start point of the flowchart. 
         [0097]    Step S 101 : The CPU  29  determines whether or not the release button has been half-pressed. If the release button has been half-pressed, the process goes to a step S 102  and if the release button has not been half-pressed, the step  101  is repeated. 
         [0098]    Step S 102 : The CPU  29  carries out focus adjustment of the shooting lens  12  and also causes the divided photometric sensor  22  to start outputting an image signal of a field. Note that the focus adjustment is performed by the CPU  29  providing a defocus signal generated by the focus detection unit to the lens CPU. At this time, the lens CPU changes a lens position of the shooting lens  12  so as to make the defocus signal provided by the CPU  29  close to zero, and thereby adjusts the focal point of the shooting lens  12  onto an object in the field (subject). 
         [0099]    Step S 103 : The CPU  29  extracts the feature vector from the present shooting scene by the SVM function. This extraction is carried out based on the image signal of the field output from the divided photometric sensor  22  and the lens information (lens information after the focus adjustment) provided by the lens CPU. The feature vector is a feature vector having the same vector component as that of the feature vector extracted in the learning. 
         [0100]    Step S 104 : The CPU  29  calculates the distance d 1  between the feature vector extracted in Step S 103  and the discriminant plane S 1  by the SVM function (first discrimination). The smaller this distance d 1  is, the higher is the accuracy of the present shooting scene belonging to the group D 1 , and the larger the distance d 1  is, the lower is the accuracy of the present shooting scene belonging to the group D 1 . 
         [0101]    Step S 105 : The CPU  29  calculates a distance d 2  between the feature vector extracted in Step S 103  and the discriminant plane S 2  by the SVM function (second discrimination). The smaller this distance d 2  is, the higher is the accuracy of the present shooting scene belonging to the group D 2 , and the larger the distance d 2  is, the lower is the accuracy of the present shooting scene belonging to the group D 2 . 
         [0102]    Step S 106 : The CPU  29  calculates a distance d 3  between the feature vector extracted in Step S 103  and the discriminant plane S 3  by the SVM function (third discrimination). The smaller this distance d 3  is, the higher is the accuracy of the present shooting scene belonging to the group D 3 , and the larger the distance d 3  is, the lower is the accuracy of the present shooting scene belonging to the group D 3 . 
         [0103]    Step S 107 : The CPU  29  determines whether or not the release button has been fully pressed. If the release button has not been fully pressed, the process goes to S 108 , and if the release button has been fully pressed, the process goes to S 109 . 
         [0104]    Step S 108 : The CPU  29  determines whether or not the release button has been released from the half-pressed state. If the release button has been released from the half-pressed state, the CPU  29  interrupts the signal output of the divided photometric sensor  22  and the process returns to the step S 101 , and if the release button is continued to be half-pressed, the process returns to the step S 103 . 
         [0105]    Step S 109 : The CPU  29  carries out shooting processing and acquires the image data of a main image. That is, the CPU  29  moves the main mirror  14  to a position for the disembarrassing mode and further acquires the image data of the main image by driving the color image sensor  16 . The data of the main image passes through the AFE  16   a  and the image-processing circuit  23  in a pipeline method, and is retained into the buffer memory  24  for buffering. After the shooting processing, the main mirror  14  is returned to a position for the observing mode. 
         [0106]    Step S 110 : The CPU  29  refers to the values of the distances d 1 , d 2 , and d 3  calculated in the steps S 104 , S 105 , and S 106 , and finds the smallest one thereof. 
         [0107]    When the value of the distance d 1  is the smallest, the CPU  29  assumes that the present shooting scene belongs to the group D 1  and sets a group number i of the present shooting scene to be “1”. Note that, even though d 1  is the smallest, the CPU  29  assumes that the present shooting scene belongs to the group D 4  when Th pos1 &lt;d 1 , and sets the group number i of the present shooting scene to be “4”. Further, when Th neg1 &lt;d 1 &lt;Th pos1  (d 1  is positioned in the gray area Zg 1 ), the CPU  29  assumes that the present shooting scene belongs to the group D 0  and sets the group number i of the present shooting scene to be “0”. 
         [0108]    When the distance d 2  is the smallest, the CPU  29  assumes that the present shooting scene belongs to the group D 2  and sets the group number i of the present shooting scene to be “2”. Note that, even though d 2  is the smallest, the CPU  29  assumes that the present shooting scene belongs to D 4  when Th pos2 &lt;d 2 , and sets the group number i of the present shooting scene to be “4”. Further, when Th neg2 &lt;d 2 &lt;Th pos2  (d 2  is positioned in the gray area Zg 2 ), the CPU  29  assumes that the present shooting scene belongs to the group D 0  and sets the group number i of the present shooting scene to be “0”. 
         [0109]    When the distance d 3  is the smallest, the CPU  29  assumes that the present shooting scene belongs to the group D 3  and sets the group number i of the present shooting scene to be “3”. Note that, even though d 3  is the smallest, the CPU  29  assumes that the present shooting scene belongs to D 4  when Th pos3 &lt;d 3 , and sets the group number i of the present shooting scene to be “4”. Further, when Th neg3 &lt;d 3 &lt;Th pos3  (d 3  is positioned in the gray area Zg 3 ), the CPU  29  assumes that the present shooting scene belongs to the group D 0  and sets the group number i of the present shooting scene to be “0”. 
         [0110]    Step S 111 : The CPU  29  limits the achromatic detection ranges defined on the chromaticity coordinates ( FIG. 3 ) to the range corresponding to the group number i which is now being set. That is, when the group number i is “1”, the achromatic detection ranges other than the achromatic detection ranges C L  and C SSL  are made to be invalid, when the group number i is “2”, the achromatic detection ranges other than the achromatic detection ranges C FL1 , C FL2 , and C HG  are made to be invalid, when the group number i is “3”, the achromatic detection ranges other than the achromatic detection range C S  are made to be invalid, when the group number i is “4”, the achromatic detection ranges other than the achromatic detection ranges C CL  and C SH  are made to be invalid, and when the group number i is “0”, all the achromatic detection ranges are made to be valid. 
         [0111]    Step S 112 : The CPU  29  divides the main image into a plurality of small regions. 
         [0112]    Step S 113 : The CPU  29  calculates chromaticity of each small region of the main image (average chromaticity in the small region) and projects each of the small regions on to the chromaticity coordinates according to the chromaticity thereof. Further, the CPU  29  finds the small regions projected into the valid achromatic detection ranges among the small regions, and calculates a centroid position of these small regions on the chromaticity coordinates. Then, the CPU  29  assumes the chromaticity corresponding to the centroid position to be the illumination color used in the shooting. 
         [0113]    Note that the calculation of the centroid position is preferably performed after the chromaticity of each small region has been converted into correlated color temperature. The correlated color temperature includes a color temperature component Tc, and a difference component duv from the blackbody radiation locus, and thereby makes the computation simple in averaging a plurality of chromaticity values (weighted average). Further, in the calculation of the centroid position, considering the luminance of each small region, the number (frequency) of the small regions having high luminance may be counted on the larger side. 
         [0114]    Step S 114 : The CPU  29  calculates a white balance adjusting value from the correlated color temperature (Tc and duv) of the calculated centroid position. This white balance adjusting value is a white balance adjusting value for expressing a region, which has the same chromaticity as that of the correlated color temperature (Tc and duv) on the main image before white balance adjusting, in an achromatic color. 
         [0115]    Step S 115 : The CPU  29  provides the calculated white balance adjusting value to the image-processing circuit  23  and also provides an image processing instruction to the image-processing circuit  23 . The image-processing circuit  23  performs the white balance adjusting and other image processing on the image data of the main image according to the instruction. The image data of the main image after the image processing is recorded into the recording medium  32  by the CPU  29 . 
         [0116]    As described hereinabove, the CPU  29  of the present embodiment calculates an accuracy that a shooting scene belongs to a specific group based on the feature vector of the shooting scene and the discriminant criterion calculated preliminarily by the supervised learning, and estimates an illumination color in the shooting based on the accuracy and the main image. 
         [0117]    That is, for estimating the illumination color in the shooting of the main image, the CPU  29  of the present embodiment does not utilize a rough discrimination result whether or not the shooting scene belongs to a specific group, but utilizes a detailed discrimination result of the accuracy that the shooting scene belongs to the specific group. 
         [0118]    Therefore, the CPU  29  of the present embodiment can reduce the probability that the illumination color is falsely estimated in a shooting scene which is not sure to belong to the specific group. Accordingly, the failure probability of the white balance adjusting can be reduced. 
         [0119]    Further, the CPU  29  of the present embodiment calculates the Euclidean distance in the vector space, between the feature vector of the shooting scene and the discriminant plane, as an index of the accuracy that the shooting scene belongs to the specific group, and thereby the accuracy can be detected correctly. 
         [0120]    Still further, the CPU  29  of the present embodiment performs the calculation of the accuracy that the shooting scene belongs to the specific group in a time before shooting, and thereby it is possible to suppress a computation amount when estimating the illumination color immediately after the shooting. 
         [0121]    Yet still further, the discrimination in the present embodiment is performed by the SVM, and thereby has a high discriminant capability for an unknown shooting scene and an advantage in versatility. 
       Second Embodiment 
       [0122]    The present embodiment is a variation of the first embodiment. Here, only a different point from the first embodiment will be described. The different point is in the operation of the CPU  29 . 
         [0123]    The CPU  29  of the present embodiment performs steps S 121  to S 128  in  FIG. 9 , instead of the steps S 110  to S 113  in  FIG. 8 . 
         [0124]    Step S 121 : The CPU  29  refers to the distances d 1 , d 2 , and d 3  calculated in the above steps S 104 , S 105  and S 106 , calculates a weight coefficient W D1  of the group D 1 , based on the distance d 1 , calculates a weight coefficient W D2  of the group D 2 , based on the distance d 2 , and calculates a weight coefficient W D3  of the group D 3 , based on the distance d 3 . 
         [0125]    Here, a relationship between the weight coefficient W D1  calculated here and the distance d 1  is as shown in  FIG. 10 , a relationship between the weight coefficient W D2  and the distance d 2  is as shown in  FIG. 11 , and a relationship between the weight coefficient W D3  and the distance d 3  is as shown in  FIG. 12 . That is, the weight coefficient W Di  of a group D i  is calculated from a distance d i , boundary values Th negi  and Th posi  of a gray area Zg i  by the following formula. 
         [0000]    
       
         
           
             
               W 
               Di 
             
             = 
             
               { 
               
                 
                   
                     1 
                   
                   
                     
                       ( 
                       
                         
                           d 
                           i 
                         
                         &lt; 
                         
                           Th 
                           negi 
                         
                       
                       ) 
                     
                   
                 
                 
                   
                     
                       1 
                       - 
                       
                         
                           
                             d 
                             i 
                           
                           - 
                           
                             Th 
                             negi 
                           
                         
                         
                           
                             Th 
                             posi 
                           
                           - 
                           
                             Th 
                             negi 
                           
                         
                       
                     
                   
                   
                     
                       ( 
                       
                         
                           Th 
                           negi 
                         
                         &lt; 
                         
                           d 
                           i 
                         
                         &lt; 
                         
                           Th 
                           posi 
                         
                       
                       ) 
                     
                   
                 
                 
                   
                     0 
                   
                   
                     
                       ( 
                       
                         
                           Th 
                           posi 
                         
                         &lt; 
                         
                           d 
                           i 
                         
                       
                       ) 
                     
                   
                 
               
             
           
         
       
     
         [0126]    Step S 122 : The CPU  29  determines whether or not the value of the weight coefficient W D1  of the group D 1  is “1”. If the value is “1”, the process goes to a step S 123 , and if the value is not “1”, the process goes to a step S 124 . 
         [0127]    Step S 123 : The CPU  29  replaces the value of the weight coefficient W D2  of the group D 2  by “0” and then the process goes to a step S 125 . 
         [0128]    Step S 124 : The CPU  29  determines whether or not the value of the weight coefficient W D2  of the group D 2  is “1”. If the value is “1”, the process goes to the step S 125 , and if the value is not “1”, the process goes to a step S 126 . 
         [0129]    Step S 125 : The CPU  29  replaces the value of the weight coefficient W D3  of the group D 3  by “0”, and then the process goes to the step S 126 . 
         [0130]    Step S 126 : The CPU  29 , based on the weight coefficients W D1 , W D2 , and W D3  at this point, calculates each of a weight value W L  for the achromatic detection range C L , a weight value W SSL  for the achromatic detection range C SSL , a weight value W FL1  for the achromatic detection range C FL1 , a weight value W FL2  for the achromatic detection range C FL2 , a weight value W HG  for the achromatic detection range C HG , a weight value W S  for the achromatic detection range C S , a weight value W CL  for the achromatic detection range C CL , and a weight value W SH  for the achromatic detection range C SH . 
         [0131]    Here, a relationship of the weight value W L  of the achromatic detection range C L  to the weight coefficients W D1 , W D2 , and W D3  is as follows. 
         [0000]        W   L   =K ( C   L   , D   1 )· W   D1   +K ( C   L   , D   2 )· W   D2   +K ( C   L   , D   3 )· W   D3   +Of ( C   L ) 
         [0000]    where the coefficient K(C L , D i ) in the formula is a value determined by a similarity degree between the achromatic detection range C L  and the illumination color of a group D i , and the coefficient Of(C L ) is a predetermined offset value. 
         [0132]    A relationship of the weight value W SSL  of the achromatic detection range C SSL  to the weight coefficients W D1 , W D2 , and W D3  is as follows. 
         [0000]        W   SSL   =K ( C   SSL   , D   1 )· W   D1   +K ( C   SSL   , D   2 )· W   D2   +K ( C   SSL   , D   3 )· W   D3   +Of ( C   SSL ) 
         [0000]    where the coefficient K(C SSL , D i ) in the formula is a value determined by the similarity degree between the achromatic detection range C SSL  and the illumination color of a group D i , and the coefficient Of(C SSL ) is a predetermined offset value. 
         [0133]    A relationship of the weight value W FL1  of the achromatic detection range C FL1  to the weight coefficients W D1 , W D2 , and W D3  is as follows. 
         [0000]        W   FL1   =K ( C   FL1   , D   1 )· W   D1   +K ( C   FL1   , D   2 )· W   D2   +K ( C   FL1 , D 3 )· W   D3   +Of ( C   FL1 ) 
         [0000]    where, the coefficient K(C FL1 , D i ) in the formula is a value determined by the similarity degree between the achromatic detection range C FL1  and the illumination color of a group D i , and the coefficient Of(C FL1 ) is a predetermined offset value. 
         [0134]    A relationship of the weight value W FL2  of the achromatic detection range C FL2  to the weight coefficients W D1 , W D2 , and W D3  is as follows. 
         [0000]        W   FL2   =K ( C   FL2   , D   1 )· W   D1   +K ( C   FL2   , D   2 )· W   D2   +K ( C   FL2   , D   3 )· W   D3   +Of ( C   FL2 ) 
         [0000]    where the coefficient K(C FL2 , D i ) in the formula is a value determined by the similarity degree between the achromatic detection range C FL2  and the illumination color of a group D i , and the coefficient Of(C FL2 ) is a predetermined offset value. 
         [0135]    A relationship of the weight value W HG  of the achromatic detection range C HG  to the weight coefficients W D1 , W D2 , and W D3  is as follows. 
         [0000]        W   HG   =K ( C   HG   , D   1 )· W   D1   +K ( C   HG   , D   2 )· W   D2   +K ( C   HG   , D   3 )· W   D3   +Of ( C   HG ) 
         [0000]    where the coefficient K(C HG , D i ) in the formula is a value determined by the similarity degree between the achromatic detection range C HG  and the illumination color of a group D i , and the coefficient Of(C HG ) is a predetermined offset value. 
         [0136]    A relationship of the weight value W S  of the achromatic detection range C S  to the weight coefficients W D1 , W D2 , and W D3  is as follows. 
         [0000]        W   S   =K ( C   S   , D   1 )· W   D1   +K ( C   S   , D   2 )· W   D2   +K ( C   S   , D   3 )· W   D3   +Of ( C   S ) 
         [0000]    where the coefficient K(C S , D i ) in the formula is a value determined by the similarity degree between the achromatic detection range C S  and the illumination color of a group D i , and the coefficient Of(C S ) is a predetermined offset value. 
         [0137]    A relationship of the weight value W CL  of the achromatic detection range C CL  to the weight coefficients W D1 , W D2 , and W D3  is as follows. 
         [0000]        W   CL   =K ( C   CL   , D   1 )· W   D1   +K ( C   CL   , D   2 )· W   D2   +K ( C   CL   , D   3 )· W   D3   +Of ( C   CL ) 
         [0000]    where the coefficient K(C CL , D i ) in the formula is a value determined by the similarity degree between the achromatic detection range C CL  and the illumination color of a group D i , and the coefficient Of(C CL ) is a predetermined offset value. 
         [0138]    A relationship of the weight value W SH  of the achromatic detection range C SH  to the weight coefficients W D1 , W D2 , and W D3  is as follows. 
         [0000]        W   SH   =K ( C   SH   , D   1 )· W   D1   +K ( C   SH   , D   2 )· W   D2   +K ( C   SH   , D   3 )· W   D3   +Of ( C   SH ) 
         [0000]    where the coefficient K(C SH , D i ) in the formula is a value determined by the similarity degree between the achromatic detection range C SH  and the illumination color of a group D i , and the coefficient Of(C SH ) is a predetermined offset value. 
         [0139]    Note that magnitude correlations of the coefficients K and Of in each of the above formulas are as shown in  FIG. 13 , for example. In  FIG. 13 , “High” indicates a value equal to or close to +1, “Low” indicates a value equal to or close to −1, and “Medium” indicates a medium value between −1 and +1 (−0.5, +0.5, etc.). 
         [0140]    Step S 127 : The CPU  29  divides the main image into a plurality of small regions. 
         [0141]    Step S 128 : The CPU  29  calculates the chromaticity of each small region of the main image (average chromaticity in the region) and projects each of the small regions onto the chromaticity coordinates according to the chromaticity thereof. Further, the CPU  29  finds the small regions, projected into the achromatic detection ranges C L , C SSL , C FL1 , C FL2 , C HG , C S , C CL , and C SH  among the small regions, and calculates the centroid position of the small regions on the chromaticity coordinates. 
         [0142]    Note that, at this time, the number (frequency) of the small regions projected into the respective achromatic detection ranges C L , C SSL , C FL1 , C FL2 , C HG , C S , C CL , and C SH  are multiplied by the weight values calculated in the step S 126 , W L , W SSL , W FL1 , W FL2 , W HG , W S , W CL , and W SH  respectively. That is, the frequency of the small regions projected into the achromatic detection range C L  is multiplied by the weight value W L , the frequency of the small regions projected into the achromatic detection range C SSL  is multiplied by the weight value W SSL , the frequency of the small regions projected into the achromatic detection range C FL1  is multiplied by the weight value W FL1 , the frequency of the small regions projected into the achromatic detection range C FL2  is multiplied by the weight value W FL2 , the frequency of the small regions projected into the achromatic detection range C HG  is multiplied by the weight value W HG , the frequency of the small regions projected into the achromatic detection range C S  is multiplied by the weight value W S , the frequency of the small regions projected into the achromatic detection range C CL  is multiplied by the weight value W CL , and the frequency of the small regions projected into the achromatic detection range C SH  is multiplied by the weight value W SH . Here, considering the luminance of each small region, the number (frequency) of the small regions having high luminance may be counted on the larger side. 
         [0143]    As described above, the CPU  29  of the present embodiment performs weighting on the frequency of each color existing in the main image according to the accuracy that a shooting scene belongs to the group D 1  (distance d 1 ), the accuracy that of the shooting scene belonging to the group D 2  (distance d 2 ), and the accuracy of the shooting scene belonging to the group D 3  (distance d 3 ), and thereby the probability that the illumination color is falsely estimated in the shooting is low even for shooting in which it is not sure to which group the shooting scene belongs. 
         [0144]    Further, the CPU  29  of the present embodiment determines the weight value to be provided to the frequency of each color according to the similarity degree of the each color with the illumination colors of the groups D 1 , D 2 , and D 3 , and thereby the illumination color in the shooting can be estimated in a high accuracy. 
         [0145]    Still further, the CPU  29  of the present embodiment emphasizes the discrimination result (weight coefficient) for the group easy to discriminate in estimating the illumination color in shooting more than the discrimination result (weight coefficient) for the group difficult to discriminate. Thereby, the probability that the illumination color is falsely estimated is suppressed to be low. 
       Other Embodiments 
       [0146]    Note that, while the CPU  29  of the second embodiment uses the calculation formula for calculating the weight value for each of the achromatic detection ranges from the weight coefficients of the respective groups, a lookup table may be used. By using the lookup table, it is possible to increase a processing speed for estimating the illumination color after shooting. 
         [0147]    Further, while either of the foregoing embodiments performs serially the first discrimination processing, the second discrimination processing, and the third discrimination processing, the processings may be performed in parallel. 
         [0148]    Still further, while either of the foregoing embodiments assumes not to use a flash emitting device, emission intensity of a flash may be included in the vector components of the feature vector, considering a possibility of using the flash emitting device. 
         [0149]    Yet still further, while either of the foregoing embodiments includes the focal distance and the subject distance of the shooting lens as shooting conditions in the vector components of the feature vector, another shooting condition such as the f-number of the shooting lens may be included. 
         [0150]    Yet still further, while either of the foregoing embodiments includes the edge amount of a field as a subject condition in the vector components of the feature vector, another subject condition such as the contrast of a field may be included. 
         [0151]    Yet still further, in either of the foregoing embodiments, the CPU  29  sets the number of divisions for the achromatic detection range to be eight and the number of divisions for the group to be four. However, another combination of numbers may be used as the number of divisions for the achromatic detection range and the number of divisions for the group. 
         [0152]    Yet still further, either of the foregoing embodiments assumes that the SVM learning is performed preliminarily and the data of the discriminant planes and the like (S 1 , S 2 , S 3 , Th pos1 , Th neg1 , Th pos2 , Th neg2 , Th pos3 , and Th neg3 ) can not be rewritten, but, when the electronic camera is provided with a manually-white-balance-adjusting function adjusting the white balance according to a kind of illumination indicated by a user, the SVM may perform the learning and updates the data each time the kind of the illumination is indicated. Note that the data is stored in a rewritable memory in this case. 
         [0153]    Yet still further, while either of the foregoing embodiments repeats the discrimination processing of the shooting scene during the time when the release button is being half-pressed, the discrimination processing may be performed once immediately after the release button has been half-pressed. In this case, the discrimination result immediately after the release button has been half-pressed is retained during the time when the release button is being half-pressed. 
         [0154]    Yet still further, while the monocular reflex type electronic camera performing the field observation and the main image acquisition with using different image sensors is described in either of the foregoing embodiments, the present invention can be applied to a compact type electronic camera performing the field observation and the main image acquisition with using a common image sensor. 
         [0155]    Yet still further, while either of the embodiments assumes the normal-recording mode for a recording mode of the electronic camera, for the RAW-recording mode, the CPU  29  may generate attached information including the data obtained by the discrimination and store the attached information into the recording medium  32  together with the RAW-data of the main image. After that, in the development processing of the RAW-data, the CPU  29  may read the RAW-data from the recording medium  32  and execute the above described steps S 110  to S 115  (or S 121  to S 115 ). 
         [0156]    Yet still further, while the electronic camera performs the calculation processing of the white balance adjusting value in either of the foregoing embodiments, a part of or the whole of the processing may be performed by a computer. In this case, a program necessary for the processing is installed in the computer. The install is performed via a recording medium such as a CD-ROM or the Internet. 
         [0157]    The many features and advantages of the embodiments are apparent from the detailed specification and, thus, it is intended by the appended claims to cover all such features and advantages of the embodiments that fall within the true spirit and scope thereof. Further, since numerous modifications and changes will readily occur to those skilled in the art, it is not desired to limit the inventive embodiments to the exact construction and operation illustrated and described, and accordingly all suitable modifications and equivalents may be resorted to, falling within the scope thereof.