CN104869379B - White balance compensation method and electronic device - Google Patents
White balance compensation method and electronic device Download PDFInfo
- Publication number
- CN104869379B CN104869379B CN201410066432.2A CN201410066432A CN104869379B CN 104869379 B CN104869379 B CN 104869379B CN 201410066432 A CN201410066432 A CN 201410066432A CN 104869379 B CN104869379 B CN 104869379B
- Authority
- CN
- China
- Prior art keywords
- color
- ratio
- composition
- pixel
- white balance
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 25
- 238000009434 installation Methods 0.000 claims 6
- 238000012545 processing Methods 0.000 description 48
- 239000003086 colorant Substances 0.000 description 7
- 238000003384 imaging method Methods 0.000 description 7
- 238000010586 diagram Methods 0.000 description 4
- 238000013461 design Methods 0.000 description 3
- 230000002411 adverse Effects 0.000 description 2
- 238000012937 correction Methods 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000000295 complement effect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 229910044991 metal oxide Inorganic materials 0.000 description 1
- 150000004706 metal oxides Chemical class 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
Landscapes
- Processing Of Color Television Signals (AREA)
- Color Television Image Signal Generators (AREA)
Abstract
Description
技术领域technical field
本发明是有关于一种图像处理方法及电子装置,且特别是有关于一种白平衡补偿方法及电子装置。The present invention relates to an image processing method and an electronic device, and in particular to a white balance compensation method and an electronic device.
背景技术Background technique
目前移动装置上的相机应用越来越广泛,而使用者对于拍照后的图像品质要求也越来越高。相机成像的品质取决于感光元件的大小、镜头与光圈的设计,但由于受限于行动装置大小,因此感光元件及镜头等光学元件的设计与品质就受到了限制。所以,在设计行动装置上的后端图像信号处理(Image Signal Processor,ISP)芯片时,如何针对感光元件所得到原始图像(raw image)进行曝光、白平衡等等的校正,便是现今发展的一个很重要的项目。At present, cameras on mobile devices are more and more widely used, and users have higher and higher requirements for image quality after taking pictures. The image quality of a camera depends on the size of the photosensitive element, the design of the lens and the aperture, but due to the size of the mobile device, the design and quality of optical elements such as the photosensitive element and the lens are limited. Therefore, when designing the back-end Image Signal Processor (ISP) chip on the mobile device, how to correct the exposure, white balance, etc. for the raw image obtained by the photosensitive element is the current development. A very important project.
相机白平衡(White Balance)最主要目的是要还原当时拍摄场景的色温,进而还原当时的颜色。但由于当初演算法设计上的方便,以及ISP芯片运算能力不够等等因素,使得白平衡校正的方式变成让灰阶及白色等相关颜色的R:G:B(即,红色:绿色:蓝色)的比例变为1:1:1(即,灰世界(grey world)演算法)。The main purpose of camera white balance is to restore the color temperature of the shooting scene at that time, and then restore the color at that time. However, due to the convenience of the original algorithm design and the insufficient computing power of the ISP chip and other factors, the white balance correction method has changed to the R:G:B (ie, red:green:blue) of gray scale and white and other related colors. color) becomes 1:1:1 (ie, gray world algorithm).
在正常的光源(例如日光)底下,上述做法可能适用于进行原始图像的白平衡校正。然而,假若在黄光等较暖色系的光源底下,白色的R:G:B的比例不是1:1:1,可能为1.2:1:0.8。在此情况下,若把此类场景的R:G:B的比例校正成1:1:1,便会导致白色变得很纯白,但却使得其他的颜色出现偏蓝的情形。Under normal light sources (such as sunlight), the above practice may be suitable for white balance correction of raw images. However, if the white R:G:B ratio is not 1:1:1 under a warmer color light source such as yellow light, it may be 1.2:1:0.8. In this case, if the R:G:B ratio of such a scene is corrected to 1:1:1, it will cause the white to become very pure white, but it will make other colors appear bluish.
除此之外,为了计算R:G:B的比例,ISP芯片会把一张图像的每个像素(pixel)进行R:G:B的比例分析,再将其倒数作为RGB该补偿的数值。举例而言,若一张图像的R:G:B的比例为0.5:1:0.2,所以其对应的补偿值应为RGB=(2,1,5)。所以,如何有效取得有效的像素信息,来进行白平衡计算,便是很重要的关键。In addition, in order to calculate the ratio of R:G:B, the ISP chip will analyze the ratio of R:G:B for each pixel (pixel) of an image, and then use its reciprocal as the RGB compensation value. For example, if the R:G:B ratio of an image is 0.5:1:0.2, the corresponding compensation value should be RGB=(2,1,5). Therefore, how to effectively obtain effective pixel information for white balance calculation is a very important key.
在传统的白平衡演算法中,其大多是取整张图像的像素来做白平衡的计算。当原始图像里面有大量的纯色像素或接近纯色的像素时,传统的白平衡演算法将可能误判场景的色温,进而导致补偿后的图像出现颜色失真的情形。举例而言,当原始图像里面有大量的黄色的物件或是红色的物件,此原始图像中的红色(R)比例将会高于蓝色(B)。因此,传统的白平衡演算法将可能误判这是暖色温的场景,进而调高对应于蓝色的补偿值,造成补偿后的画面偏蓝的结果。In the traditional white balance algorithm, most of them take the pixels of the entire image to calculate the white balance. When there are a large number of pure color pixels or pixels close to pure color in the original image, the traditional white balance algorithm may misjudge the color temperature of the scene, resulting in color distortion in the compensated image. For example, when there are a lot of yellow objects or red objects in the original image, the proportion of red (R) in the original image will be higher than that of blue (B). Therefore, the traditional white balance algorithm may misjudge that this is a scene with a warm color temperature, and then increase the compensation value corresponding to blue, resulting in a bluish picture after compensation.
发明内容Contents of the invention
有鉴于此,本发明提供一种白平衡补偿方法及电子装置。所述白平衡补偿方法可避免纯色像素或接近纯色的像素影响电子装置对场景色温的判断,进而产生较佳的白平衡补偿结果。In view of this, the present invention provides a white balance compensation method and an electronic device. The white balance compensation method can prevent the pure color pixels or pixels close to the pure color from affecting the electronic device's judgment of the scene color temperature, thereby producing a better white balance compensation result.
本发明提供一种白平衡补偿方法,适于电子装置,所述方法包括下列步骤:取得预设颜色在预设色温下的第一特定颜色比例以及第二特定颜色比例;取得参考颜色在预设色温下的第一参考颜色比例以及第二参考颜色比例;获取包括多个像素的画面,并取得画面对应的曝光索引值,其中各像素具有第一颜色比例以及第二颜色比例;当曝光索引值对应于预设色温时,从所述多个像素中取出多个特定像素;依据所述多个特定像素计算画面的多个白平衡补偿值;取得画面的画面色温;当画面色温对应于预设色温时,依据第一参考颜色比例以及第二参考颜色比例更新所述多个白平衡补偿值;依据更新后的所述多个白平衡补偿值对各像素进行白平衡操作,以产生补偿后的画面。The present invention provides a white balance compensation method suitable for electronic devices. The method includes the following steps: obtaining a first specific color ratio and a second specific color ratio of a preset color at a preset color temperature; obtaining a reference color at a preset color temperature. The first reference color ratio and the second reference color ratio at the color temperature; acquire a picture including a plurality of pixels, and obtain an exposure index value corresponding to the picture, wherein each pixel has a first color ratio and a second color ratio; when the exposure index value When corresponding to the preset color temperature, extract a plurality of specific pixels from the plurality of pixels; calculate a plurality of white balance compensation values of the picture according to the plurality of specific pixels; obtain the picture color temperature of the picture; when the picture color temperature corresponds to the preset When the color temperature is high, update the plurality of white balance compensation values according to the first reference color ratio and the second reference color ratio; perform a white balance operation on each pixel according to the updated plurality of white balance compensation values to generate a compensated screen.
本发明提供一种电子装置,其包括取像单元、储存单元以及处理单元。储存单元储存多个模块。处理单元耦接取像单元以及储存单元,存取所述多个模块以执行下列步骤:取得预设颜色在预设色温下的第一特定颜色比例以及第二特定颜色比例;取得参考颜色在预设色温下的第一参考颜色比例以及第二参考颜色比例;控制取像单元获取包括多个像素的画面,并取得画面对应的曝光索引值,其中各像素具有第一颜色比例以及第二颜色比例;当曝光索引值对应于预设色温时,从所述多个像素中取出多个特定像素;依据所述多个特定像素计算画面的多个白平衡补偿值;取得画面的画面色温;当画面色温对应于预设色温时,依据第一参考颜色比例以及第二参考颜色比例更新所述多个白平衡补偿值;依据更新后的所述多个白平衡补偿值对各像素进行白平衡操作,以产生补偿后的画面。The invention provides an electronic device, which includes an image capturing unit, a storage unit and a processing unit. The storage unit stores a plurality of modules. The processing unit is coupled to the imaging unit and the storage unit, and accesses the multiple modules to perform the following steps: obtain the first specific color ratio and the second specific color ratio of the preset color at the preset color temperature; obtain the reference color at the preset color temperature. Set the first reference color ratio and the second reference color ratio under the color temperature; control the imaging unit to obtain a picture including a plurality of pixels, and obtain the exposure index value corresponding to the picture, wherein each pixel has the first color ratio and the second color ratio ; When the exposure index value corresponds to the preset color temperature, take out a plurality of specific pixels from the plurality of pixels; calculate a plurality of white balance compensation values of the picture according to the plurality of specific pixels; obtain the picture color temperature of the picture; when the picture When the color temperature corresponds to the preset color temperature, update the plurality of white balance compensation values according to the first reference color ratio and the second reference color ratio; perform a white balance operation on each pixel according to the updated plurality of white balance compensation values, to produce a compensated picture.
基于上述,本发明提出的白平衡补偿方法及电子装置可在计算所获取画面的白平衡补偿值时排除接近纯色的像素,进而避免这些像素对补偿后的画面造成负面的影响。Based on the above, the white balance compensation method and electronic device proposed by the present invention can exclude pixels close to pure color when calculating the white balance compensation value of the captured picture, thereby preventing these pixels from negatively affecting the compensated picture.
为让本发明的上述特征和优点能更明显易懂,下文特举实施例,并配合所附图式作详细说明如下。In order to make the above-mentioned features and advantages of the present invention more comprehensible, the following specific embodiments are described in detail together with the accompanying drawings.
附图说明Description of drawings
图1是依据本发明的一实施例绘示的电子装置示意图;FIG. 1 is a schematic diagram of an electronic device according to an embodiment of the present invention;
图2是依据本发明是一实施例绘示的白平衡补偿方法示意图。FIG. 2 is a schematic diagram of a white balance compensation method according to an embodiment of the present invention.
附图标记说明:Explanation of reference signs:
100:电子装置;100: electronic device;
110:取像单元;110: imaging unit;
120:储存单元;120: storage unit;
130:处理单元;130: processing unit;
S210~S280:步骤。S210-S280: steps.
具体实施方式detailed description
图1是依据本发明的一实施例绘示的电子装置示意图。在本实施例中,电子装置100包括取像单元110、储存单元120以及处理单元130。电子装置100例如是相机、智能型手机、平板电脑、个人数字助理(Personal Digital Assistant)或是其他任何可获取图像的装置。取像单元110例如是任何具有电荷耦合元件(Charge coupled device,CCD)镜头、互补式金氧半晶体管(Complementary metal oxide semiconductor transistors,CMOS)镜头,或红外线镜头的摄影机,亦可以是可取得深度信息的图像获取设备,例如是深度摄影机(depth camera)或立体摄影机。储存单元120例如是任意型式的固定式或可移动式随机存取存储器(Random Access Memory,RAM)、只读存储器(Read-Only Memory,ROM)、快闪存储器(Flash memory)、硬盘或其他类似装置或这些装置的组合,在此不限制其种类。FIG. 1 is a schematic diagram of an electronic device according to an embodiment of the present invention. In this embodiment, the electronic device 100 includes an image capturing unit 110 , a storage unit 120 and a processing unit 130 . The electronic device 100 is, for example, a camera, a smart phone, a tablet computer, a personal digital assistant (PDA), or any other device capable of capturing images. The imaging unit 110 is, for example, any camera with a charge coupled device (CCD) lens, a complementary metal oxide semiconductor transistors (CMOS) lens, or an infrared lens, and can also obtain depth information An image acquisition device such as a depth camera or a stereo camera. The storage unit 120 is, for example, any type of fixed or removable random access memory (Random Access Memory, RAM), read-only memory (Read-Only Memory, ROM), flash memory (Flash memory), hard disk or other similar The device or the combination of these devices is not limited in its kind.
处理单元130耦接取像单元110以及储存单元120。处理单元130例如是一般用途处理器、特殊用途处理器、传统的处理器、数字信号处理器、多个微处理器(microprocessor)、一个或多个结合数字信号处理器核心的微处理器、控制器、微控制器、特殊应用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(FieldProgrammable Gate Array,FPGA)、任何其他种类的集成电路、状态机、基于进阶精简指令集机器(Advanced RISC Machine,ARM)的处理器以及类似品。The processing unit 130 is coupled to the image capturing unit 110 and the storage unit 120 . The processing unit 130 is, for example, a general purpose processor, a special purpose processor, a conventional processor, a digital signal processor, a plurality of microprocessors (microprocessor), one or more microprocessors incorporating a digital signal processor core, a control microcontrollers, Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs), any other kind of integrated circuits, state machines, RISC-based machines ( Advanced RISC Machine, ARM) processors and similar.
在本实施例中,处理单元130可存取储存单元120所储存的多个模块以执行本发明提出的白平衡补偿方法的各个步骤。In this embodiment, the processing unit 130 can access multiple modules stored in the storage unit 120 to execute each step of the white balance compensation method proposed by the present invention.
概略而言,当原始图像中具有大量纯色像素时,为了避免让这些纯色像素造成处理单元130对场景色温的误判,本发明的白平衡补偿方法可在计算白平衡补偿值之前透过适当手段排除这些纯色像素。如此一来,当处理单元130即可准确地依据场景色温对原始图像中的每个像素进行白平衡操作时,进而避免补偿后的画面出现偏蓝或是偏红等不良现象。以下将介绍本发明提出的白平衡补偿方法的各个细节。Roughly speaking, when there are a large number of pure color pixels in the original image, in order to prevent these pure color pixels from causing the processing unit 130 to misjudge the color temperature of the scene, the white balance compensation method of the present invention can use appropriate means before calculating the white balance compensation value These solid-color pixels are excluded. In this way, when the processing unit 130 can accurately perform a white balance operation on each pixel in the original image according to the color temperature of the scene, the compensated picture can be prevented from appearing bluish or reddish. Various details of the white balance compensation method proposed by the present invention will be introduced below.
图2是依据本发明的一实施例绘示的白平衡补偿方法示意图。本实施例提出的方法可由图1所示的电子装置100执行,以下即搭配图1所示的各个元件来说明本方法的详细步骤。FIG. 2 is a schematic diagram of a white balance compensation method according to an embodiment of the present invention. The method proposed in this embodiment can be executed by the electronic device 100 shown in FIG. 1 , and the detailed steps of the method will be described below with each component shown in FIG. 1 .
首先,在步骤S210中,处理单元130可取得预设颜色在预设色温下的第一特定颜色比例以及第二特定颜色比例。所述预设颜色例如是红色、绿色及/或蓝色等颜色(即,光的三原色),但本发明的可实施方式不限于此。First, in step S210 , the processing unit 130 may obtain a first specific color ratio and a second specific color ratio of a preset color at a preset color temperature. The preset color is, for example, red, green and/or blue (ie, the three primary colors of light), but embodiments of the present invention are not limited thereto.
在本实施例中,预设颜色可包括第一成分、第二成分以及第三成分。本领域具通常知识者应可了解,各种颜色均可采用特定的红色成分、绿色成分以及蓝色成分的比例(即,R:G:B比例)来表征。因此,预设颜色的第一成分例如是预设颜色的红色成分(R),预设颜色的第二成分例如是预设颜色的绿色成分(G),预设颜色的第三成分例如是预设颜色的蓝色成分,但本发明的可实施方式不限于此。In this embodiment, the preset color may include a first component, a second component and a third component. Those skilled in the art should understand that each color can be represented by a specific ratio of red, green and blue components (ie, R:G:B ratio). Therefore, the first component of the preset color is, for example, the red component (R) of the preset color, the second component of the preset color is, for example, the green component (G) of the preset color, and the third component of the preset color is, for example, the preset The blue component of the color is assumed, but embodiments of the present invention are not limited thereto.
所述预设色温可由设计者依据其所考虑的场景来设定。举例而言,若设计者所考虑的场景为室外环境,则设计者可将预设色温设定为例如6500K。若设计者所考虑的场景为室内环境,则设计者可将预设色温设定为例如4500K。若设计者所考虑的场景为低光源环境,则设计者可将预设色温设定为例如3000K。本领域具通常知识者应可了解,上述各种预设色温的值仅用以举例,并非用以限定本发明的可实施方式。The preset color temperature can be set by the designer according to the scene he considers. For example, if the scene considered by the designer is an outdoor environment, the designer can set the preset color temperature to 6500K, for example. If the scene considered by the designer is an indoor environment, the designer can set the preset color temperature to, for example, 4500K. If the scene considered by the designer is a low light source environment, the designer can set the preset color temperature to, for example, 3000K. Those skilled in the art should understand that the values of the various preset color temperatures mentioned above are just examples, and are not intended to limit the implementation of the present invention.
在设定预设色温之后,处理单元130即可对应取得预设颜色的第一特定颜色比例以及第二特定颜色比例。在本实施例中,预设颜色的第一特定颜色比例例如是预设颜色的第一成分与预设颜色的第二成分之间的比例。换言之,预设颜色的第一特定颜色比例例如是预设颜色的R/G值。此外,预设颜色的第二特定颜色比例为预设颜色的第三成分与预设颜色的第二成分之间的比例。换言之,预设颜色的第二特定颜色比例例如是预设颜色的B/G值。After setting the preset color temperature, the processing unit 130 can correspondingly obtain the first specific color ratio and the second specific color ratio of the preset color. In this embodiment, the first specific color ratio of the preset color is, for example, the ratio between the first component of the preset color and the second component of the preset color. In other words, the first specific color ratio of the preset color is, for example, the R/G value of the preset color. In addition, the second specific color ratio of the preset color is a ratio between the third component of the preset color and the second component of the preset color. In other words, the second specific color ratio of the preset color is, for example, the B/G value of the preset color.
举例而言,当预设颜色以及预设色温分别为红色及6500K时,处理单元130所取得的预设颜色的第一特定颜色比例(即,R/G值)以及第二特定颜色比例(即,B/G值)分别例如是1.85及0.01。如此一来,当处理单元130之后检测到取像单元110所获取的画面对应于6500K的色温(即,对应于室外环境的色温)时,处理单元130即可对应找出此画面中的纯色像素(或接近纯色的像素)。详细而言,当处理单元130检测到取像单元110所获取的画面中出现R/G值大于1.85及B/G值低于0.01的像素时,处理单元130即可得知此像素应为接近红色的物件,进而可在计算所述画面的白平衡补偿值时排除此像素,以避免此像素对补偿后的画面造成负面的影响(例如使补偿后的画面产生偏蓝的情形等)。For example, when the preset color and the preset color temperature are red and 6500K respectively, the processing unit 130 obtains the first specific color ratio (ie, R/G value) and the second specific color ratio (ie, , B/G value) are, for example, 1.85 and 0.01, respectively. In this way, when the processing unit 130 later detects that the picture captured by the imaging unit 110 corresponds to a color temperature of 6500K (that is, corresponds to the color temperature of the outdoor environment), the processing unit 130 can correspondingly find out the pure color pixels in this picture (or pixels that are close to a solid color). In detail, when the processing unit 130 detects a pixel with an R/G value greater than 1.85 and a B/G value lower than 0.01 in the picture captured by the imaging unit 110, the processing unit 130 can know that the pixel should be close to Red objects, and then this pixel can be excluded when calculating the white balance compensation value of the picture, so as to avoid the negative impact of this pixel on the compensated picture (such as making the compensated picture appear bluish, etc.).
接着,在步骤S220中,处理单元130可取得参考颜色在预设色温下的第一参考颜色比例以及第二参考颜色比例。在本实施例中,参考颜色例如是白色或是其他的灰阶颜色。如同先前实施例中教示的,参考颜色亦可包括第一成分(即,红色成分(R))、第二成分(即,绿色成分(G))以及第三成分(即,蓝色成分(B))。并且,在设定预设色温之后,参考颜色的第一参考颜色比例例如是参考颜色的第一成分与参考颜色的第二成分之间的比例。换言之,参考颜色的第一参考颜色比例例如是参考颜色在预设色温下的R/G值。此外,在设定预设色温之后,参考颜色的第二参考颜色比例例如是参考颜色的第三成分与参考颜色的第二成分之间的比例。换言之,参考颜色的第二参考颜色比例例如是参考颜色在预设色温下的B/G值。Next, in step S220 , the processing unit 130 can obtain the first reference color ratio and the second reference color ratio of the reference color at the preset color temperature. In this embodiment, the reference color is, for example, white or other grayscale colors. As taught in the previous examples, the reference color may also include a first component (i.e., a red component (R)), a second component (i.e., a green component (G)), and a third component (i.e., a blue component (B )). And, after setting the preset color temperature, the first reference color ratio of the reference color is, for example, the ratio between the first component of the reference color and the second component of the reference color. In other words, the first reference color ratio of the reference color is, for example, the R/G value of the reference color at a preset color temperature. In addition, after setting the preset color temperature, the second reference color ratio of the reference color is, for example, the ratio between the third component of the reference color and the second component of the reference color. In other words, the second reference color ratio of the reference color is, for example, the B/G value of the reference color at a preset color temperature.
举例而言,当参考颜色以及预设色温分别为白色及6500K时,处理单元130所取得的参考颜色的第一参考颜色比例(即,R/G值)以及第二参考颜色比例(即,B/G值)分别例如是0.8及1.4。For example, when the reference color and the preset color temperature are white and 6500K respectively, the first reference color ratio (ie, R/G value) and the second reference color ratio (ie, B value) of the reference color obtained by the processing unit 130 /G value) are, for example, 0.8 and 1.4, respectively.
此外,在其他实施例中,处理单元130亦可取得参考颜色在多种预设色温下个别对应的第一参考颜色比例以及第二参考颜色比例。举例而言,处理单元130可取得白色在6500K、4500K以及3000K的预设色温下个别对应的R/G值以及B/G值。In addition, in other embodiments, the processing unit 130 may also obtain the first reference color ratio and the second reference color ratio respectively corresponding to the reference color under various preset color temperatures. For example, the processing unit 130 can obtain R/G values and B/G values corresponding to white at preset color temperatures of 6500K, 4500K and 3000K.
在步骤S230中,处理单元130可控制取像单元110获取包括多个像素的画面(例如是原始图像),并取得画面对应的曝光索引值(exposure index)。In step S230 , the processing unit 130 may control the image capturing unit 110 to acquire a frame (for example, an original image) including a plurality of pixels, and obtain an exposure index value (exposure index) corresponding to the frame.
在曝光索引值为已知的情况下,处理单元130即可据以推得画面中的场景是对应于何种环境,进而找出对应于画面中场景的预设色温。举例而言,当画面对应的曝光索引值是对应于室外环境时,处理单元130可得知对应于此室外环境的预设色温应为6500K。举另一例而言,当画面对应的曝光索引值是对应于室内环境时,处理单元130可得知对应于此室内环境的预设色温应为4500K。举再一例而言,当画面对应的曝光索引值是对应于低光源环境时,处理单元130可得知对应于此低光源环境的预设色温应为3000K。When the exposure index value is known, the processing unit 130 can deduce which environment the scene in the frame corresponds to, and then find out the preset color temperature corresponding to the scene in the frame. For example, when the exposure index value corresponding to the frame corresponds to the outdoor environment, the processing unit 130 may know that the preset color temperature corresponding to the outdoor environment should be 6500K. For another example, when the exposure index value corresponding to the frame corresponds to the indoor environment, the processing unit 130 may know that the preset color temperature corresponding to the indoor environment should be 4500K. For another example, when the exposure index value corresponding to the frame corresponds to a low light source environment, the processing unit 130 may know that the preset color temperature corresponding to the low light source environment should be 3000K.
此外,在本实施例中,各像素具有第一颜色比例以及第二颜色比例。详细而言,如同先实施例中所教示的,画面中包括的各个像素亦包括第一成分(即,红色成分(R))、第二成分(即,绿色成分(G))以及第三成分(即,蓝色成分(B))。第一颜色比例为各像素的第一成分与各像素的第二成分之间的比例。换言之,各像素的第一颜色比例例如是各像素的R/G值。第二颜色比例为各像素的第三成分与各像素的第二成分之间的比例。换言之,各像素的第二颜色比例例如是各像素的B/G值。In addition, in this embodiment, each pixel has a first color ratio and a second color ratio. In detail, as taught in the previous embodiments, each pixel included in the screen also includes a first component (ie, a red component (R)), a second component (ie, a green component (G)) and a third component (ie, blue component (B)). The first color ratio is the ratio between the first component of each pixel and the second component of each pixel. In other words, the first color ratio of each pixel is, for example, the R/G value of each pixel. The second color ratio is the ratio between the third component of each pixel and the second component of each pixel. In other words, the second color ratio of each pixel is, for example, the B/G value of each pixel.
在步骤S240中,当曝光索引值对应于预设色温时,处理单元130可从所述多个像素中取出多个特定像素。接着,在步骤S250中,处理单元130可依据所述多个特定像素计算画面的多个白平衡补偿值。In step S240, when the exposure index value corresponds to the preset color temperature, the processing unit 130 may extract a plurality of specific pixels from the plurality of pixels. Next, in step S250, the processing unit 130 may calculate a plurality of white balance compensation values of the frame according to the plurality of specific pixels.
在本实施例中,各特定像素的该第一颜色比例小于第一特定颜色比例,且各特定像素的第二颜色比例大于第二特定颜色比例。举例而言,当曝光索引值对应于6500K的预设色温时,处理单元130可从画面中取出R/G值小于1.85,且B/G值大于0.01的像素。接着,处理单元130可接续依据这些被取出的像素(即,特定像素)计算画面的白平衡补偿值。在一实施例中,处理单元130可基于灰世界演算法来计算画面的白平衡补偿值,但本发明的可实施方式不限于此。In this embodiment, the first color ratio of each specific pixel is smaller than the first specific color ratio, and the second color ratio of each specific pixel is larger than the second specific color ratio. For example, when the exposure index value corresponds to the preset color temperature of 6500K, the processing unit 130 may extract pixels with an R/G value less than 1.85 and a B/G value greater than 0.01 from the frame. Then, the processing unit 130 may continue to calculate the white balance compensation value of the frame according to the extracted pixels (ie, specific pixels). In one embodiment, the processing unit 130 may calculate the white balance compensation value of the frame based on the gray world algorithm, but the embodiments of the present invention are not limited thereto.
从另一角度而言,处理单元130在计算画面的白平衡补偿值时,将不会考虑R/G值大于1.85,且B/G值小于0.01的像素,因这些像素很可能为接近红色的物件。如此一来,处理单元130所计算的白平衡补偿值即不会让补偿后的画面出现偏蓝的情形。From another point of view, when the processing unit 130 calculates the white balance compensation value of the picture, it will not consider the pixels with R/G value greater than 1.85 and B/G value less than 0.01, because these pixels are likely to be close to red object. In this way, the white balance compensation value calculated by the processing unit 130 will not cause the compensated picture to appear bluish.
在一实施例中,在预设色温为6500K的情况下,所述多个白平衡补偿值(即,RGB补偿值)例如是(2.8,1,1.05),但本发明的可实施方式不限于此。在其他实施例中,所述多个白平衡补偿值可视为包括第一补偿值以及第二补偿值,其分别可对应至RGB补偿值中的R值及B值,但本发明的可实施方式不限于此。In one embodiment, when the preset color temperature is 6500K, the multiple white balance compensation values (that is, RGB compensation values) are, for example, (2.8, 1, 1.05), but the embodiments of the present invention are not limited to this. In other embodiments, the plurality of white balance compensation values may be considered to include a first compensation value and a second compensation value, which may respectively correspond to the R value and the B value in the RGB compensation values, but the implementation of the present invention The method is not limited to this.
在步骤S260中,处理单元130可取得画面的画面色温。接着,在步骤S270中,当画面色温对应于预设色温时,处理单元130可依据第一参考颜色比例以及第二参考颜色比例更新所述多个白平衡补偿值。In step S260, the processing unit 130 can obtain the picture color temperature of the picture. Next, in step S270, when the image color temperature corresponds to the preset color temperature, the processing unit 130 may update the plurality of white balance compensation values according to the first reference color ratio and the second reference color ratio.
在一实施例中,当画面色温与预设色温之间的温度差小于一预设门限值(例如750K)时,处理单元130可判定画面色温对应于预设色温。举例而言,当画面色温为6000K时,处理单元130可判定画面色温对应于6500K。举另一例而言,当画面色温为5000K,时,处理单元可判定画面色温对应于4500K,但本发明的可实施方式不限于此。In one embodiment, when the temperature difference between the picture color temperature and the preset color temperature is smaller than a preset threshold (for example, 750K), the processing unit 130 may determine that the picture color temperature corresponds to the preset color temperature. For example, when the picture color temperature is 6000K, the processing unit 130 may determine that the picture color temperature corresponds to 6500K. For another example, when the color temperature of the picture is 5000K, the processing unit may determine that the color temperature of the picture corresponds to 4500K, but embodiments of the present invention are not limited thereto.
当画面色温对应于6500K的预设色温时,处理单元130更新所述多个白平衡补偿值的方式例如是将前述的RGB补偿值中的R值(即,第一补偿值)及B值(即,第二补偿值)分别乘上第一参考颜色比例以及第二参考颜色比例。亦即,若RGB补偿值是(2.8,1,1.05),则更新后的RGB补偿值(即,白平衡补偿值)例如是(2.24,1,1.47),也就是(2.8×0.8,1,1.05×1.4)。When the picture color temperature corresponds to the preset color temperature of 6500K, the processing unit 130 updates the plurality of white balance compensation values, for example, by adding the R value (that is, the first compensation value) and the B value ( That is, the second compensation value) is multiplied by the first reference color ratio and the second reference color ratio. That is, if the RGB compensation value is (2.8,1,1.05), the updated RGB compensation value (that is, the white balance compensation value) is, for example, (2.24,1,1.47), that is, (2.8×0.8,1, 1.05×1.4).
接着,在步骤S280中,处理单元130可依据更新后的所述多个白平衡补偿值对各像素进行白平衡操作,以产生补偿后的画面。具体而言,处理单元130可将更新后的第一补偿值(例如是2.24)乘上各像素的第一颜色比例(即,R/G值),以及将更新后的第二补偿值(例如是1.47)乘上各像素的第二颜色比例(即,B/G值)。Next, in step S280 , the processing unit 130 may perform a white balance operation on each pixel according to the updated white balance compensation values to generate a compensated image. Specifically, the processing unit 130 may multiply the updated first compensation value (eg, 2.24) by the first color ratio (ie, R/G value) of each pixel, and multiply the updated second compensation value (eg, is 1.47) multiplied by the second color scale (ie, B/G value) of each pixel.
如同先前实施例中所教示的,由于处理单元130在计算画面的白平衡补偿值时已排除接近红色的像素,使得补偿后的画面可避免出现偏蓝的情形。As taught in the previous embodiments, since the processing unit 130 has excluded pixels close to red when calculating the white balance compensation value of the frame, the compensated frame can avoid bluishness.
应注意的是,虽然前述实施例中皆假设预设颜色为红色,因而使得处理单元130可避免红色的像素对补偿后的画面产生不良的影响,但本领域具通常知识者应可依据前述实施例中的教示而推得预设颜色为蓝色(或绿色及其他颜色)时的对应做法。如此一来,处理单元130即可避免画面中蓝色的像素对补偿后的画面产生不良的影响(例如使补偿后的画面出现偏红的情形)。It should be noted that although in the foregoing embodiments it is assumed that the preset color is red, thereby enabling the processing unit 130 to prevent red pixels from having adverse effects on the compensated picture, those skilled in the art should be able to use the foregoing implementation The corresponding practice when the default color is blue (or green and other colors) is deduced from the teaching in the example. In this way, the processing unit 130 can prevent the blue pixels in the frame from adversely affecting the compensated frame (for example, causing the compensated frame to appear reddish).
具体而言,处理单元130可取得多种预设颜色在多种预设色温下个别对应的第一特定颜色比例以及第二特定颜色比例。举例而言,处理单元130可取得红色在6500K、4500K以及3000K的预设色温下个别对应的R/G值以及B/G值。并且,处理单元130亦可取得绿色在6500K、4500K以及3000K的预设色温下个别对应的R/G值以及B/G值。此外,处理单元130可取得蓝色在6500K、4500K以及3000K的预设色温下个别对应的R/G值以及B/G值。在取得上述各个R/G值以及B/G值之后,处理单元130即可据以找出取像单元110所获取画面中接近纯色的像素,进而在计算所述画面的白平衡补偿值时排除此像素,以避免此像素对补偿后的画面造成负面的影响。Specifically, the processing unit 130 can obtain the first specific color ratio and the second specific color ratio respectively corresponding to a plurality of preset colors at a plurality of preset color temperatures. For example, the processing unit 130 can obtain R/G values and B/G values respectively corresponding to red at preset color temperatures of 6500K, 4500K and 3000K. Moreover, the processing unit 130 can also obtain R/G values and B/G values respectively corresponding to green under preset color temperatures of 6500K, 4500K and 3000K. In addition, the processing unit 130 can obtain R/G values and B/G values respectively corresponding to blue at preset color temperatures of 6500K, 4500K and 3000K. After obtaining the above-mentioned R/G values and B/G values, the processing unit 130 can use them to find pixels close to pure colors in the picture captured by the imaging unit 110, and then exclude them when calculating the white balance compensation value of the picture. This pixel, in order to avoid the negative impact of this pixel on the compensated image.
综上所述,在取得预设颜色在预设色温下的第一特定颜色比例及第二特定颜色比例之后,本发明提出的白平衡补偿方法及电子装置可在计算所获取画面的白平衡补偿值时排除接近纯色的像素,进而避免这些像素对补偿后的画面造成负面的影响。具体而言,在排除接近纯色的像素之后,电子装置即可较正确地判断所获取画面的场景色温,进而产生较适当的白平衡补偿值。如此一来,即使原始图像中包括大量的纯色像素或接近纯色的像素,电子装置仍可依据正确的场景色温产生较接近真实场景的补偿后画面,而不会让补偿后的画面出现偏红或是偏蓝等失真的情形。To sum up, after obtaining the first specific color ratio and the second specific color ratio of the preset color at the preset color temperature, the white balance compensation method and the electronic device proposed by the present invention can calculate the white balance compensation of the obtained picture. Pixels that are close to pure color are excluded from the value, so as to prevent these pixels from negatively affecting the compensated picture. Specifically, after excluding pixels close to the pure color, the electronic device can more accurately determine the scene color temperature of the acquired picture, and then generate a more appropriate white balance compensation value. In this way, even if the original image includes a large number of pure color pixels or pixels close to pure color, the electronic device can still generate a compensated image closer to the real scene according to the correct scene color temperature, without making the compensated image appear reddish or It is a case of distortion such as bluishness.
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present invention, rather than limiting them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: It is still possible to modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the technical solutions of the various embodiments of the present invention. scope.
Claims (8)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410066432.2A CN104869379B (en) | 2014-02-26 | 2014-02-26 | White balance compensation method and electronic device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410066432.2A CN104869379B (en) | 2014-02-26 | 2014-02-26 | White balance compensation method and electronic device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104869379A CN104869379A (en) | 2015-08-26 |
CN104869379B true CN104869379B (en) | 2017-04-12 |
Family
ID=53914847
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410066432.2A Active CN104869379B (en) | 2014-02-26 | 2014-02-26 | White balance compensation method and electronic device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104869379B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108182667B (en) * | 2017-12-29 | 2020-07-17 | 珠海大横琴科技发展有限公司 | Image optimization method, terminal and computer readable storage medium |
CN110121064B (en) | 2019-05-15 | 2021-07-30 | 深圳市道通智能航空技术股份有限公司 | A kind of image color adjustment method, device and unmanned aerial vehicle |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2003299117A (en) * | 2002-03-15 | 2003-10-17 | Eastman Kodak Co | Method of automatically correcting white balance of digital image |
TW200829038A (en) * | 2006-10-26 | 2008-07-01 | Qualcomm Inc | Automatic white balance statistics collection |
CN102209246A (en) * | 2011-05-23 | 2011-10-05 | 北京工业大学 | Real-time video white balance processing system |
CN102300100A (en) * | 2010-06-28 | 2011-12-28 | 比亚迪股份有限公司 | White balance control device and method |
-
2014
- 2014-02-26 CN CN201410066432.2A patent/CN104869379B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2003299117A (en) * | 2002-03-15 | 2003-10-17 | Eastman Kodak Co | Method of automatically correcting white balance of digital image |
TW200829038A (en) * | 2006-10-26 | 2008-07-01 | Qualcomm Inc | Automatic white balance statistics collection |
CN102300100A (en) * | 2010-06-28 | 2011-12-28 | 比亚迪股份有限公司 | White balance control device and method |
CN102209246A (en) * | 2011-05-23 | 2011-10-05 | 北京工业大学 | Real-time video white balance processing system |
Also Published As
Publication number | Publication date |
---|---|
CN104869379A (en) | 2015-08-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9288392B2 (en) | Image capturing device capable of blending images and image processing method for blending images thereof | |
CN103973958B (en) | Image processing method and equipment | |
TWI433533B (en) | Image capturing device and image synthesis method thereof | |
CN104796683B (en) | A kind of method and system of calibration image color | |
JP5980294B2 (en) | Data processing apparatus, imaging apparatus, and data processing method | |
US9100589B1 (en) | Interleaved capture for high dynamic range image acquisition and synthesis | |
CN108174172B (en) | Photographing method and apparatus, computer-readable storage medium, and computer device | |
CN104883504B (en) | Open the method and device of high dynamic range HDR functions on intelligent terminal | |
TWI523542B (en) | White balance compensation method and electronic device thereof | |
US20170064179A1 (en) | Method and Apparatus for Auto Exposure Value Detection for High Dynamic Range Imaging | |
JP6513234B2 (en) | Image processing method and apparatus used for LED display | |
CN106210501A (en) | Image synthesizing method and image processing apparatus | |
CN108616700B (en) | Image processing method and device, electronic equipment and computer readable storage medium | |
WO2020034702A1 (en) | Control method, device, electronic equipment and computer readable storage medium | |
CN106713790A (en) | Control method, control device and electronic device | |
CN108174173B (en) | Photographing method and apparatus, computer-readable storage medium, and computer device | |
CN105306913A (en) | Image acquisition device and image compensation method thereof | |
WO2023089510A1 (en) | Method and apparatus for image processing, electronic device, storage medium, program and product | |
CN104869379B (en) | White balance compensation method and electronic device | |
CN106817575A (en) | Image capture equipment and method for generating depth information and method for automatically correcting image capture equipment | |
CN111656759A (en) | Image color correction method and device and storage medium | |
TWI524279B (en) | Image capturing device and vignetting compensation method thereof | |
CN113271450B (en) | White balance adjustment method, image processing device and image processing system | |
CN104301638B (en) | Bad pixel processing method and image processing device | |
TWI723729B (en) | White balance adjustment method, image processing device and image processing system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
EXSB | Decision made by sipo to initiate substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |