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.
1. Field
The present invention relates to a color photographing apparatus incorporating a white balance adjusting function.
2. Description of the Related Art
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).
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.
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.
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.
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.
Further, the discriminating unit may calculate the accuracy for each of a plurality of specific groups having different illumination colors.
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.
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.
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.
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.
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.
Yet still further, the discriminating unit is preferably a support vector machine.
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.
The present embodiment is an embodiment for an electronic camera. Here, the electronic camera is assumed to be a monocular reflex type.
First, a shooting mechanism of the electronic camera will be described.
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.
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.
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.
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.
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.
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.
Next, a circuit configuration of the electronic camera will be described.
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.
The AFE 16a is an analog front end circuit performing signal processing on the analog image signal generated by the color image sensor 16. This AFE 16a 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 16a is input into the image-processing circuit 23 as image data of the main image.
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 22a.
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 16a. 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.
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.
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.
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.
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.
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.
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 D1 (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 D2 (second discrimination) and calculation of an accuracy that the present shooting scene belongs to a group D3 (third discrimination).
Here, the group D1, group D2, or group D3 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 S1, S2, and S3.
Next, each of the groups will be described in detail.
Achromatic detection range CL: Chromaticity range of an electrical light bulb (=Chromaticity range of an achromatic object illuminated by an electrical light bulb)
Achromatic detection range CSSL: Chromaticity range of sunset (=Chromaticity range of an achromatic object illuminated by sunset light)
Achromatic detection range CFL1: Chromaticity range of a first fluorescent lamp (=Chromaticity range of an achromatic object illuminated by a first fluorescent lamp)
Achromatic detection range CFL2: Chromaticity range of a second fluorescent lamp (=Chromaticity range of an achromatic object illuminated by a second fluorescent lamp)
Achromatic detection range CHG: Chromaticity range of a mercury lamp (=Chromaticity range of an achromatic object illuminated by a mercury lamp)
Achromatic detection range CS: Chromaticity range of clear weather (=Chromaticity range of an achromatic object existing in clear weather)
Note that the chromaticity of a fluorescent lamp having good color rendering properties belongs to this chromaticity range.
Achromatic detection range CCL: Chromaticity range of cloudy weather (=Chromaticity range of an achromatic object existing in cloudy weather)
Achromatic detection range CSH: Chromaticity range of a shadow area (=Chromaticity range of an achromatic object existing in a shadow area)
Then, the groups D1, D2, and D3 are defined as follows.
Group D1: Group of shooting scenes where the illumination colors would belong to either of the achromatic detection ranges CL and CSSL having a comparatively low color temperature
Group D2: Group of shooting scenes where the illumination colors would belong to any of the achromatic detection ranges CFL1, CFL2, and CHG
Group D3: Group of shooting scenes where the illumination colors would belong to the achromatic detection range CS
Further, Groups D4 and D0 are defined as follows.
Group D4: Group of shooting scenes where the illumination colors would belong to either of the achromatic detection ranges CCL and CSH
Group D0: Group of shooting scenes where the illumination colors would belong to any of the achromatic detection ranges CL, CSSL, CFL1, CFL2, CHG, CS, CCL, and CSH
Next, contents of the supervised learning for calculating the discriminant planes S1, S2, and S3 will be described.
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 D1, group D2, group D3, and group D4.
From each of the learning samples, there is extracted a 15-dimensional feature vector having vector components x1, x2, . . . , x15. Each of the vector components is made of the following values.
x1=Mean Bv-value of a field
x2=Maximum Bv-value of the field
x3=Minimum Bv-value of the field
x4=Standard deviation of Bv-value of the field
x5=Mean B/G-value of the field
x6=Maximum B/G-value of the field
x7=Minimum B/G-value of the field
x8=Standard deviation of B/G-value of the field
x9=Mean R/G-value of the field
x10=Maximum R/G-value of the field
x11=Minimum R/G-value of the field
x12=Standard deviation of R/G-value of the field
x13=Edge amount existing in the field
x14=Focal distance of a shooting lens
x15=Subject distance of the shooting lens
Among these vector components, the vector components x1 to x13 are calculated based on the image signal generated by the divided photometric sensor 22. Meanwhile, the vector components x14 and x15 are determined by the lens information acquired from the lens CPU. Further, the vector component x13 is calculated as follows.
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 x13.
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 D1 and the feature vector of each learning sample not belonging to the group D1 have different distribution regions as shown by dotted lines in
Next, a hyper plane is calculated such that margins between the learning samples belonging to the group D1 and the learning samples not belonging to the group D1 are maximized, and the hyper plane is determined to be a discriminant plane S1. The data of this discriminant plane S1 is written into the ROM 27.
Here, the Euclidean distance d1 from the discriminant plane S1 to each of the learning samples is considered as shown in
Accordingly, the present embodiment calculates a plus-side boundary value Thpos1, and a minus-side boundary value Thneg1 for this gray area Zg1 when calculating the discriminant plane S1. The data of these boundary values Thpos1 and Thneg1 is written into the ROM 27 together with the data of the discriminant plane S1.
Next, a hyper plane is calculated in the vector space P such that the margins between the learning samples belonging to the group D2 and the learning samples not belonging to the group D2 are maximized, and the hyper plane is determined to be a discriminant plane S2. Further, a gray area Zg2 in the neighborhood of the discriminant plane S2 is calculated, and a plus-side boundary value Thpos2 and a minus-side boundary value Thneg2 for the gray area Zg2 are calculated (refer to
Note that the gray area Zg2 shown in
Next, a hyper plane is calculated in the vector space P such that the margins between the learning samples belonging to the group D3 and the learning samples not belonging to the group D3 are maximized, and the hyper plane is determined to be a discriminant plane S3. Further, a gray area Zg3 in the neighborhood of the discriminant plane S3 is calculated, and a plus-side boundary value Thpos3 and a minus-side boundary value Thneg3 for the gray area Zg3 are calculated (refer to
Note that the gray area Zg3 shown in
Next, an operational flow of the CPU 29 regarding shooting will be described.
Step S101: 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 S102 and if the release button has not been half-pressed, the step 101 is repeated.
Step S102: 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).
Step S103: 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.
Step S104: The CPU 29 calculates the distance d1 between the feature vector extracted in Step S103 and the discriminant plane S1 by the SVM function (first discrimination). The smaller this distance d1 is, the higher is the accuracy of the present shooting scene belonging to the group D1, and the larger the distance d1 is, the lower is the accuracy of the present shooting scene belonging to the group D1.
Step S105: The CPU 29 calculates a distance d2 between the feature vector extracted in Step S103 and the discriminant plane S2 by the SVM function (second discrimination). The smaller this distance d2 is, the higher is the accuracy of the present shooting scene belonging to the group D2, and the larger the distance d2 is, the lower is the accuracy of the present shooting scene belonging to the group D2.
Step S106: The CPU 29 calculates a distance d3 between the feature vector extracted in Step S103 and the discriminant plane S3 by the SVM function (third discrimination). The smaller this distance d3 is, the higher is the accuracy of the present shooting scene belonging to the group D3, and the larger the distance d3 is, the lower is the accuracy of the present shooting scene belonging to the group D3.
Step S107: 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 S108, and if the release button has been fully pressed, the process goes to S109.
Step S108: 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 S101, and if the release button is continued to be half-pressed, the process returns to the step S103.
Step S109: 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 16a 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.
Step S110: The CPU 29 refers to the values of the distances d1, d2, and d3 calculated in the steps S104, S105, and S106, and finds the smallest one thereof.
When the value of the distance d1 is the smallest, the CPU 29 assumes that the present shooting scene belongs to the group D1 and sets a group number i of the present shooting scene to be “1”. Note that, even though d1 is the smallest, the CPU 29 assumes that the present shooting scene belongs to the group D4 when Thpos1<d1, and sets the group number i of the present shooting scene to be “4”. Further, when Thneg1<d1<Thpos1 (d1 is positioned in the gray area Zg1), the CPU 29 assumes that the present shooting scene belongs to the group D0 and sets the group number i of the present shooting scene to be “0”.
When the distance d2 is the smallest, the CPU 29 assumes that the present shooting scene belongs to the group D2 and sets the group number i of the present shooting scene to be “2”. Note that, even though d2 is the smallest, the CPU 29 assumes that the present shooting scene belongs to D4 when Thpos2<d2, and sets the group number i of the present shooting scene to be “4”. Further, when Thneg2<d2<Thpos2 (d2 is positioned in the gray area Zg2), the CPU 29 assumes that the present shooting scene belongs to the group D0 and sets the group number i of the present shooting scene to be “0”.
When the distance d3 is the smallest, the CPU 29 assumes that the present shooting scene belongs to the group D3 and sets the group number i of the present shooting scene to be “3”. Note that, even though d3 is the smallest, the CPU 29 assumes that the present shooting scene belongs to D4 when Thpos3<d3, and sets the group number i of the present shooting scene to be “4”. Further, when Thneg3<d3<Thpos3 (d3 is positioned in the gray area Zg3), the CPU 29 assumes that the present shooting scene belongs to the group D0 and sets the group number i of the present shooting scene to be “0”.
Step S111: The CPU 29 limits the achromatic detection ranges defined on the chromaticity coordinates (
Step S112: The CPU 29 divides the main image into a plurality of small regions.
Step S113: 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.
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.
Step S114: 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.
Step S115: 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.
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.
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.
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.
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.
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.
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.
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.
The CPU 29 of the present embodiment performs steps S121 to S128 in
Step S121: The CPU 29 refers to the distances d1, d2, and d3 calculated in the above steps S104, S105 and S106, calculates a weight coefficient WD1 of the group D1, based on the distance d1, calculates a weight coefficient WD2 of the group D2, based on the distance d2, and calculates a weight coefficient WD3 of the group D3, based on the distance d3.
Here, a relationship between the weight coefficient WD1 calculated here and the distance d1 is as shown in
Step S122: The CPU 29 determines whether or not the value of the weight coefficient WD1 of the group D1 is “1”. If the value is “1”, the process goes to a step S123, and if the value is not “1”, the process goes to a step S124.
Step S123: The CPU 29 replaces the value of the weight coefficient WD2 of the group D2 by “0” and then the process goes to a step S125.
Step S124: The CPU 29 determines whether or not the value of the weight coefficient WD2 of the group D2 is “1”. If the value is “1”, the process goes to the step S125, and if the value is not “1”, the process goes to a step S126.
Step S125: The CPU 29 replaces the value of the weight coefficient WD3 of the group D3 by “0”, and then the process goes to the step S126.
Step S126: The CPU 29, based on the weight coefficients WD1, WD2, and WD3 at this point, calculates each of a weight value WL for the achromatic detection range CL, a weight value WSSL for the achromatic detection range CSSL, a weight value WFL1 for the achromatic detection range CFL1, a weight value WFL2 for the achromatic detection range CFL2, a weight value WHG for the achromatic detection range CHG, a weight value WS for the achromatic detection range CS, a weight value WCL for the achromatic detection range CCL, and a weight value WSH for the achromatic detection range CSH.
Here, a relationship of the weight value WL of the achromatic detection range CL to the weight coefficients WD1, WD2, and WD3 is as follows.
W
L
=K(CL, D1)·WD1+K(CL, D2)·WD2+K(CL, D3)·WD3+Of(CL)
where the coefficient K(CL, Di) in the formula is a value determined by a similarity degree between the achromatic detection range CL and the illumination color of a group Di, and the coefficient Of(CL) is a predetermined offset value.
A relationship of the weight value WSSL of the achromatic detection range CSSL to the weight coefficients WD1, WD2, and WD3 is as follows.
W
SSL
=K(CSSL, D1)·WD1+K(CSSL, D2)·WD2+K(CSSL, D3)·WD3+Of(CSSL)
where the coefficient K(CSSL, Di) in the formula is a value determined by the similarity degree between the achromatic detection range CSSL and the illumination color of a group Di, and the coefficient Of(CSSL) is a predetermined offset value.
A relationship of the weight value WFL1 of the achromatic detection range CFL1 to the weight coefficients WD1, WD2, and WD3 is as follows.
W
FL1
=K(CFL1, D1)·WD1+K(CFL1, D2)·WD2+K(CFL1, D3)·WD3+Of(CFL1)
where, the coefficient K(CFL1, Di) in the formula is a value determined by the similarity degree between the achromatic detection range CFL1 and the illumination color of a group Di, and the coefficient Of(CFL1) is a predetermined offset value.
A relationship of the weight value WFL2 of the achromatic detection range CFL2 to the weight coefficients WD1, WD2, and WD3 is as follows.
W
FL2
=K(CFL2, D1)·WD1+K(CFL2, D2)·WD2+K(CFL2, D3)·WD3+Of(CFL2)
where the coefficient K(CFL2, Di) in the formula is a value determined by the similarity degree between the achromatic detection range CFL2 and the illumination color of a group Di, and the coefficient Of(CFL2) is a predetermined offset value.
A relationship of the weight value WHG of the achromatic detection range CHG to the weight coefficients WD1, WD2, and WD3 is as follows.
W
HG
=K(CHG, D1)·WD1+K(CHG, D2)·WD2+K(CHG, D3)·WD3+Of(CHG)
where the coefficient K(CHG, Di) in the formula is a value determined by the similarity degree between the achromatic detection range CHG and the illumination color of a group Di, and the coefficient Of(CHG) is a predetermined offset value.
A relationship of the weight value WS of the achromatic detection range CS to the weight coefficients WD1, WD2, and WD3 is as follows.
W
S
=K(CS, D1)·WD1+K(CS, D2)·WD2+K(CS, D3)·WD3+Of(CS)
where the coefficient K(CS, Di) in the formula is a value determined by the similarity degree between the achromatic detection range CS and the illumination color of a group Di, and the coefficient Of(CS) is a predetermined offset value.
A relationship of the weight value WCL of the achromatic detection range CCL to the weight coefficients WD1, WD2, and WD3 is as follows.
W
CL
=K(CCL, D1)·WD1+K(CCL, D2)·WD2+K(CCL, D3)·WD3+Of(CCL)
where the coefficient K(CCL, Di) in the formula is a value determined by the similarity degree between the achromatic detection range CCL and the illumination color of a group Di, and the coefficient Of(CCL) is a predetermined offset value.
A relationship of the weight value WSH of the achromatic detection range CSH to the weight coefficients WD1, WD2, and WD3 is as follows.
W
SH
=K(CSH, D1)·WD1+K(CSH, D2)·WD2+K(CSH, D3)·WD3+Of(CSH)
where the coefficient K(CSH, Di) in the formula is a value determined by the similarity degree between the achromatic detection range CSH and the illumination color of a group Di, and the coefficient Of(CSH) is a predetermined offset value.
Note that magnitude correlations of the coefficients K and Of in each of the above formulas are as shown in
Step S127: The CPU 29 divides the main image into a plurality of small regions.
Step S128: 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 CL, CSSL, CFL1, CFL2, CHG, CS, CCL, and CSH among the small regions, and calculates the centroid position of the small regions on the chromaticity coordinates.
Note that, at this time, the number (frequency) of the small regions projected into the respective achromatic detection ranges CL, CSSL, CFL1, CFL2, CHG, CS, CCL, and CSH are multiplied by the weight values calculated in the step S126, WL, WSSL, WFL1, WFL2, WHG, WS, WCL, and WSH respectively. That is, the frequency of the small regions projected into the achromatic detection range CL is multiplied by the weight value WL, the frequency of the small regions projected into the achromatic detection range CSSL is multiplied by the weight value WSSL, the frequency of the small regions projected into the achromatic detection range CFL1 is multiplied by the weight value WFL1, the frequency of the small regions projected into the achromatic detection range CFL2 is multiplied by the weight value WFL2, the frequency of the small regions projected into the achromatic detection range CHG is multiplied by the weight value WHG, the frequency of the small regions projected into the achromatic detection range CS is multiplied by the weight value WS, the frequency of the small regions projected into the achromatic detection range CCL is multiplied by the weight value WCL, and the frequency of the small regions projected into the achromatic detection range CSH is multiplied by the weight value WSH. 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.
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 D1 (distance d1), the accuracy that of the shooting scene belonging to the group D2 (distance d2), and the accuracy of the shooting scene belonging to the group D3 (distance d3), 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.
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 D1, D2, and D3, and thereby the illumination color in the shooting can be estimated in a high accuracy.
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.
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.
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.
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.
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.
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.
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.
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 (S1, S2, S3, Thpos1, Thneg1, Thpos2, Thneg2, Thpos3, and Thneg3) 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.
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.
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.
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 S110 to S115 (or S121 to S115).
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.
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.
Number | Date | Country | Kind |
---|---|---|---|
2007-202819 | Aug 2007 | JP | national |