Automatic white balance detection and correction of an image captured in a digital camera

Abstract: A method and apparatus for performing color balance enhancement using either a host or a device internal to the camera to adjust the color of a digital image taken by a digital camera. Digital image data representing the image is analyzed to determine the amount of adjustment required to achieve proper white balance for the image.

Description: BACKGROUND OF THE INVENTION 1. Field of the Invention This invention relates to digital cameras, and more particularly to a method and apparatus for performing color adjustment upon images taken with a digital camera. 2. Description of Related Art Digital still cameras are being developed today to allow an image to be captured, digitized, stored, and reproduced using conventional printers coupled to a conventional personal computer. In most cases, an array of charge-coupled-device (CCD) detectors are used to capture the image. Each detector of the CCD array is used to capture one portion of the image. When light is received by a CCD detector, an electrical charge representative of the intensity of the light to which the detector has been exposed is accumulated. This charge can be coupled to an A/D (analog to digital) converter. The A/D convertor produces a digital value that represents the charge on each of the detectors, and thus the intensity of the light received by each detector. If a color image is to be captured, then color filters are placed before each detector of the CCD array. Accordingly, a detector which is associated with a filter that passes essentially only red light will form a red detector. The color detectors are frequently arranged in groups. For example, in one well known arrangement, two green detectors. a blue detector, and a red detector form a two by two grouping. This grouping is repeated throughout the array of detectors. By taking the digital value associated with each detector. the color composition of the image is captured. One problem that is encountered is that the amount of color detected by each detector may be altered due to the composition of the spectrum of light emitted by the particular light source which illuminates the image. For example, if an image is illuminated by a tungsten light source, then the image will be shifted toward the red spectrum, since tungsten light sources emit more red light than blue or green light. This shift will give the resulting photograph an undesirable reddish/orangish appearance. In accordance with one method that has been used to process an image to adjust for differences in the nature of the light, variable gain amplifiers are provided in line with the red and blue signals. The amount of gain applied to the red and blue signals is adjusted to compensate for the type of light which illuminates the image. A manual control on the camera allows the user to select between tungsten mode and daylight mode. In tungsten mode, the gains of the amplifiers that are responsible for amplifying the output from the red and blue detectors are set to a first gain ratio to compensate for the blue shift. In daylight mode, a second gain ratio is used which causes the gain of the amplifiers responsible for amplifying the red and blue signals to be approximately equal to the amount of gain which is set for the green signals. Selection of the particular gain ratio is also dependent upon the state of a relay. The relay overrides the manual control when a flash has been charged, since the use of a flash will alter the color composition of the image. That is, the gain ratio of the color signal amplifiers should be essentially the same when capturing an image using a flash device and when capturing an image during daylight. Therefore, when a flash device is charged to illuminate an image, the relay sets the mode of the variable gain amplifiers to the daylight setting, as is appropriate in the case in which a flash is to be used. Thus. by altering the gain of the amplifiers responsible for amplifying the outputs from the red and blue detectors, the color is properly balanced for the case in which an image is to be captured in tungsten lighting, daylight, or when a flash is used. However, this system can improperly adjust the color of the image that is captured if the flash is charged, but not actually activated. Furthermore. the amount of color adjustment that is preformed is essentially fixed at one of two particular ratios (i.e. the gain of the amplifiers is set to one of two levels). Accordingly, if the amount of color adjustment that is required is other than that which would be desirable if the image were illuminated solely by tungsten or solely by natural sunlight, then the color of the image will be improperly adjusted. Still further, not every tungsten light source will have exactly the same color temperature (spectral composition of wavelengths). A common way in which digital cameras have attempted to white balance an image requires that a preview image be taken. The preview image is used to determine the amount of adjustment that is required in order to white balance the image. There are several historical reasons why a preview image is used to determine the amount of adjustment that is required to white balance an image that is taken some time later. For example, in the case in which the adjustment is made by adjusting the gain of the amplifiers to which the output from the CCD array is coupled, the white balance information must be known at the time the image is read from the CCD array. However, the adjustment will be incorrect if the illumination of the image differs between the time the preview image is taken and the time the final image is taken. For example, if the preview image is taken without a flash, and the final image is taken with a flash, then the correction that is made to the final image based upon the characteristics of the preview image will be incorrect. A number of other situations can arise which would cause the illumination of the preview image to differ from the illumination of the final image. For example, the sun may become obscured by a cloud, a light may be turned on or off, etc. Additionally EP-A-0 719 036 discloses a digital camera comprising image sensing and storage arrangements, and EP-A-0 738 085 discloses a white balance adjustment system. Accordingly, it would be desirable to provide a system wherein the color adjustment is determined in a way that accurately reflects the characteristics of the final image. Furthermore. it would be desirable to provide a system wherein the amount of color adjustment can be adjusted to compensate for several different conditions and combinations of light sources. SUMMARY OF THE INVENTION The present invention is a method and apparatus for performing color balance of an image taken with a digital camera using either an host computer that is external to the camera or in a device internal to the camera using the image data of the image to be white balance adjusted in order to determine the amount of adj ustment required.. According to a first aspect, the present invention provides a digital camera as disclosed in claim 1 attached herein. According to a second aspect, a method is provided, as disclosed in claim 8 attached herein. In accordance with one embodiment of the present invention, a digital image is captured by: first flushing, at a first point in time, any charge which has accumulated on a CCD light detector array; allowing light to strike the CCD detector after the detector has been flushed; and determining the amount of charge that has accumulated upon the detectors that comprise the array. Once the image has been captured, a determination must be made as to whether the image requires white balancing. White balancing is typically required if the light source that illuminates objects to be imaged has a "color temperature" that would cause the image to be tinted or biased in favor of, or away from, one color. For example, a tungsten light source will typically be biased in favor red. Therefore, in order for the image to be properly white balanced, the red component of each pixel must be adjusted. with respect to the blue and green components of each pixel. In accordance with the present invention, the amount of the adjustment which is to be made is determined by analysis of the image data to be adjusted (i.e., the "picture image"). In accordance with one embodiment of the present invention, image pixels within the picture image are mapped into a two dimensional space, the two dimensions of this space being red/blue and green/blue. Image pixels that make up a reference image that was illuminated by a reference light source are then plotted in the two dimensional space. Each of the points at the periphery of the picture image are mapped into points at the periphery of the reference image by a transform. The transforms that are used to map the points in the picture image to the points in the reference image are then plotted in a transform space. A shape is defined in the transform space by the set of transforms associated with each of the points on the periphery of the picture image. Accordingly, a set of such shapes in the transform space will be defined for the picture image. The intersection of these shapes is then used to determine source of light that illuminates the picture image and the adjustment factors required to properly white balance the picture image. It will be clear that since the image data to be adjusted is used to determine the amount of the adjustment that is required, the adjustment will be more precise than would be the case if a preview image is taken to determine how to adjust the picture image. In accordance with one embodiment of the present invention, the analysis and adjustment of the image data is performed in the camera. However, in an alternative embodiment of the present invention, the adjustment is performed outside the camera by a host device, such as a personal computer or printer. BRIEF DESCRIPTION OF THE DRAWING The objects, advantages, and features of this invention will become readily apparent in view of the following description, when read in conjunction with the accompanying drawing, in which: Fig. 1 is a block diagram of a digital camera in accordance with the present invention. Like reference numbers and designations in the various drawings refer to like elements. DETAILED DESCRIPTION OF THE INVENTION Throughout this description, the preferred embodiment and examples shown should be considered as exemplars, rather than limitations on the present invention. The present invention is a method and apparatus for performing automatic white balance on an image captured by a digital camera based upon characteristics of a light source as determined from an analysis of the image data. Figure 1 is a block diagram of one embodiment of a digital camera 100 in accordance with the present invention. The digital camera 100 includes: an optical lens 101; an array of charge-coupled-device (CCD) detectors 103, including an array of color filters, each filter associated with a detector; again control circuit 105; an A/D (analog to digital) convertor 107; a control device 109 (such as a microprocessor), preferably including a JPEG file format conversion device 115 and an EXIF file format device 117; a buffer memory 111; an image processing device 113, such as a DSP (digital signal processor); an image memory device 119; and an output port 120. Light enters the digital camera 100 through the lens 101 and is focused on the array of CCD detectors 103. As is well known in the art, the color filters 102 associated with each detector within the CCD array 103 cause the detectors to be sensitive to one particular color. In accordance with one embodiment of the present invention. the CCD detectors are configured in a repeating pattern of two by two groups in which the top right detector is sensitive to red light, the top left detector is sensitive to blue green light, the bottom right detector is sensitive to green light, and the bottom left detector is sensitive to blue light. It should be understood that the array of detectors may be fabricated such that the particular detectors are sensitive to other colors and are arranged in other configurations. Each detector accumulates a charge that is representative of the amount of light in one CCD pixel. A timing generator 104 is coupled to the CCD detector array 103. The timing generator 104 controls the reading of the CCD detector array 103 in essentially conventional fashion. The timing generator 104 causes the charge accumulated by each detector to be serially applied to the input of the gain control device 105. The control device 109 is coupled to the timing generator and controls the operation of the timing generator 104 in essentially conventional fashion. The timing generator 104 is capable of flushing the CCD array 103 to essentially discharge any charge previously accumulated the detectors within the array. Once the CCD array 103 has been flushed, the light that passes through the lens and the color filters causes charge to accumulate on each of the detectors within the CCD array 103 in an amount that is proportional to the amount of light that strikes each detector. The charge that accumulates on each detector within the CCD array 103 results in a voltage that is coupled to the gain control circuit 105. The gain control circuit 105 includes an automatic gain control circuit and circuitry to implement a correlated double sampling process. The correlated double sampling process is a conventional process which accounts for overshoot and undershoot in the output from the CCD detectors as the CCD array is read. The control device 109 is coupled to the gain control device and controls the automatic gain control circuit. The output from the gain control circuit 105 is coupled to the A/D converter 107. The AID converter 107 converts to digital values the voltages read from the CCD detectors and processed by the gain control circuit 105. The resulting digital values are preferably directly proportional to the amount of light detected by each detector. The A/D converter 107 is coupled to the DSP 113. The DSP 113 processes the color information stored in the buffer memory 111 to provide a demosaic function, to perform automatic white balance. and to sharpen the image. The DSP 113 determines which values are coupled from the A/D converter 107 to the DSP 113 are associated with which detectors by the order in which the values are received from the A/D converter 107. The demosaic function and the automatic white balance functions are conventional functions. For example, in accordance with one embodiment of the present invention, the DSP 113 is a Part No. HD49811TFA commercially available from Hitachi and the automatic white balance function is provided in the HD49811TFA data sheet distributed by Hitachi. The output from the DSP 113 is a set of image pixels, each of which represent the color of a particular portion of the image that was captured by the CCD detector array 103. Accordingly, the complete set of image pixels comprise the image data. The image data is stored in a buffer memory 111. The buffer memory 111 is read by the control device 109. In accordance with one embodiment of the present invention, the control device 109 includes a conventional dedicated integrated circuit which performs a JPEG file format conversion. Therefore, in accordance with one embodiment of the present invention, a combination of hardware and software executed within the control device 109 operate together to form a JPEG file format conversion device 115. However, in accordance with another embodiment of the present invention, the JPEG file format conversion device comprises only hardware. Alternatively, the JPEG file format conversion device 115 is a software routine performed within a programmable control device 109. In either case, file format conversion is performed in conventional fashion. In yet another embodiment of the present invention, no compression is performed. In still another embodiment, compression is performed in accordance with a standard other than JPEG. The JPEG file format conversion process compresses the information output from the DSP 113 and stored in the buffer 111 in accordance with the well known JPEG data compression standard. The information which is in JPEG format is then embedded within a file which conforms to "Digital Still Camera Image File Format Standard" (Version 1.0. July 13. 1995) (commonly known as "EXIF"), defined by the JEIDA Electronic Still Camera Technical Committee. The file is embedded within the EXIF file by an EXIF file format device 117 within the control device 109. In accordance with one embodiment of the present invention, the EXIF file format device is a combination of software executed within the control device 109 and dedicated hardware. However, in an alternative embodiment, the EXIF file format device 117 is a software routine performed within the control device 109. In yet another embodiment of the present invention. the EXIF file format device 117 comprises only dedicated hardware. In the preferred embodiment of the present invention, the image information is compressed in accordance with the well known JPEG data compression technique and presented in YC b C r format with 4:2:2 subsampling. The EXIF file is then transferred to a host for further processing. However, it should be understood that in accordance with an alternative embodiment of the present invention, the output from the DSP 113 may be formatted in any manner which allows a host 121, such as a personal computer or printer, to read and interpret the information provided by the camera 100 to the host 121. In accordance with one embodiment of the present invention, the image data is not compressed. In accordance with the present invention, the image data is analyzed to determine how to adjust the digital values in the image data to correct for differences in the characteristics of the light source used to illuminate the image. In accordance with one embodiment of the present invention, the image data is analyzed to determine the amount of adjustment to be applied to the image data to properly white balance the image. The analysis involves mathematical manipulation of the image data which can be performed by a programmable device, such as a microprocessor or DSP either within or external to the camera (e.g., in the host). In accordance with the present invention, the image data is analyzed with respect to a reference image. The reference image preferably has an essentially full spectrum of visible wavelengths and is illuminated by a reference light source. The image data for the reference image is mapped into a two dimensional space in which the horizontal axis is red divided by blue and the vertical axis is green divided by blue. This mapping reduces the three dimensional (rgb) points to chromaticity defined by two values (i.e., the red/blue value and the green/blue value). Accordingly, a gamut of points can be plotted in this two dimensional space, each point representing the color of one pixel in the reference image. A set of points which, when connected from one point to the next. define the outer most boundary of this reference gamut are identified: These peripheral points are then saved. Once the peripheral points of the reference image have been established, a captured image can be analyzed with respect to the reference image by first mapping the captured image into the two-dimensional space such that each pixel defines a point in the two-dimensional space. Then peripheral points for the captured image are determined. Each one of these points are than mapped to one of the peripheral points of the reference image. The transform that is used to map the peripheral point of the picture image to the peripheral point of the reference image is then defined by two values. The first value is the quotient of the red/blue values, and the second value is the quotient of the green/blue values. Each set of transforms associated with one point of the captured image and mapped to each point in the reference image will define a shape. Therefore, a set of shapes will be defined by mapping each of the points in the picture image to each of the points in the reference image. The intersection of these shapes defines a new shape. This new shape can then be analyzed to determine the light source which most likely was used to illuminate the scene. In another embodiment of the present invention, the device for analyzing the image data is provided within the camera. For example, in one embodiment of the present invention, the DSP 113 performs the analysis of the image data. As a result of the analysis of the image data. the color of the image pixels that make-up the image are adjusted to achieve proper white balance. It should be understood that the image data may not be compressed. or the compression may be applied after either analysis of the image data or after the adjustments to the color balance are made.

Claims: A digital camera (100) comprising: an image sensing arrangement (101, 102, 103, 104, 105, 107) for capturing an image of a scene and its color composition resulting from a source of image illuminating light; an image storage arrangement (111, 115, 117) responsive to the image sensing arrangement for storing captured image data including red-green-blue (RGB) color values for each of a plurality of pixels representing the captured image of the scene in a color space; and a color compensation arrangement (109, 119, 120, 121, 123) for analyzing the stored non-color-corrected data to establish a set of transformation values for balancing the non-color corrected data to produce modified digital image data representing a corrected image of the scene, characterized in that the color compensation arrangement includes: a reference image storage arrangement for storing, for each of a plurality of RGB pixels representing a reference image in the color space, the red/blue (R/B) ratio value and green/blue (G/B) ratio value representing a point in a chromaticity space defined by a first axis representing the R color value divided by the B color value and a second axis representing the G color value divided by the B color value, where a plurality of such points defines a reference gamut having a periphery in the chromaticity space; first transformation means for mapping the RGB color value of a captured image data pixel in the color space to a R/B ratio value and a G/B ratio value representing a point in the chromaticity space, whereby the R/B and G/B values for the plurality of pixels representing the image of the scene define a captured image gamut having a periphery in the chromaticity space; second transformation means for mapping the R/B and G/B ratio values of a peripheral point of the captured image gamut into the R/B and G/B ratio values of each of a first plurality of peripheral points of the reference image gamut to obtain a first plurality of points defining a shape in a transform space defined by two orthogonal dimensionless axes, whereby the combination of a second plurality of peripheral points in the captured image gamut with the first plurality of peripheral points of the reference image gamut define a second plurality of shapes having a common intersection in the transform space; and compensation means for adjusting the captured image data responsive to the location of the periphery in the transform space of the common intersection of the second plurality of shapes, whereby the captured image of the scene is adjusted to produce modified digital image data representing the corrected image of the scene. The digital camera (100) of claim 1, wherein: the first transformation means includes means for transforming points of a three-dimensional RGB color space into points of the two-dimensional chromaticity space, each point in the two-dimensional chromaticity space representing the color of one pixel in the image. The digital camera (100) of claim 1 or 2, wherein each of the first plurality of points defining the shape in the transform space is defined by two discrete values, one value being the dimensionless quotient of the R/B ratio values of the corresponding captured image gamut peripheral point and the corresponding one of the first plurality of reference image gamut peripheral points, and the other value being the dimensionless quotient of the G/B ratio values of the corresponding captured image gamut peripheral point and the corresponding one of the first plurality of reference image gamut peripheral points. The digital camera (100) according to any one of claims 1-3 wherein the image sensing arrangement (101, 102, 103, 104, 105, 107) includes: a sensor array (103) for converting light into electrical energy; an array of color filters (102) for causing the sensor array (103) to be sensitive to certain specific color spectrums; and an optical lens (101) for directing light from an illuminated image onto the array of color filters (102) to facilitate capturing the color compensation of the image when illuminated by the source of light. The digital camera (100) according to claim 4, wherein the sensor array (103) includes an array of charge-coupled devices. The digital camera (100) according to claims 4 or 5, wherein the sensing arrangement further includes: a timing generator (104) coupled to the sensor array (103) for facilitating the sequential reading of discrete pixel data values; a gain control circuit (105) coupled to the sensor array (103) for correcting overshoot and undershoot signal anomalies in processing the captured image from the sensor array (103) into the discrete pixel data values; and an analog-to-digital converter (107) for converting each discrete pixel data value into a discrete digital value indicative of one pixel of image data. The digital camera (100) according to any one of claims 1-6, wherein: the first and second transformation means and the compensation means are included in a processing circuit (109, 119), the processing circuit further including means for determining whether a pixel of captured image data has a sufficient color bias arising from the spectral characteristics of the source of light to require white-balance adjustment; and the color compensation arrangement (109, 119, 120, 121, 123) further including a control device (120,121, 123) responsive to the processing circuit (119) for adjusting individual ones of the pixels of captured image data requiring white balance correction. A method for performing automatic white-balance detection and correction, comprising the steps of: (a) capturing and storing image data indicative of a captured image of a scene illuminated by a source of light, the captured image data including red-green-blue (RGB) values for each of the plurality of pixels representing the image of the scene in a color space; (b) analyzing the captured image data to determine the white balance of each individual pixel in the image of the scene with respect to a reference light source; and (c) adjusting the white balance of each individual pixel in the captured image of the scene to compensate for estimated differences between the source of light and the reference light source; wherein the step of analyzing the captured image data is characterized by the steps of: (b.1) storing, for each of a plurality of pixels in a reference image, the red/blue (R/B) ratio value and green/blue (G/B) ratio value representing a point in a chromaticity space defined by a first axis representing the R color value divided by the B color value and a second axis representing the G color value divided by the B color value, where a plurality of such points defines a reference gamut having a periphery in the chromaticity space; (b.2) mapping the RGB color value of a pixel from the captured image data to a R/B ratio value and a G/B ratio value representing a point in the chromaticity space, whereby the R/B and G/B values for the plurality of pixels representing the image of the scene define a captured image gamut having a periphery in the chromaticity space; (b.3) mapping the R/B and G/B ratio values of a peripheral point of the captured image gamut the R/B and G/B ratio values of each of a first plurality of peripheral points of the reference image gamut to obtain a first plurality of points defining a shape in a transform space defined by two orthogonal dimensionless axes; (b.4) repeating the mapping step (b.3) for each of a second plurality of peripheral points in the captured image gamut to define a second plurality of shapes having a common intersection in the transform space; and (b.5) estimating differences between the source of light and the reference light source corresponding to the location of the periphery in the transform space of the common intersection of the second plurality of shapes. The method of claim 8, further comprising the step of: (b.2.1) transforming points of a three-dimensional RGB color space into points of the two-dimensional chromaticity space, each point in the two-dimensional chromaticity space representing the color of one pixel in the image. The method of either claim 8 or 9, wherein each of the first plurality of points defining the shape in the transform space is defined by two discrete values, one value being the dimensionless quotient of the R/B ratio values of the corresponding captured image gamut peripheral point and the corresponding one of the first plurality of reference image gamut peripheral points, and the other value being the dimensionless quotient of the G/B ratio values of the corresponding captured image gamut peripheral point and the corresponding one of the first plurality of reference image gamut peripheral points. The method of any one of claims 8 to 10, wherein the captured image data is generated with a plurality of color filters (102), an array of detectors (103) producing a signal representative of an amount of light detected, and a circuit connected to the array for processing the signals from the detectors. The method of any on of claims 8 to 10, wherein the captured image data is generated within a digital camera and the non-color-corrected data is mapped and adjusted to white-balance the uncorrected image of the scene by a processor (113) contained within the digital camera. The method of any one of claims 8 to 10, wherein the captured image data is generated within a digital camera and the non-color-corrected data is mapped and adjusted to white-balance the uncorrected image of the scene by a host computer (121) connected to the digital camera.

Inventors: HUBEL PAUL H, SANSOM-WAI CINDY V, WINTER KURT A, HUBEL, PAUL H., SANSOM-WAI, CINDY V., WINTER, KURT A.
Applicants: HEWLETT PACKARD CO, HEWLETT-PACKARD COMPANY
Application year: 1998
Main classification: H04N9
IPC codes: H04N9