[go: up one dir, main page]

CN105915875B - White balance calibration method and apparatus and its calibration parameter preparation method and device - Google Patents

White balance calibration method and apparatus and its calibration parameter preparation method and device Download PDF

Info

Publication number
CN105915875B
CN105915875B CN201610389007.6A CN201610389007A CN105915875B CN 105915875 B CN105915875 B CN 105915875B CN 201610389007 A CN201610389007 A CN 201610389007A CN 105915875 B CN105915875 B CN 105915875B
Authority
CN
China
Prior art keywords
ratio
white balance
eyeball area
balance calibration
gray
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
Application number
CN201610389007.6A
Other languages
Chinese (zh)
Other versions
CN105915875A (en
Inventor
雷辉
林英漂
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201610389007.6A priority Critical patent/CN105915875B/en
Publication of CN105915875A publication Critical patent/CN105915875A/en
Application granted granted Critical
Publication of CN105915875B publication Critical patent/CN105915875B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/80Camera processing pipelines; Components thereof
    • H04N23/84Camera processing pipelines; Components thereof for processing colour signals
    • H04N23/88Camera processing pipelines; Components thereof for processing colour signals for colour balance, e.g. white-balance circuits or colour temperature control

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Color Image Communication Systems (AREA)
  • Color Television Image Signal Generators (AREA)
  • Processing Of Color Television Signals (AREA)

Abstract

本发明涉及一种白平衡校准方法和装置及其校准参数获得方法和装置。该白平衡校准参数获得方法包括步骤:获取待校准图像中的眼球区域;根据眼球区域获得眼球区域的RGB比值;根据RGB比值确定眼球区域是否为灰色;若是,将RGB比值确定为白平衡校准参数。该白平衡校准参数获得装置包括:眼球区域获取模块,用于获取待校准图像中的眼球区域;RGB比值获得模块,用于根据眼球区域获得眼球区域的RGB比值;灰色检测模块,用于根据RGB比值确定眼球区域是否为灰色;白平衡校准参数确定模块,用于在眼球区域为灰色时,将RGB比值确定为白平衡校准参数。本发明能够准确还原白平衡,不受环境光和背景的影响。

The invention relates to a white balance calibration method and device and a calibration parameter acquisition method and device thereof. The method for obtaining white balance calibration parameters includes the steps of: obtaining the eyeball area in the image to be calibrated; obtaining the RGB ratio of the eyeball area according to the eyeball area; determining whether the eyeball area is gray according to the RGB ratio; if so, determining the RGB ratio as a white balance calibration parameter . The white balance calibration parameter acquisition device includes: an eyeball area acquisition module, used to acquire the eyeball area in the image to be calibrated; an RGB ratio acquisition module, used to obtain the RGB ratio of the eyeball area according to the eyeball area; a gray detection module, used to obtain the RGB ratio of the eyeball area according to the RGB The ratio determines whether the eyeball area is gray; the white balance calibration parameter determination module is used to determine the RGB ratio as the white balance calibration parameter when the eyeball area is gray. The invention can accurately restore the white balance without being affected by ambient light and background.

Description

白平衡校准方法和装置及其校准参数获得方法和装置Method and device for white balance calibration and method and device for obtaining calibration parameters

技术领域technical field

本发明涉及白平衡技术领域,特别是涉及一种白平衡校准参数获得方法、白平衡校准参数获得装置、白平衡校准方法以及白平衡校准装置。The present invention relates to the technical field of white balance, in particular to a white balance calibration parameter acquisition method, a white balance calibration parameter acquisition device, a white balance calibration method and a white balance calibration device.

背景技术Background technique

白平衡是电视摄像领域一个非常重要的概念,通过它可以解决色彩还原和色调处理的一系列问题。白平衡最基本的原则就是将白色的东西还原成白色。然而,sensor(传感器)输出图像后,ISP(Image Signal Processor,图像信号处理)并不知道哪块区域本身是白色的,只能统计整幅图像的R/G(红/绿),B/G(蓝/绿),然后通过算法去估计哪些是需要还原成R:G:B=1:1:1。这样一旦出现混光场景或者色彩单一的物体的时候,白平衡就会出现还原不准确等缺陷。White balance is a very important concept in the field of TV photography, through which a series of problems of color reproduction and tone processing can be solved. The most basic principle of white balance is to restore white things to white. However, after the sensor (sensor) outputs the image, the ISP (Image Signal Processor, image signal processing) does not know which area itself is white, and can only count the R/G (red/green), B/G of the entire image (blue/green), and then use an algorithm to estimate which ones need to be restored to R:G:B=1:1:1. In this way, once there is a mixed light scene or an object with a single color, the white balance will have defects such as inaccurate restoration.

发明内容Contents of the invention

基于此,有必要针对上述问题,提供一种白平衡校准方法和装置及其校准参数获得方法和装置,能够不受环境光和背景的影响,准确还原白平衡。Based on this, it is necessary to provide a white balance calibration method and device and a method and device for obtaining calibration parameters thereof, which can accurately restore white balance without being affected by ambient light and background.

为了达到上述目的,本发明采取的技术方案如下:In order to achieve the above object, the technical scheme that the present invention takes is as follows:

一种白平衡校准参数获得方法,包括步骤:A method for obtaining white balance calibration parameters, comprising the steps of:

获取待校准图像中的眼球区域;Obtain the eyeball area in the image to be calibrated;

根据所述眼球区域获得所述眼球区域的RGB比值;Obtaining the RGB ratio of the eyeball area according to the eyeball area;

根据所述RGB比值确定所述眼球区域是否为灰色;Determine whether the eyeball area is gray according to the RGB ratio;

若是,将所述RGB比值确定为白平衡校准参数。If yes, determine the RGB ratio as a white balance calibration parameter.

一种白平衡校准参数获得装置,包括:A device for obtaining white balance calibration parameters, comprising:

眼球区域获取模块,用于获取待校准图像中的眼球区域;The eyeball area acquisition module is used to acquire the eyeball area in the image to be calibrated;

RGB比值获得模块,用于根据所述眼球区域获得所述眼球区域的RGB比值;an RGB ratio obtaining module, configured to obtain the RGB ratio of the eyeball area according to the eyeball area;

灰色检测模块,用于根据所述RGB比值确定所述眼球区域是否为灰色;A gray detection module, configured to determine whether the eyeball area is gray according to the RGB ratio;

白平衡校准参数确定模块,用于在所述眼球区域为灰色时,将所述RGB比值确定为白平衡校准参数。The white balance calibration parameter determination module is configured to determine the RGB ratio as a white balance calibration parameter when the eyeball area is gray.

本发明白平衡校准参数获得方法和装置,利用亚洲人的眼球区域一般是灰色的原理,在眼球区域为灰色时,将眼球区域的RGB比值确定为白平衡校准参数,这样无论背景环境和光线环境如何改变,利用该白平衡校准参数都能准确还原白平衡。The method and device for obtaining white balance calibration parameters of the present invention utilizes the principle that the eyeball area of Asians is generally gray, and when the eyeball area is gray, the RGB ratio of the eyeball area is determined as the white balance calibration parameter, so that regardless of the background environment and light environment No matter how it is changed, the white balance can be accurately restored by using the white balance calibration parameters.

一种白平衡校准方法,包括步骤:A white balance calibration method, comprising steps:

获取待校准图像中的眼球区域;Obtain the eyeball area in the image to be calibrated;

根据所述眼球区域获得所述眼球区域的RGB比值;Obtaining the RGB ratio of the eyeball area according to the eyeball area;

根据所述RGB比值确定所述眼球区域是否为灰色;Determine whether the eyeball area is gray according to the RGB ratio;

若是,将所述RGB比值确定为白平衡校准参数;If so, determining the RGB ratio as a white balance calibration parameter;

根据所述白平衡校准参数对所述待校准图像进行白平衡校准。Perform white balance calibration on the image to be calibrated according to the white balance calibration parameters.

一种白平衡校准装置,包括:A white balance calibration device, comprising:

眼球区域获取模块,用于获取待校准图像中的眼球区域;The eyeball area acquisition module is used to acquire the eyeball area in the image to be calibrated;

RGB比值获得模块,用于根据所述眼球区域获得所述眼球区域的RGB比值;an RGB ratio obtaining module, configured to obtain the RGB ratio of the eyeball area according to the eyeball area;

灰色检测模块,用于根据所述RGB比值确定所述眼球区域是否为灰色;A gray detection module, configured to determine whether the eyeball area is gray according to the RGB ratio;

白平衡校准参数确定模块,用于在所述眼球区域为灰色时,将所述RGB比值确定为白平衡校准参数;A white balance calibration parameter determination module, configured to determine the RGB ratio as a white balance calibration parameter when the eyeball area is gray;

白平衡校准模块,用于根据所述白平衡校准参数对所述待校准图像进行白平衡校准。A white balance calibration module, configured to perform white balance calibration on the image to be calibrated according to the white balance calibration parameters.

本发明白平衡校准方法和装置,利用亚洲人的眼球区域一般是灰色的原理,在眼球区域为灰色时,将眼球区域的RGB比值确定为白平衡校准参数,然后根据白平衡校准参数进行白平衡校准,这样无论背景环境和光线环境如何改变,都能准确还原白平衡。The white balance calibration method and device of the present invention utilize the principle that the eyeball area of Asians is generally gray. When the eyeball area is gray, the RGB ratio of the eyeball area is determined as the white balance calibration parameter, and then the white balance is performed according to the white balance calibration parameter. Calibration so that the white balance can be accurately restored regardless of changes in the background environment and lighting environment.

附图说明Description of drawings

图1为本发明白平衡校准参数获得方法实施例的流程示意图;FIG. 1 is a schematic flowchart of an embodiment of a method for obtaining white balance calibration parameters of the present invention;

图2为本发明白平衡校准参数获得装置实施例的结构示意图;Fig. 2 is a schematic structural diagram of an embodiment of a device for obtaining white balance calibration parameters of the present invention;

图3为本发明白平衡校准方法实施例的流程示意图;3 is a schematic flowchart of an embodiment of a white balance calibration method of the present invention;

图4为本发明白平衡校准装置实施例的结构示意图;4 is a schematic structural diagram of an embodiment of the white balance calibration device of the present invention;

图5为本发明白平衡校准模块实施例的结构示意图。FIG. 5 is a schematic structural diagram of an embodiment of a white balance calibration module of the present invention.

具体实施方式detailed description

为更进一步阐述本发明所采取的技术手段及取得的效果,下面结合附图及较佳实施例,对本发明的技术方案,进行清楚和完整的描述。In order to further illustrate the technical means adopted by the present invention and the achieved effects, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings and preferred embodiments.

首先对白平衡校准参数获得方法和装置的具体实施方式做详细介绍。Firstly, the specific implementation of the method and device for obtaining white balance calibration parameters will be introduced in detail.

如图1所示,一种白平衡校准参数获得方法,包括步骤:As shown in Figure 1, a method for obtaining white balance calibration parameters includes steps:

S110、获取待校准图像中的眼球区域;S110. Obtain the eyeball area in the image to be calibrated;

S120、根据所述眼球区域获得所述眼球区域的RGB比值;S120. Obtain the RGB ratio of the eyeball area according to the eyeball area;

S130、根据所述RGB比值确定所述眼球区域是否为灰色;S130. Determine whether the eyeball area is gray according to the RGB ratio;

S140、若是,将所述RGB比值确定为白平衡校准参数。S140. If yes, determine the RGB ratio as a white balance calibration parameter.

本发明方法可以根据相应的程序实现,程序运行在具有拍照功能的移动终端中,例如手机、智能平板和数码相机等。下面对各个步骤的实施过程进行详细介绍。The method of the present invention can be realized according to a corresponding program, and the program runs in a mobile terminal with a camera function, such as a mobile phone, a smart tablet, a digital camera, and the like. The implementation process of each step is introduced in detail below.

在步骤S110和步骤S120中,打开相机,获取相机取景画面中图像的眼球区域,其中识别眼球区域可以根据现有技术中已有的方式实现。获取到眼球区域后,计算眼球区域的RGB比值。In step S110 and step S120, the camera is turned on, and the eyeball area of the image in the viewfinder screen of the camera is acquired, wherein the identification of the eyeball area can be implemented according to existing methods in the prior art. After obtaining the eyeball area, calculate the RGB ratio of the eyeball area.

在步骤S130和步骤S140中,灰色就是没有色彩,RGB色彩分量全部相等,白平衡校准就是以中性灰作为参考。In step S130 and step S140, gray means no color, RGB color components are all equal, and white balance calibration uses neutral gray as a reference.

根据RGB比值确定眼球区域是否为灰色的方式有多种,例如,在一个实施例中,所述RGB比值包括R和G的第一比值(R/G)和B和G的第二比值(B/G);There are many ways to determine whether the eyeball area is gray according to the RGB ratio. For example, in one embodiment, the RGB ratio includes a first ratio (R/G) of R and G and a second ratio of B and G (B /G);

根据所述RGB比值确定所述眼球区域是否为灰色的步骤可以包括:The step of determining whether the eyeball area is gray according to the RGB ratio may include:

若所述第一比值小于第一阈值,且所述第二比值小于第二阈值,则确定所述眼球区域为灰色;If the first ratio is less than a first threshold and the second ratio is less than a second threshold, then determining that the eyeball area is gray;

若所述第一比值大于等于第一阈值,或者所述第二比值大于等于第二阈值,则确定所述眼球区域不为灰色。If the first ratio is greater than or equal to a first threshold, or the second ratio is greater than or equal to a second threshold, it is determined that the eyeball area is not gray.

第一阈值和第二阈值可以根据实际需要进行设定,两者可以为不同的数值,也可以为相同的数值。如果R/G或B/G超过相应的阀值,则表明眼球区域不是灰色,则有可能是外国人的蓝色眼球,也有可能是带有色眼镜或者反光眼镜的原因,该眼球区域的RGB比值不适宜作为白平衡校准参数。如果R/G和B/G均在相应的阀值范围内,则表明眼球区域为灰色,即该眼球是黑白眼球,则可用来做白平衡还原的依据,即该眼球区域的RGB比值可以作为白平衡校准参数。The first threshold and the second threshold can be set according to actual needs, and they can be different values or the same value. If the R/G or B/G exceeds the corresponding threshold, it indicates that the eyeball area is not gray, and it may be the blue eyeball of a foreigner, or it may be the reason for colored glasses or reflective glasses. The RGB ratio of the eyeball area Not suitable as a white balance calibration parameter. If both R/G and B/G are within the corresponding threshold range, it indicates that the eyeball area is gray, that is, the eyeball is a black and white eyeball, and it can be used as the basis for white balance restoration, that is, the RGB ratio of the eyeball area can be used as White balance calibration parameters.

需要说明的是,用户还可以根据需要设定其它比值及其对应的判断条件,例如设置G/B和R/B对应的阈值的等,本发明并不对此做出限定。It should be noted that the user can also set other ratios and corresponding judgment conditions according to needs, such as setting thresholds corresponding to G/B and R/B, which is not limited in the present invention.

得到白平衡校准参数后,就可以采用现有技术中已有的白平衡校准方法进行白平衡校准,由于本发明以眼球区域为灰色的RGB比值作为白平衡校准参数,不受环境光和背景的影响,所以即使出现混光场景或者色彩单一的物体,也可以对图像进行正确的白平衡还原。After the white balance calibration parameters are obtained, the existing white balance calibration methods in the prior art can be used to perform white balance calibration. Since the present invention uses the RGB ratio of the eyeball area as gray as the white balance calibration parameters, it is not affected by ambient light and background. Therefore, even if there is a scene with mixed light or an object with a single color, the correct white balance can be restored to the image.

基于同一发明构思,本发明还提供一种白平衡校准参数获得装置,下面结合附图对本发明装置的具体实施方式做详细描述。Based on the same inventive concept, the present invention also provides a device for obtaining white balance calibration parameters. The specific implementation of the device of the present invention will be described in detail below with reference to the accompanying drawings.

如图2所示,一种白平衡校准参数获得装置,包括:As shown in Figure 2, a device for obtaining white balance calibration parameters includes:

眼球区域获取模块110,用于获取待校准图像中的眼球区域;The eyeball area acquisition module 110 is used to acquire the eyeball area in the image to be calibrated;

RGB比值获得模块120,用于根据所述眼球区域获得所述眼球区域的RGB比值;RGB ratio obtaining module 120, for obtaining the RGB ratio of the eyeball area according to the eyeball area;

灰色检测模块130,用于根据所述RGB比值确定所述眼球区域是否为灰色;A gray detection module 130, configured to determine whether the eyeball area is gray according to the RGB ratio;

白平衡校准参数确定模块140,用于在所述眼球区域为灰色时,将所述RGB比值确定为白平衡校准参数。The white balance calibration parameter determination module 140 is configured to determine the RGB ratio as a white balance calibration parameter when the eyeball area is gray.

本发明装置可以根据相应的芯片实现,芯片安装在具有拍照功能的移动终端中,例如手机、智能平板和数码相机等。下面对各个模块的实施过程进行详细介绍。The device of the present invention can be implemented according to a corresponding chip, and the chip is installed in a mobile terminal with a camera function, such as a mobile phone, a smart tablet, a digital camera, and the like. The implementation process of each module is introduced in detail below.

打开相机,眼球区域获取模块110获取相机取景画面中图像的眼球区域,其中识别眼球区域可以根据现有技术中已有的方式实现。获取到眼球区域后,RGB比值获得模块120计算眼球区域的RGB比值。The camera is turned on, and the eyeball area acquisition module 110 acquires the eyeball area of the image in the viewfinder screen of the camera, wherein the identification of the eyeball area can be implemented according to existing methods in the prior art. After the eyeball area is obtained, the RGB ratio obtaining module 120 calculates the RGB ratio of the eyeball area.

灰色检测模块130根据RGB比值确定眼球区域是否为灰色方式有多种,例如,在一个实施例中,所述RGB比值包括R和G的第一比值(R/G)和B和G的第二比值(B/G),所述灰色检测模块130在所述第一比值小于第一阈值,且所述第二比值小于第二阈值时,确定所述眼球区域为灰色;在所述第一比值大于等于第一阈值,或者所述第二比值大于等于第二阈值时,确定所述眼球区域不为灰色。There are many ways for the gray detection module 130 to determine whether the eyeball area is gray according to the RGB ratio. For example, in one embodiment, the RGB ratio includes a first ratio (R/G) of R and G and a second ratio of B and G. Ratio (B/G), the gray detection module 130 determines that the eyeball area is gray when the first ratio is less than the first threshold and the second ratio is less than the second threshold; When it is greater than or equal to the first threshold, or the second ratio is greater than or equal to the second threshold, it is determined that the eyeball area is not gray.

第一阈值和第二阈值可以根据实际需要进行设定,两者可以为不同的数值,也可以为相同的数值。如果R/G或B/G超过相应的阀值,则表明眼球区域不是灰色,该眼球区域的RGB比值不适宜作为白平衡校准参数。如果R/G和B/G均在相应的阀值范围内,则表明眼球区域为灰色,即该眼球是黑白眼球,可用来做白平衡还原的依据,白平衡校准参数确定模块140则将该眼球区域的RGB比值作为白平衡校准参数。The first threshold and the second threshold can be set according to actual needs, and they can be different values or the same value. If R/G or B/G exceeds the corresponding threshold, it indicates that the eyeball area is not gray, and the RGB ratio of the eyeball area is not suitable as a white balance calibration parameter. If both R/G and B/G are within the corresponding threshold range, it indicates that the eyeball area is gray, that is, the eyeball is a black and white eyeball, which can be used as a basis for white balance restoration, and the white balance calibration parameter determination module 140 will set the The RGB ratio of the eyeball area is used as a white balance calibration parameter.

需要说明的是,用户还可以根据需要设定其它比值及其对应的判断条件,例如设置G/B和R/B对应的阈值的等等,本发明并不对此做出限定。It should be noted that the user can also set other ratios and corresponding judgment conditions as required, such as setting thresholds corresponding to G/B and R/B, etc., which is not limited in the present invention.

得到白平衡校准参数后,就可以采用现有技术中已有的白平衡校准方法进行白平衡校准,由于本发明以眼球区域为灰色的RGB比值作为白平衡校准参数,不受环境光和背景的影响,所以即使出现混光场景或者色彩单一的物体,也可以对图像进行正确的白平衡还原。After the white balance calibration parameters are obtained, the existing white balance calibration methods in the prior art can be used to perform white balance calibration. Since the present invention uses the RGB ratio of the eyeball area as gray as the white balance calibration parameters, it is not affected by ambient light and background. Therefore, even if there is a scene with mixed light or an object with a single color, the correct white balance can be restored to the image.

下面对本发明的白平衡校准方法和装置的具体实施方式做详细介绍。The specific implementation of the white balance calibration method and device of the present invention will be described in detail below.

如图3所示,一种白平衡校准方法,包括步骤:As shown in Figure 3, a white balance calibration method includes steps:

S210、获取待校准图像中的眼球区域;S210. Obtain the eyeball area in the image to be calibrated;

S220、根据所述眼球区域获得所述眼球区域的RGB比值;S220. Obtain the RGB ratio of the eyeball area according to the eyeball area;

S230、根据所述RGB比值确定所述眼球区域是否为灰色;S230. Determine whether the eyeball area is gray according to the RGB ratio;

S240、若是,将所述RGB比值确定为白平衡校准参数;S240. If yes, determine the RGB ratio as a white balance calibration parameter;

S250、根据所述白平衡校准参数对所述待校准图像进行白平衡校准。S250. Perform white balance calibration on the image to be calibrated according to the white balance calibration parameters.

本发明方法可以根据相应的程序实现,程序运行在具有拍照功能的移动终端中,例如手机、智能平板和数码相机等。下面对各个步骤的实施过程进行详细介绍。The method of the present invention can be realized according to a corresponding program, and the program runs in a mobile terminal with a camera function, such as a mobile phone, a smart tablet, a digital camera, and the like. The implementation process of each step is introduced in detail below.

在步骤S210和步骤S220中,打开相机,获取相机取景画面中图像的眼球区域,其中识别眼球区域可以根据现有技术中已有的方式实现。获取到眼球区域后,计算眼球区域的RGB比值。In step S210 and step S220, the camera is turned on, and the eyeball area of the image in the viewfinder screen of the camera is acquired, wherein the identification of the eyeball area can be implemented according to existing methods in the prior art. After obtaining the eyeball area, calculate the RGB ratio of the eyeball area.

在步骤S230和步骤S240中,根据RGB比值确定眼球区域是否为灰色的方式有多种,例如,在一个实施例中,所述RGB比值包括R和G的第一比值(R/G)和B和G的第二比值(B/G);In step S230 and step S240, there are many ways to determine whether the eyeball area is gray according to the RGB ratio. For example, in one embodiment, the RGB ratio includes the first ratio of R and G (R/G) and B and the second ratio of G (B/G);

根据所述RGB比值确定所述眼球区域是否为灰色的步骤可以包括:The step of determining whether the eyeball area is gray according to the RGB ratio may include:

若所述第一比值小于第一阈值,且所述第二比值小于第二阈值,则确定所述眼球区域为灰色;If the first ratio is less than a first threshold and the second ratio is less than a second threshold, then determining that the eyeball area is gray;

若所述第一比值大于等于第一阈值,或者所述第二比值大于等于第二阈值,则确定所述眼球区域不为灰色。If the first ratio is greater than or equal to a first threshold, or the second ratio is greater than or equal to a second threshold, it is determined that the eyeball area is not gray.

第一阈值和第二阈值可以根据实际需要进行设定,两者可以为不同的数值,也可以为相同的数值。如果R/G或B/G超过相应的阀值,则表明眼球区域不是灰色,则有可能是外国人的蓝色眼球,也有可能是带有色眼镜或者反光眼镜的原因,该眼球区域的RGB比值不适宜作为白平衡校准参数。如果R/G和B/G均在相应的阀值范围内,则表明眼球区域为灰色,即该眼球是黑白眼球,则可用来做白平衡还原的依据,即该眼球区域的RGB比值可以作为白平衡校准参数。The first threshold and the second threshold can be set according to actual needs, and they can be different values or the same value. If the R/G or B/G exceeds the corresponding threshold, it indicates that the eyeball area is not gray, and it may be the blue eyeball of a foreigner, or it may be the reason for colored glasses or reflective glasses. The RGB ratio of the eyeball area Not suitable as a white balance calibration parameter. If both R/G and B/G are within the corresponding threshold range, it indicates that the eyeball area is gray, that is, the eyeball is a black and white eyeball, and it can be used as the basis for white balance restoration, that is, the RGB ratio of the eyeball area can be used as White balance calibration parameters.

需要说明的是,用户还可以根据需要设定其它比值及其对应的判断条件,例如设置G/B和R/B对应的阈值的等等,本发明并不对此做出限定。It should be noted that the user can also set other ratios and corresponding judgment conditions as required, such as setting thresholds corresponding to G/B and R/B, etc., which is not limited in the present invention.

在步骤S250中,确定好白平衡校准参数后,就可以进行白平衡校准。在一个实施例中,根据所述白平衡校准参数对所述待校准图像进行白平衡校准的步骤可以包括:In step S250, after the white balance calibration parameters are determined, white balance calibration can be performed. In one embodiment, the step of performing white balance calibration on the image to be calibrated according to the white balance calibration parameters may include:

S2501、根据第一预设系数与所述第一比值的比值,获得第一增益;S2501. Obtain a first gain according to the ratio of the first preset coefficient to the first ratio;

S2502、根据第二预设系数与所述第二比值的比值,获得第二增益;S2502. Obtain a second gain according to the ratio of the second preset coefficient to the second ratio;

S2503、根据所述第一增益和所述第二增益对所述待校准图像进行白平衡校准。S2503. Perform white balance calibration on the image to be calibrated according to the first gain and the second gain.

第一预设系数和第二预设系数是可调整系数,可以根据用户的实际需要进行调节。例如,第一预设系数为K1,第二预设系数为K2,第一比值为R/G,第二比值为B/G,则白平衡RGB的增益就为:K1*G/R,K2*G/B,根据该白平衡增益就可以将整幅图像进行正确的白平衡还原。The first preset coefficient and the second preset coefficient are adjustable coefficients, which can be adjusted according to the actual needs of the user. For example, the first preset coefficient is K1, the second preset coefficient is K2, the first ratio is R/G, and the second ratio is B/G, then the white balance RGB gain is: K1*G/R, K2 *G/B, according to the white balance gain, the entire image can be restored to the correct white balance.

由于本发明以眼球区域为灰色的RGB比值作为白平衡校准参数,根据该白平衡校准参数进行白平衡调节,不受环境光和背景的影响,所以即使出现混光场景或者色彩单一的物体,也可以对图像进行正确的白平衡还原。Because the present invention uses the RGB ratio of the eyeball area as gray as the white balance calibration parameter, the white balance adjustment is performed according to the white balance calibration parameter, and is not affected by ambient light and background, so even if there is a scene with mixed light or an object with a single color, it will The correct white balance can be restored to the image.

基于同一发明构思,本发明还提供一种白平衡校准装置,下面结合附图对本发明装置的具体实施方式做详细描述。Based on the same inventive concept, the present invention also provides a white balance calibration device, and the specific implementation of the device of the present invention will be described in detail below with reference to the accompanying drawings.

如图4所示,一种白平衡校准装置,包括:As shown in Figure 4, a white balance calibration device includes:

眼球区域获取模块210,用于获取待校准图像中的眼球区域;The eyeball area acquisition module 210 is used to acquire the eyeball area in the image to be calibrated;

RGB比值获得模块220,用于根据所述眼球区域获得所述眼球区域的RGB比值;RGB ratio obtaining module 220, for obtaining the RGB ratio of the eyeball area according to the eyeball area;

灰色检测模块230,用于根据所述RGB比值确定所述眼球区域是否为灰色;A gray detection module 230, configured to determine whether the eyeball area is gray according to the RGB ratio;

白平衡校准参数确定模块240,用于在所述眼球区域为灰色时,将所述RGB比值确定为白平衡校准参数;A white balance calibration parameter determination module 240, configured to determine the RGB ratio as a white balance calibration parameter when the eyeball area is gray;

白平衡校准模块250,用于根据所述白平衡校准参数对所述待校准图像进行白平衡校准。The white balance calibration module 250 is configured to perform white balance calibration on the image to be calibrated according to the white balance calibration parameters.

本发明装置可以根据相应的芯片实现,芯片安装在具有拍照功能的移动终端中,例如手机、智能平板和数码相机等。下面对各个模块的实施过程进行详细介绍。The device of the present invention can be implemented according to a corresponding chip, and the chip is installed in a mobile terminal with a camera function, such as a mobile phone, a smart tablet, a digital camera, and the like. The implementation process of each module is introduced in detail below.

打开相机,眼球区域获取模块210获取相机取景画面中图像的眼球区域,其中识别眼球区域可以根据现有技术中已有的方式实现。获取到眼球区域后,RGB比值获得模块220计算眼球区域的RGB比值。The camera is turned on, and the eyeball area acquiring module 210 acquires the eyeball area of the image in the camera viewfinder, wherein the identification of the eyeball area can be implemented according to existing methods in the prior art. After the eyeball area is obtained, the RGB ratio obtaining module 220 calculates the RGB ratio of the eyeball area.

灰色检测模块230根据RGB比值确定眼球区域是否为灰色的方式有多种,例如,在一个实施例中,所述RGB比值包括R和G的第一比值(R/G)和B和G的第二比值(B/G),所述灰色检测模块230在所述第一比值小于第一阈值,且所述第二比值小于第二阈值时,确定所述眼球区域为灰色;在所述第一比值大于等于第一阈值,或者所述第二比值大于等于第二阈值时,确定所述眼球区域不为灰色。There are many ways for the gray detection module 230 to determine whether the eyeball area is gray according to the RGB ratio. For example, in one embodiment, the RGB ratio includes the first ratio (R/G) of R and G and the first ratio of B and G. Two ratios (B/G), the gray detection module 230 determines that the eyeball area is gray when the first ratio is smaller than the first threshold and the second ratio is smaller than the second threshold; When the ratio is greater than or equal to the first threshold, or the second ratio is greater than or equal to the second threshold, it is determined that the eyeball area is not gray.

第一阈值和第二阈值可以根据实际需要进行设定,两者可以为不同的数值,也可以为相同的数值。如果R/G或B/G超过相应的阀值,则表明眼球区域不是灰色,该眼球区域的RGB比值不适宜作为白平衡校准参数。如果R/G和B/G均在相应的阀值范围内,则表明眼球区域为灰色,即该眼球是黑白眼球,可用来做白平衡还原的依据,白平衡校准参数确定模块240则将该眼球区域的RGB比值作为白平衡校准参数。The first threshold and the second threshold can be set according to actual needs, and they can be different values or the same value. If R/G or B/G exceeds the corresponding threshold, it indicates that the eyeball area is not gray, and the RGB ratio of the eyeball area is not suitable as a white balance calibration parameter. If both R/G and B/G are within the corresponding threshold range, it indicates that the eyeball area is gray, that is, the eyeball is a black and white eyeball, which can be used as a basis for white balance restoration, and the white balance calibration parameter determination module 240 will set the The RGB ratio of the eyeball area is used as a white balance calibration parameter.

需要说明的是,用户还可以根据需要设定其它比值及其对应的判断条件,例如设置G/B和R/B对应的阈值的等等,本发明并不对此做出限定。It should be noted that the user can also set other ratios and corresponding judgment conditions as required, such as setting thresholds corresponding to G/B and R/B, etc., which is not limited in the present invention.

确定好白平衡校准参数后,白平衡校准模块250就可以进行白平衡校准。在一个实施例中,如图5所示,所述白平衡校准模块250可以包括:After the white balance calibration parameters are determined, the white balance calibration module 250 can perform white balance calibration. In one embodiment, as shown in FIG. 5, the white balance calibration module 250 may include:

第一增益获得单元2501,用于根据第一预设系数与所述第一比值的比值,获得第一增益;A first gain obtaining unit 2501, configured to obtain a first gain according to the ratio of the first preset coefficient to the first ratio;

第二增益获得单元2502,用于根据第二预设系数与所述第二比值的比值,获得第二增益;A second gain obtaining unit 2502, configured to obtain a second gain according to the ratio of the second preset coefficient to the second ratio;

白平衡校准单元2503,用于根据所述第一增益和所述第二增益对所述待校准图像进行白平衡校准。A white balance calibration unit 2503, configured to perform white balance calibration on the image to be calibrated according to the first gain and the second gain.

其中,第一预设系数和第二预设系数是可调整系数,可以根据用户的实际需要进行调节。Wherein, the first preset coefficient and the second preset coefficient are adjustable coefficients, which can be adjusted according to the actual needs of the user.

由于本发明以眼球区域为灰色的RGB比值作为白平衡校准参数,根据该白平衡校准参数进行白平衡调节,不受环境光和背景的影响,所以即使出现混光场景或者色彩单一的物体,也可以对图像进行正确的白平衡还原。Because the present invention uses the RGB ratio of the eyeball area as gray as the white balance calibration parameter, the white balance adjustment is performed according to the white balance calibration parameter, and is not affected by ambient light and background, so even if there is a scene with mixed light or an object with a single color, it will The correct white balance can be restored to the image.

以上所述实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above-mentioned embodiments can be combined arbitrarily. To make the description concise, all possible combinations of the technical features in the above-mentioned embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, should be considered as within the scope of this specification.

以上所述实施例仅表达了本发明的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干变形和改进,这些都属于本发明的保护范围。因此,本发明专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only express several implementation modes of the present invention, and the descriptions thereof are relatively specific and detailed, but should not be construed as limiting the patent scope of the invention. It should be pointed out that those skilled in the art can make several modifications and improvements without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent for the present invention should be based on the appended claims.

Claims (6)

1.一种白平衡校准参数获得方法,其特征在于,包括步骤:1. A method for obtaining white balance calibration parameters, comprising the steps of: 获取待校准图像中的眼球区域;Obtain the eyeball area in the image to be calibrated; 根据所述眼球区域获得所述眼球区域的RGB比值;Obtaining the RGB ratio of the eyeball area according to the eyeball area; 根据所述RGB比值确定所述眼球区域是否为灰色;Determine whether the eyeball area is gray according to the RGB ratio; 若是,将所述RGB比值确定为白平衡校准参数;If so, determining the RGB ratio as a white balance calibration parameter; 其中,所述RGB比值包括R和G的第一比值和B和G的第二比值;Wherein, the RGB ratio includes a first ratio of R and G and a second ratio of B and G; 根据所述RGB比值确定所述眼球区域是否为灰色的步骤包括:The step of determining whether the eyeball area is gray according to the RGB ratio comprises: 若所述第一比值小于第一阈值,且所述第二比值小于第二阈值,则确定所述眼球区域为灰色;If the first ratio is less than a first threshold and the second ratio is less than a second threshold, then determining that the eyeball area is gray; 若所述第一比值大于等于第一阈值,或者所述第二比值大于等于第二阈值,则确定所述眼球区域不为灰色。If the first ratio is greater than or equal to a first threshold, or the second ratio is greater than or equal to a second threshold, it is determined that the eyeball area is not gray. 2.一种白平衡校准方法,其特征在于,包括步骤:2. A white balance calibration method, characterized in that, comprising steps: 获取待校准图像中的眼球区域;Obtain the eyeball area in the image to be calibrated; 根据所述眼球区域获得所述眼球区域的RGB比值;Obtaining the RGB ratio of the eyeball area according to the eyeball area; 根据所述RGB比值确定所述眼球区域是否为灰色;Determine whether the eyeball area is gray according to the RGB ratio; 若是,将所述RGB比值确定为白平衡校准参数;If so, determining the RGB ratio as a white balance calibration parameter; 根据所述白平衡校准参数对所述待校准图像进行白平衡校准;performing white balance calibration on the image to be calibrated according to the white balance calibration parameters; 其中,所述RGB比值包括R和G的第一比值和B和G的第二比值;Wherein, the RGB ratio includes a first ratio of R and G and a second ratio of B and G; 根据所述RGB比值确定所述眼球区域是否为灰色的步骤包括:The step of determining whether the eyeball area is gray according to the RGB ratio comprises: 若所述第一比值小于第一阈值,且所述第二比值小于第二阈值,则确定所述眼球区域为灰色;If the first ratio is less than a first threshold and the second ratio is less than a second threshold, then determining that the eyeball area is gray; 若所述第一比值大于等于第一阈值,或者所述第二比值大于等于第二阈值,则确定所述眼球区域不为灰色。If the first ratio is greater than or equal to a first threshold, or the second ratio is greater than or equal to a second threshold, it is determined that the eyeball area is not gray. 3.根据权利要求2所述的白平衡校准方法,其特征在于,根据所述白平衡校准参数对所述待校准图像进行白平衡校准的步骤包括:3. The white balance calibration method according to claim 2, wherein the step of performing white balance calibration on the image to be calibrated according to the white balance calibration parameters comprises: 根据第一预设系数与所述第一比值的比值,获得第一增益;obtaining a first gain according to a ratio of a first preset coefficient to the first ratio; 根据第二预设系数与所述第二比值的比值,获得第二增益;obtaining a second gain according to a ratio of a second preset coefficient to the second ratio; 根据所述第一增益和所述第二增益对所述待校准图像进行白平衡校准。Perform white balance calibration on the image to be calibrated according to the first gain and the second gain. 4.一种白平衡校准参数获得装置,其特征在于,包括:4. A device for obtaining white balance calibration parameters, comprising: 眼球区域获取模块,用于获取待校准图像中的眼球区域;The eyeball area acquisition module is used to acquire the eyeball area in the image to be calibrated; RGB比值获得模块,用于根据所述眼球区域获得所述眼球区域的RGB比值;an RGB ratio obtaining module, configured to obtain the RGB ratio of the eyeball area according to the eyeball area; 灰色检测模块,用于根据所述RGB比值确定所述眼球区域是否为灰色;A gray detection module, configured to determine whether the eyeball area is gray according to the RGB ratio; 白平衡校准参数确定模块,用于在所述眼球区域为灰色时,将所述RGB比值确定为白平衡校准参数;A white balance calibration parameter determination module, configured to determine the RGB ratio as a white balance calibration parameter when the eyeball area is gray; 其中,所述RGB比值包括R和G的第一比值和B和G的第二比值;Wherein, the RGB ratio includes a first ratio of R and G and a second ratio of B and G; 所述灰色检测模块在所述第一比值小于第一阈值,且所述第二比值小于第二阈值时,确定所述眼球区域为灰色;在所述第一比值大于等于第一阈值,或者所述第二比值大于等于第二阈值时,确定所述眼球区域不为灰色。The gray detection module determines that the eyeball area is gray when the first ratio is smaller than the first threshold and the second ratio is smaller than the second threshold; when the first ratio is greater than or equal to the first threshold, or the When the second ratio is greater than or equal to a second threshold, it is determined that the eyeball area is not gray. 5.一种白平衡校准装置,其特征在于,包括:5. A white balance calibration device, comprising: 眼球区域获取模块,用于获取待校准图像中的眼球区域;The eyeball area acquisition module is used to acquire the eyeball area in the image to be calibrated; RGB比值获得模块,用于根据所述眼球区域获得所述眼球区域的RGB比值;an RGB ratio obtaining module, configured to obtain the RGB ratio of the eyeball area according to the eyeball area; 灰色检测模块,用于根据所述RGB比值确定所述眼球区域是否为灰色;A gray detection module, configured to determine whether the eyeball area is gray according to the RGB ratio; 白平衡校准参数确定模块,用于在所述眼球区域为灰色时,将所述RGB比值确定为白平衡校准参数;A white balance calibration parameter determination module, configured to determine the RGB ratio as a white balance calibration parameter when the eyeball area is gray; 白平衡校准模块,用于根据所述白平衡校准参数对所述待校准图像进行白平衡校准;a white balance calibration module, configured to perform white balance calibration on the image to be calibrated according to the white balance calibration parameters; 其中,所述RGB比值包括R和G的第一比值和B和G的第二比值;Wherein, the RGB ratio includes a first ratio of R and G and a second ratio of B and G; 所述灰色检测模块在所述第一比值小于第一阈值,且所述第二比值小于第二阈值时,确定所述眼球区域为灰色;在所述第一比值大于等于第一阈值,或者所述第二比值大于等于第二阈值时,确定所述眼球区域不为灰色。The gray detection module determines that the eyeball area is gray when the first ratio is smaller than the first threshold and the second ratio is smaller than the second threshold; when the first ratio is greater than or equal to the first threshold, or the When the second ratio is greater than or equal to a second threshold, it is determined that the eyeball area is not gray. 6.根据权利要求5所述的白平衡校准装置,其特征在于,所述白平衡校准模块包括:6. The white balance calibration device according to claim 5, wherein the white balance calibration module comprises: 第一增益获得单元,用于根据第一预设系数与所述第一比值的比值,获得第一增益;a first gain obtaining unit, configured to obtain a first gain according to the ratio of the first preset coefficient to the first ratio; 第二增益获得单元,用于根据第二预设系数与所述第二比值的比值,获得第二增益;a second gain obtaining unit, configured to obtain a second gain according to the ratio of the second preset coefficient to the second ratio; 白平衡校准单元,用于根据所述第一增益和所述第二增益对所述待校准图像进行白平衡校准。A white balance calibration unit, configured to perform white balance calibration on the image to be calibrated according to the first gain and the second gain.
CN201610389007.6A 2016-06-01 2016-06-01 White balance calibration method and apparatus and its calibration parameter preparation method and device Active CN105915875B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610389007.6A CN105915875B (en) 2016-06-01 2016-06-01 White balance calibration method and apparatus and its calibration parameter preparation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610389007.6A CN105915875B (en) 2016-06-01 2016-06-01 White balance calibration method and apparatus and its calibration parameter preparation method and device

Publications (2)

Publication Number Publication Date
CN105915875A CN105915875A (en) 2016-08-31
CN105915875B true CN105915875B (en) 2017-10-13

Family

ID=56743170

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610389007.6A Active CN105915875B (en) 2016-06-01 2016-06-01 White balance calibration method and apparatus and its calibration parameter preparation method and device

Country Status (1)

Country Link
CN (1) CN105915875B (en)

Family Cites Families (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7162078B2 (en) * 2002-12-20 2007-01-09 Fast Link Communication Corp. Automatic white balance correction method for image capturing apparatus
US7423674B2 (en) * 2003-12-08 2008-09-09 Nikon Corporation Electronic camera having color adjustment function and program therefor
US7423779B2 (en) * 2004-03-30 2008-09-09 Omnivision Technologies, Inc. Method and apparatus for automatic white balance
US20070047803A1 (en) * 2005-08-30 2007-03-01 Nokia Corporation Image processing device with automatic white balance
CN101159879B (en) * 2006-10-08 2010-08-25 鸿富锦精密工业(深圳)有限公司 Digital picture capturing device and white balance adjustment method thereof
CN101193316B (en) * 2006-11-21 2011-02-02 安凯(广州)微电子技术有限公司 A self-adapted white balance correction method
JP2008182369A (en) * 2007-01-23 2008-08-07 Funai Electric Co Ltd Imaging device
JP2008182368A (en) * 2007-01-23 2008-08-07 Funai Electric Co Ltd Imaging device
JP2011109411A (en) * 2009-11-17 2011-06-02 Nikon Corp Method and device for determining white balance correction coefficient, method and device for correcting white balance, and imaging apparatus
CN102300100B (en) * 2010-06-28 2015-03-04 比亚迪股份有限公司 White balance control device and method
KR101896386B1 (en) * 2011-11-22 2018-09-11 삼성전자주식회사 Device and method for adjusting white balance
CN103139572B (en) * 2011-11-24 2016-12-07 比亚迪股份有限公司 Photosensitive device and for its white balance method and device
JP2014053855A (en) * 2012-09-10 2014-03-20 Sony Corp Image processing device and method, and program
CN103699222B (en) * 2013-12-11 2016-09-07 天津三星电子有限公司 Display terminal image quality Automatic adjustment method and display terminal
CN104796683B (en) * 2014-01-22 2018-08-14 南京中兴软件有限责任公司 A kind of method and system of calibration image color
CN103929632B (en) * 2014-04-15 2016-02-03 浙江宇视科技有限公司 A kind of method for correcting automatic white balance and device
CN104468578B (en) * 2014-12-10 2017-12-26 怀效宁 The priority traffic system and the means of communication of a kind of wireless telecommunications
CN104618702B (en) * 2014-12-31 2016-04-20 湖南国科微电子股份有限公司 A kind of digital camera auto white balance method supposed based on white block

Also Published As

Publication number Publication date
CN105915875A (en) 2016-08-31

Similar Documents

Publication Publication Date Title
WO2019148912A1 (en) Image processing method, apparatus, electronic device and storage medium
JP6472869B2 (en) Image adjustment based on ambient light
US9762878B2 (en) Auto white balance using infrared and/or ultraviolet signals
CN104618702B (en) A kind of digital camera auto white balance method supposed based on white block
CN107704798B (en) Image blurring method, apparatus, computer-readable storage medium, and computer device
CN104935900B (en) Image sensing device, color correction matrix correction method and lookup table establishment method
CN104320642A (en) Method and device for image processing
JP2002027491A (en) Image input unit, white balance adjusting method, and computer readable recording medium storing program for executing the method
CN109685853B (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
CN107948617B (en) Image processing method, image processing device, computer-readable storage medium and computer equipment
CN107464225B (en) Image processing method, apparatus, computer-readable storage medium, and mobile terminal
CN104660766A (en) Backlight adjustment method and device of mobile terminal
CN108063891A (en) Image processing method, device, computer readable storage medium and computer equipment
CN107341782B (en) Image processing method, image processing device, computer equipment and computer readable storage medium
WO2020034739A1 (en) Control method and apparatus, electronic device, and computer readable storage medium
CN107317967A (en) Image processing method, device, mobile terminal, and computer-readable storage medium
KR101072945B1 (en) Apparatus for balancing flashed image color using depth estimation and method therefor
CN107635124A (en) White balance processing method, device and equipment for face shooting
CN108174173A (en) Photographing method and apparatus, computer-readable storage medium, and computer device
CN102804227B (en) Use the lenses attenuate correct operation of the value corrected based on monochrome information
CN105915875B (en) White balance calibration method and apparatus and its calibration parameter preparation method and device
CN105869111B (en) Skin color adjusting method and device for multi-person combined photography
CN104427322A (en) Information processing device, imaging device, information processing method, and program
CN106303309B (en) Image correction system and method
JP5038190B2 (en) Image capturing apparatus and setting method thereof

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP01 Change in the name or title of a patent holder
CP01 Change in the name or title of a patent holder

Address after: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Patentee after: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP., Ltd.

Address before: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Patentee before: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP., Ltd.