The present invention relates generally to digital image processing, and more particularly to a system and method for correcting the white balance in a digital image.
Various types of light, present when a digital image is captured, can cause an object in the captured image to have a hue that is not present when the object is viewed directly. For example, various types of artificial light can cause objects in captured images to have an orange hue, while natural light under certain circumstances can cause objects to have a blue hue. This hue is most noticeable on objects within an image that a viewer knows are white and expects to see as white.
To correct this type of image distortion, many sophisticated algorithms are applied to digital images to change pixel values for acquired image data into pixel values that will not show the distortion. This process of changing the values for acquired image data to make portions of an image expected to be white appear white is frequently referred to as adjusting the white balance of the image. White balance algorithms currently known in the art tend to be computationally expensive, and thus unsuitable for being implemented in hardware with real time logic and unsuitable for being implemented on smaller, mobile devices that have limited memory and limited processing power. Many white balance algorithms currently known in the art also require users to supply values for various settings in order for the algorithm to be executed, which undesirably increases a user's involvement in the picture taking process.
The approaches described in this section are approaches that could be pursued, but not necessarily approaches that have been previously conceived or pursued. Therefore, unless otherwise indicated, it should not be assumed that any of the approaches described in this section qualify as prior art merely by virtue of their inclusion in this section.
The present invention is illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which like reference numerals refer to similar elements and in which:
In the following description, for the purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the present invention. It will be apparent, however, that the present invention may be practiced without these specific details. In other instances, well-known structures and devices are shown in block diagram form in order to avoid unnecessarily obscuring the present invention.
Techniques are described herein for performing white balance by adjusting the values assigned to the red, green, and blue subpixels of a pixel in order to cause color neutral areas of a picture to be rendered color neutral. Each pixel in a pixel array has an RGB product equal to the pixel's red value (R) multiplied by the pixel's green value (G) multiplied by the pixel's blue value (B). During the process of image capture, a first value corresponding to an average of the RGB products of each pixel in an image can be calculated and stored. A second value, corresponding to a variance between the RGB products of the pixels and the first value, can be calculated and stored. A subset of pixels with RGB products greater than the first value plus the second value can be identified. For the subset of pixels, the average values of R, G, and B for the pixels in the subset can be determined. Based on the determined averages of R, G, and B, gains can be determined that make the average values of R, G, and B for the subset of pixels equal. Based on the determined gains, the R, G, and B values for all pixels, or a subset of pixels, in the captured imaged can be adjusted.
Typically, a digital image file includes a set of data values for a 2-dimensional grid of pixels. The pixel grid comprises rows of pixels that run horizontally and columns of pixels that run vertically, and each pixel in the pixel grid is identifiable by the row and column that contain that pixel. For example, an 800×600 image would have 800 columns of pixels and 600 rows of pixels for a total of 480,000 pixels. Column 155 and row 235, for example, would uniquely identify a single pixel of the 480,000 pixels in the grid.
Each pixel in the grid can comprise a plurality of subpixels.
A pixel appears as a neutral color, such as those on the gray scale, when the values for the red element, green element, and blue element are equal in value to one another. For example, the truest white a display is capable of producing occurs when all three subpixels are assigned values of 255; a true gray color is produced when all three subpixels are assigned values of 128; and black is produced when all three subpixels are assigned values of 0. Assigning high values (e.g. over 220) to each of the subpixels of a pixel will cause the pixel to produce a color that is near white. When the values of the subpixels are not equal, the color produced by the pixel will have a hue. For example, if the value of the red subpixel is 240, the value of the green subpixel is 240, and the value of the blue subpixel is 248, then the color produced by the pixel will have a blue hue.
In digital image acquisition, variations in light temperature can cause an image sensor to detect white and near-white colors as having such a hue. Techniques are described hereafter for identifying portions of images containing an undesirable hue and adjusting the values of the subpixels so that the display renders the near white portions of the image as color neutral and without the undesirable hue.
Unlike prior art methods of adjusting an image's white balance that use luminance values or RGB sums to identify near-white pixels, the techniques described hereafter use a product of the R, G, and B values (RGBproduct) for individual pixels in an image to identify areas within the image that are expected to be color neutral.
From a third frame, a set of “near-white” pixels are identified (block 230) based on the variance determined at block 220. In one embodiment, the near-white pixels are the pixels in the image that satisfy the condition RGBproduct>thresholdnear-white, where the value of the threshold is (a*RGBavg
In one embodiment, pixels with an R, G, or B value that is greater than a thresholdsaturated value, such as when R, G, or B is equal to or greater than 250, are considered saturated and are excluded from the set of near-white pixels. Saturated pixels are excluded from the near-white pixel set because a subpixel value above that thresholdsaturated value often contains skewed color information. For example, in an image with a very bright red light, the image sensor acquiring the image might not be able to accurately detect the intensity of the red component. As a result, a red subpixel of a pixel might have a value of close to 255, but if not for the limitations of the hardware acquiring the image, the value of the red subpixel would be higher. In such an instance, the image data acquired by the image sensor may not accurately reflect the ratio of the R, G, and B values present. Therefore, these pixels are excluded from the set of near-white pixels.
When (a*RGBavg
The b-coefficient determines the white-balance operation's sensitivity. For example, a large b-value decreases the number of pixels that will be included in the set of near-white pixels by increasing the thresholdnear-white value an RGBproduct must exceed to be included in the set of near-white pixels. In a system with a 24-bit image acquisition sensor, the a-coefficient might equal 1.2, and the b-coefficient might equal 2.5. When implementing the techniques described herein with image sensors of other bit-depths, the values of the a-coefficient and b-coefficient might be different.
An average of the R values (Ravg), an average of the G values (Gavg), and an average of the B values (Bavg) for the pixels in the set of near-white pixels can be calculated. Based on Ravg, Gavg, and Bavg, gain factors can be determined (block 240), where GR represents a gain to be applied to red subpixels, GG represents a gain to be applied to green subpixels, and GB represents a gain to be applied to blue subpixels. According to one embodiment, the gain factors are determined to make Ravg, Gavg, and Bavg equal. In such an embodiment, the gain factors can be determined for each of Ravg, Gavg, and Bavg based on the following equations:
GR*Ravg=(Ravg+Gavg+Bavg)/3;
GG*Gavg=(Ravg+Gavg+Bavg)/3;
GB*Bavg=(Ravg+Gavg+Bavg)/3.
Determining gain factors to make Ravg, Gavg, and Bavg equal to (Ravg+Gavg+Bavg)/3 is but one of many contemplated embodiments. Gain factors can also be determined based on lowering the two highest of the Ravg, Gavg, and Bavg to be equal to the lowest of the three, based on raising the two lowest of Ravg, Gavg, and Bavg to equal to the highest of the three values, or by numerous other techniques.
The determined value for GR can be used to adjust the R value of each pixel in the stored image; the determined value for GG can be used to adjust the G value of each pixel in the stored image; and the determined value for GB can be used to adjust the B value of each pixel in the stored image (block 250). In some embodiments, GR, GG, and GB might be used to adjust fewer than all the pixels in the image, such as only the set of near-white pixels identified in block 230 of
In one embodiment, the first, second, and third frames are separate frames that are acquired in a pre-capture movie mode. For example, when the user presses a button to take a picture, a digital camera might continuously acquire images at a rate of 2 to 16 frames per second, as if the camera were recording a movie. However, rather than store each of the frames, the camera may only store a single image. In such an embodiment, RGBavg
In one embodiment, the techniques of the present invention can be implemented based on a single frame. For example, when the techniques are implemented in software that is executed after an image has been capture, the processing need not be performed in real-time. Consequently, the first, second, and third frames do not need to be separate frames but can be separate frames. In some embodiments, the first, second, and third frames described herein will be the same frame.
In some embodiments, near-gray pixels can be used as the basis for white balancing operation, instead of or in addition to near-white pixels. Near-gray pixels can be identified by finding the pixels for the highest RGBproduct that correspond to a specific sum of RGB values (RGBsum). For example, a first pixel with R, G, and B values of 100, 25, and 75 and a second pixel with R, G, and B values of 66, 68, and 66 will both have RGBsum values of 200, but the first pixel will have an RGBproduct of 187,500 while the second pixel will have an RGBproduct of 296,208. The high RGBproduct of the second pixel can indicate that the second pixel is a near-gray pixel. The highest RGBproduct for a particular RGBsum occurs when R, G, and B values are equal. Thus, the RGBproduct can be used to identify near-gray pixels that can be included in the subset of pixels use to calculate gain factors for the white-balancing operation, in addition to or instead of near-white pixels.
Image processor 374 interfaces with communication circuit 390 via camera and graphics interface 380. Communication circuit 390 comprises antenna 312, transceiver 393, memory 396, microprocessor 392, input/output circuit 394, audio processing circuit 306, and user interface 397. Transceiver 393 is coupled to antenna 312 for receiving and transmitting signals. Transceiver 393 is a fully functional cellular radio transceiver, which may operate according to any known standard, including the standards known generally as the Global System for Mobile Communications (GSM), TIA/EIA-36, cdmaOne, cdma2000, UMTS, and Wideband CDMA.
The image processor 374 may process images acquired by the sensor 372 using one or more embodiments described herein. The image processor 374 can be implemented in hardware, software, or some combination of software and hardware. For example, the image processor 374 could be implemented as part of an application specific integrated circuit (ASIC). As another example, the image processor 374 may be capable of accessing instructions that are stored on a computer readable medium and executing those instructions on a processor, in order to implement one or more embodiments of the present invention.
Microprocessor 392 controls the operation of mobile device 300, including transceiver 393, according to programs stored in memory 396. Microprocessor 392 may further execute portions or the entirety of the image processing embodiments disclosed herein. Processing functions may be implemented in a single microprocessor, or in multiple microprocessors. Suitable microprocessors may include, for example, both general purpose and special purpose microprocessors and digital signal processors. Memory 396 represents the entire hierarchy of memory in a mobile communication device, and may include both random access memory (RAM) and read-only memory (ROM). Computer program instructions and data required for operation are stored in non-volatile memory, such as EPROM, EEPROM, and/or flash memory, which may be implemented as discrete devices, stacked devices, or integrated with microprocessor 392.
Input/output circuit 394 interfaces microprocessor 392 with image processor 374 of camera assembly 370 via camera and graphics interface 380. Camera and graphics interface 380 may also interface image processor 374 with user interface 397 according to any method known in the art. In addition, input/output circuit 394 interfaces microprocessor 392, transceiver 393, audio processing circuit 306, and user interface 397 of communication circuit 390. User interface 397 includes a display 326, speaker 328, microphone 338, and keypad 340. Display 326, disposed on the back of display section, allows the operator to see dialed digits, images, called status, menu options, and other service information. Keypad 340 includes an alphanumeric keypad and may optionally include a navigation control, such as joystick control (not shown) as is well known in the art. Further, keypad 340 may comprise a full QWERTY keyboard, such as those used with palmtop computers or smart phones. Keypad 340 allows the operator to dial numbers, enter commands, and select options.
Microphone 338 converts the user's speech into electrical audio signals. Audio processing circuit 306 accepts the analog audio inputs from microphone 338, processes these signals, and provides the processed signals to transceiver 393 via input/output 394. Audio signals received by transceiver 393 are processed by audio processing circuit 306. The basic analog output signals produced by processed audio processing circuit 306 are provided to speaker 328. Speaker 328 then converts the analog audio signals into audible signals that can be heard by the user.
Those skilled in the art will appreciate that one or more elements shown in
According to one embodiment, the techniques described herein are implemented by one or more special-purpose computing devices. The special-purpose computing devices may be hard-wired to perform the techniques, or may include digital electronic devices such as one or more application-specific integrated circuits (ASICs) or field programmable gate arrays (FPGAs) that are persistently programmed to perform the techniques, or may include one or more general purpose hardware processors programmed to perform the techniques pursuant to program instructions in firmware, memory, other storage, or a combination. Such special-purpose computing devices may also combine custom hard-wired logic, ASICs, or FPGAs with custom programming to accomplish the techniques. The special-purpose computing devices may be desktop computer systems, portable computer systems, handheld devices, networking devices or any other device that incorporates hard-wired and/or program logic to implement the techniques.
For example,
Computer system 400 also includes a main memory 406, such as a random access memory (RAM) or other dynamic storage device, coupled to bus 402 for storing information and instructions to be executed by processor 404. Main memory 406 also may be used for storing temporary variables or other intermediate information during execution of instructions to be executed by processor 404. Such instructions, when stored in storage media accessible to processor 404, render computer system 400 into a special-purpose machine that is customized to perform the operations specified in the instructions.
Computer system 400 further includes a read only memory (ROM) 408 or other static storage device coupled to bus 402 for storing static information and instructions for processor 404. A storage device 410, such as a magnetic disk or optical disk, is provided and coupled to bus 402 for storing information and instructions.
Computer system 400 may be coupled via bus 402 to a display 412, such as a cathode ray tube (CRT), for displaying information to a computer user. An input device 414, including alphanumeric and other keys, is coupled to bus 402 for communicating information and command selections to processor 404. Another type of user input device is cursor control 416, such as a mouse, a trackball, or cursor direction keys for communicating direction information and command selections to processor 404 and for controlling cursor movement on display 412. This input device typically has two degrees of freedom in two axes, a first axis (e.g., x) and a second axis (e.g., y), that allows the device to specify positions in a plane.
Computer system 400 may implement the techniques described herein using customized hard-wired logic, one or more ASICs or FPGAs, firmware and/or program logic which in combination with the computer system causes or programs computer system 400 to be a special-purpose machine. According to one embodiment, the techniques herein are performed by computer system 400 in response to processor 404 executing one or more sequences of one or more instructions contained in main memory 406. Such instructions may be read into main memory 406 from another storage medium, such as storage device 410. Execution of the sequences of instructions contained in main memory 406 causes processor 404 to perform the process steps described herein. In alternative embodiments, hard-wired circuitry may be used in place of or in combination with software instructions.
The term “storage media” as used herein refers to any media that store data and/or instructions that cause a machine to operation in a specific fashion. Such storage media may comprise non-volatile media and/or volatile media. Non-volatile media includes, for example, optical or magnetic disks, such as storage device 410. Volatile media includes dynamic memory, such as main memory 406. Common forms of storage media include, for example, a floppy disk, a flexible disk, hard disk, solid state drive, magnetic tape, or any other magnetic data storage medium, a CD-ROM, any other optical data storage medium, any physical medium with patterns of holes, a RAM, a PROM, and EPROM, a FLASH-EPROM, NVRAM, any other memory chip or cartridge.
Storage media is distinct from but may be used in conjunction with transmission media. Transmission media participates in transferring information between storage media. For example, transmission media includes coaxial cables, copper wire and fiber optics, including the wires that comprise bus 402. Transmission media can also take the form of acoustic or light waves, such as those generated during radio-wave and infra-red data communications.
Various forms of media may be involved in carrying one or more sequences of one or more instructions to processor 404 for execution. For example, the instructions may initially be carried on a magnetic disk or solid state drive of a remote computer. The remote computer can load the instructions into its dynamic memory and send the instructions over a telephone line using a modem. A modem local to computer system 400 can receive the data on the telephone line and use an infra-red transmitter to convert the data to an infra-red signal. An infra-red detector can receive the data carried in the infra-red signal and appropriate circuitry can place the data on bus 402. Bus 402 carries the data to main memory 406, from which processor 404 retrieves and executes the instructions. The instructions received by main memory 406 may optionally be stored on storage device 410 either before or after execution by processor 404.
Computer system 400 also includes a communication interface 418 coupled to bus 402. Communication interface 418 provides a two-way data communication coupling to a network link 420 that is connected to a local network 422. For example, communication interface 418 may be an integrated services digital network (ISDN) card, cable modem, satellite modem, or a modem to provide a data communication connection to a corresponding type of telephone line. As another example, communication interface 418 may be a local area network (LAN) card to provide a data communication connection to a compatible LAN. Wireless links may also be implemented. In any such implementation, communication interface 418 sends and receives electrical, electromagnetic or optical signals that carry digital data streams representing various types of information.
Network link 420 typically provides data communication through one or more networks to other data devices. For example, network link 420 may provide a connection through local network 422 to a host computer 424 or to data equipment operated by an Internet Service Provider (ISP) 426. ISP 426 in turn provides data communication services through the world wide packet data communication network now commonly referred to as the “Internet” 428. Local network 422 and Internet 428 both use electrical, electromagnetic or optical signals that carry digital data streams. The signals through the various networks and the signals on network link 420 and through communication interface 418, which carry the digital data to and from computer system 400, are example forms of transmission media.
Computer system 400 can send messages and receive data, including program code, through the network(s), network link 420 and communication interface 418. In the Internet example, a server 430 might transmit a requested code for an application program through Internet 428, ISP 426, local network 422 and communication interface 418.
The received code may be executed by processor 404 as it is received, and/or stored in storage device 410, or other non-volatile storage for later execution.
In the foregoing specification, embodiments of the invention have been described with reference to numerous specific details that may vary from implementation to implementation. Thus, the sole and exclusive indicator of what is the invention, and is intended by the applicants to be the invention, is the set of claims that issue from this application, in the specific form in which such claims issue, including any subsequent correction. Any definitions expressly set forth herein for terms contained in such claims shall govern the meaning of such terms as used in the claims. Hence, no limitation, element, property, feature, advantage or attribute that is not expressly recited in a claim should limit the scope of such claim in any way. The specification and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense.
This application is Continuation of U.S. patent application no. 12/651,190, filed Dec. 31, 2009, now U.S. Pat. No. 8,339,471, which is hereby incorporated by reference.
Number | Name | Date | Kind |
---|---|---|---|
5867169 | Prater | Feb 1999 | A |
6459449 | Juen | Oct 2002 | B1 |
6947078 | Kuwata et al. | Sep 2005 | B1 |
7142238 | Sawada et al. | Nov 2006 | B1 |
7184080 | Kehtarnavaz et al. | Feb 2007 | B2 |
7245319 | Enomoto | Jul 2007 | B1 |
7352394 | DeLuca et al. | Apr 2008 | B1 |
7436998 | Steinberg et al. | Oct 2008 | B2 |
7469071 | Drimbarean et al. | Dec 2008 | B2 |
7474341 | DeLuca et al. | Jan 2009 | B2 |
7536036 | Steinberg et al. | May 2009 | B2 |
7587085 | Steinberg et al. | Sep 2009 | B2 |
7620218 | Steinberg et al. | Nov 2009 | B2 |
7630006 | DeLuca et al. | Dec 2009 | B2 |
7653240 | Otobe et al. | Jan 2010 | B1 |
7804531 | DeLuca et al. | Sep 2010 | B2 |
7847839 | DeLuca et al. | Dec 2010 | B2 |
7847840 | DeLuca et al. | Dec 2010 | B2 |
7852384 | DeLuca et al. | Dec 2010 | B2 |
7916897 | Corcoran et al. | Mar 2011 | B2 |
7953250 | Steinberg et al. | May 2011 | B2 |
7953251 | Steinberg et al. | May 2011 | B1 |
7953287 | Drimbarean et al. | May 2011 | B2 |
8036460 | Nanu et al. | Oct 2011 | B2 |
8055029 | Petrescu et al. | Nov 2011 | B2 |
8089555 | Vakrat et al. | Jan 2012 | B2 |
8135184 | Steinberg et al. | Mar 2012 | B2 |
8155397 | Bigioi et al. | Apr 2012 | B2 |
8265388 | Nanu et al. | Sep 2012 | B2 |
8339462 | Stec et al. | Dec 2012 | B2 |
8339471 | Alcazar | Dec 2012 | B2 |
20020051639 | Enomoto | May 2002 | A1 |
20030038344 | Palmer et al. | Feb 2003 | A1 |
20030068080 | Lu | Apr 2003 | A1 |
20030206179 | Deering | Nov 2003 | A1 |
20040113549 | Roberts et al. | Jun 2004 | A1 |
20050156330 | Harris | Jul 2005 | A1 |
20050247944 | Haque et al. | Nov 2005 | A1 |
20060252230 | Yang | Nov 2006 | A1 |
20070041064 | Subbotin | Feb 2007 | A1 |
20070153341 | Kang | Jul 2007 | A1 |
20070211449 | Holman et al. | Sep 2007 | A1 |
20070273906 | Tsuchiya | Nov 2007 | A1 |
20080043444 | Hasegawa et al. | Feb 2008 | A1 |
20080054486 | Murayama et al. | Mar 2008 | A1 |
20080143851 | Shi | Jun 2008 | A1 |
20080296599 | Mazzochette | Dec 2008 | A1 |
20080309790 | Nishiwaki et al. | Dec 2008 | A1 |
20090014739 | Chiang et al. | Jan 2009 | A1 |
20090059025 | Tsujino et al. | Mar 2009 | A1 |
20090096910 | Yasuda et al. | Apr 2009 | A1 |
20090097745 | Kim et al. | Apr 2009 | A1 |
20090147099 | Kim et al. | Jun 2009 | A1 |
20090263022 | Petrescu et al. | Oct 2009 | A1 |
20090303342 | Corcoran et al. | Dec 2009 | A1 |
20100265527 | Tsuchiya | Oct 2010 | A1 |
20110026780 | Corcoran et al. | Feb 2011 | A1 |
20110058071 | Bigioi et al. | Mar 2011 | A1 |
20110069186 | DeLuca et al. | Mar 2011 | A1 |
20110074975 | DeLuca et al. | Mar 2011 | A1 |
20110102643 | Nanu et al. | May 2011 | A1 |
20110134271 | Bigioi et al. | Jun 2011 | A1 |
20110205381 | Vranceanu et al. | Aug 2011 | A1 |
20110221936 | Bigioi et al. | Sep 2011 | A1 |
20120008002 | Bigioi et al. | Jan 2012 | A1 |
20120014600 | Nanu et al. | Jan 2012 | A1 |
20120038788 | DeLuca et al. | Feb 2012 | A1 |
20120057041 | Stec et al. | Mar 2012 | A1 |
20120069198 | Bigioi et al. | Mar 2012 | A1 |
20120069222 | Steinberg et al. | Mar 2012 | A1 |
20120070087 | Petrescu et al. | Mar 2012 | A1 |
20120177289 | Stec et al. | Jul 2012 | A1 |
20120199857 | Humpston et al. | Aug 2012 | A1 |
Number | Date | Country |
---|---|---|
1916964 | Feb 2007 | CN |
2006-115039 | Apr 2006 | JP |
2009-522869 | Jun 2009 | JP |
2007079039 | Jul 2007 | WO |
2009095422 | Aug 2009 | WO |
2009095422 | Dec 2009 | WO |
2011044393 | Apr 2011 | WO |
2011082366 | Jul 2011 | WO |
Entry |
---|
PCT Notification of Transmittal of the International Search Report and the Written Opinion of the International Searching Authority, or the Declaration, for PCT Application No. PCT/US2010/062605, report dated Feb. 24, 2011, 7 pages. |
PCT Notification of Transmittal of International Preliminary Report on Patentability, Chapter 1 of the Patent Cooperation Treaty, International Preliminary Report on Patentability, for PCT Application No. PCT/US2010/062605, report dated Jul. 4, 2012, 7 pages. |
“Color balance” from Wikipedia, the free encyclopedia dated Jan. 2011 downloaded from the Internet on Feb. 2, 2011 < http://en.wikipedia.org/wiki/Color—balance > (6 pages). |
Patent Abstract for Chinese published application No. 1916964, published on Feb. 21, 2007. Window added interpolation method for Sinc function in image scaling device. |
John Mallon; Paul Whelan: “Calibration and removal of lateral chromatic aberration in images.” Pattern Recognition Letters, vol. 28, No. 1, Jan. 2007, pp. 125-135, XP002536872 New York, DOI: http://dx.doi.org/10.1016/J.PATREC.2006.06.013. |
Patent Abstracts of Japan, publication No. 2006-115039, published on Apr. 27, 2006, Image Processor, Image Processing Method and Computer Program. |
Number | Date | Country | |
---|---|---|---|
20130201200 A1 | Aug 2013 | US |
Number | Date | Country | |
---|---|---|---|
Parent | 12651190 | Dec 2009 | US |
Child | 13726527 | US |