WO2020142871A1 - White balance processing method and device for image - Google Patents

White balance processing method and device for image Download PDF

Info

Publication number
WO2020142871A1
WO2020142871A1 PCT/CN2019/070660 CN2019070660W WO2020142871A1 WO 2020142871 A1 WO2020142871 A1 WO 2020142871A1 CN 2019070660 W CN2019070660 W CN 2019070660W WO 2020142871 A1 WO2020142871 A1 WO 2020142871A1
Authority
WO
WIPO (PCT)
Prior art keywords
color
light source
plane
color feature
far
Prior art date
Application number
PCT/CN2019/070660
Other languages
French (fr)
Chinese (zh)
Inventor
林威丞
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2019/070660 priority Critical patent/WO2020142871A1/en
Priority to CN201980006940.2A priority patent/CN111670575B/en
Publication of WO2020142871A1 publication Critical patent/WO2020142871A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N9/00Details of colour television systems
    • H04N9/64Circuits for processing colour signals
    • H04N9/73Colour balance circuits, e.g. white balance circuits or colour temperature control

Abstract

The present application provides a white balance processing method and device for an image. The method comprises: dividing a plurality of color features corresponding to a first image into near color features and far color features, wherein a distance between the near color feature in a color plane and one or more light source calibration points is less than or equal to a distance threshold value separately corresponding to one or more light source calibration points, and a distance between the far color features in the color plane and each light source calibration point of at least one light source calibration point is respectively greater than a distance threshold value corresponding to each light source calibration point; determining a first standard light source according to the near color features, and determining a second standard light source according to the far color features; determining a white balance gain according to the color feature of the first standard light source and the color feature of the second standard light source; and performing white balance processing on the first image according to the white balance gain so as to obtain a second image. According to the technical solutions, a color of an object in the image obtained by white balance processing can be close to a real color of the object in the image.

Description

图像的白平衡处理方法和装置Image white balance processing method and device 技术领域Technical field
本申请涉及图像处理领域,尤其涉及图像的白平衡处理方法和装置。The present application relates to the field of image processing, and in particular, to a white balance processing method and device for images.
背景技术Background technique
白平衡,是指在对图像处理的过程中,对图像中的物体进行色彩还原,以去除外部光源的颜色对图像中的物体的颜色的影响,使物体在处理得到的图像中呈现为物体原本的颜色,例如,使得原本颜色为白色的物体在处理后的图像中呈现的颜色为白色,使得原本颜色为红色的物体在处理后的图像中呈现的颜色为红色等。自动白平衡(auto white balance,AWB),是指计算机模仿人眼的视觉系统自动调整图像的色彩分量以使白色物体在成像时表现为白色的过程,其中,计算机可以计算出在图像对应的拍摄环境下的光源的颜色,然后根据光源的颜色计算出白平衡增益,利用白平衡增益对图像进行修正,使得图像中的物体的真实颜色能够再现于修正后的图像中。White balance refers to the color reproduction of the objects in the image in the process of image processing to remove the influence of the color of the external light source on the color of the objects in the image, so that the objects appear as the original objects in the processed image The color, for example, makes the color of an object that is originally white in the processed image appear white, and makes the color of an object that is originally red in the processed image appear red. Auto white balance (AWB) refers to the process that the computer imitates the visual system of the human eye to automatically adjust the color components of the image so that white objects appear white when imaging. Among them, the computer can calculate the corresponding shooting in the image The color of the light source in the environment, and then calculate the white balance gain according to the color of the light source, and use the white balance gain to correct the image, so that the true color of the objects in the image can be reproduced in the corrected image.
用于对图像进行AWB的方法有多种,目前的方法一般是找到图像中的白色物体或颜色接近于白色的物体,以该白色物体或颜色接近于白色的物体呈现在图像中的色彩特征为参考,确定外部光源(指图像对应的拍摄环境下的光源)的颜色,然后再根据外部光源的颜色确定白平衡增益,并利用该白平衡增益对图像的颜色进行修正。这种方法的问题在于,当图像中没有白色物体或颜色接近于白色的物体时,例如,图像为红色的图像,利用这种方法确定的外部光源的颜色会存在极大的误差,进而导致修正得到的图像与真实情况差距较大,无法真实反映物体的实际颜色。There are various methods for performing AWB on an image. The current method is generally to find a white object or an object with a color close to white in the image, and the color characteristics of the white object or an object with a color close to white appear in the image as For reference, determine the color of the external light source (refers to the light source in the shooting environment corresponding to the image), and then determine the white balance gain according to the color of the external light source, and use the white balance gain to correct the color of the image. The problem with this method is that when there is no white object in the image or the color is close to white, for example, the image is red, the color of the external light source determined by this method will have a great error, which will lead to correction The difference between the obtained image and the real situation is large, and it cannot truly reflect the actual color of the object.
发明内容Summary of the invention
本申请提供图像的白平衡处理方法和装置,用以提高AWB的性能。This application provides an image white balance processing method and device to improve the performance of AWB.
第一方面,提供一种图像的白平衡处理方法,包括:将第一图像中多个图像块各自对应的多个色彩特征划分为至少一个近色彩特征和至少一个远色彩特征,每个近色彩特征在色彩平面中与至少一个光源标定点中的一个或多个光源标定点的距离小于或等于该一个或多个光源标定点各自对应的第一距离阈值,每个远色彩特征在色彩平面中与该至少一个光源标定点中的每个光源标定点的距离分别大于每个光源标定点各自对应的第一距离阈值,该色彩平面是反映色彩特征的二维平面且包括该多个色彩特征和该至少一个光源标定点,每个光源标定点反映一标准光源的色彩特征;根据至少一个近色彩特征确定第一标准光源,并根据至少一个远色彩特征确定至少一个第二标准光源;根据第一标准光源的第一色彩特征和至少一个第二标准光源的第二色彩特征,确定第一白平衡增益;根据第一白平衡增益对第一图像进行白平衡处理,以得到第二图像。In a first aspect, an image white balance processing method is provided, including: dividing a plurality of color features corresponding to a plurality of image blocks in a first image into at least one near color feature and at least one far color feature, each near color The distance between the feature in the color plane and one or more light source calibration points in the at least one light source calibration point is less than or equal to the first distance threshold corresponding to the one or more light source calibration points, and each far color feature is in the color plane The distance from each of the at least one light source calibration point is greater than a first distance threshold corresponding to each light source calibration point, the color plane is a two-dimensional plane reflecting color features and includes the plurality of color features and The at least one light source calibration point, each light source calibration point reflects the color characteristics of a standard light source; the first standard light source is determined according to at least one near color characteristic, and the at least one second standard light source is determined according to at least one far color characteristic; according to the first The first color characteristic of the standard light source and the second color characteristic of at least one second standard light source determine a first white balance gain; perform white balance processing on the first image according to the first white balance gain to obtain a second image.
在该技术方案中,将第一图像中的多个图像块各自对应的多个色彩特征划分为与光源标定点的距离较近的近色彩特征以及与光源标定点的距离较远的远色彩特征,与光源标定点的距离较近的近色彩特征对应的图像的内容为白色物体的可能性较大,与光源标定点的 距离较远的远色彩特征对应的图像的内容不为白色物体的可能性较大,分别根据近色彩特征确定第一标准光源和根据远色彩特征确定一个或多个第二标准光源,相当于是分别根据白色物体和非白色物体分别确定多个环境光源,然后根据多个标准光源的颜色确定图像的白平衡增益,并利用该白平衡增益对图像进行修正,在确定白平衡增益时,同时结合了根据白色物体和非白色物体确定的环境光源的颜色,由于并不是完全参考白色物体确定环境光源的颜色,即使在图像中没有白色物体的情况下,也可以根据非白色物体确定环境光源,并根据环境光源的颜色对图像进行修正,从而保证了修正得到的图像的颜色可以接近于真实情况。In this technical solution, the multiple color features corresponding to the multiple image blocks in the first image are divided into near color features closer to the light source calibration point and far color features farther from the light source calibration point , The content of the image corresponding to the near color feature with a closer distance to the light source calibration point is more likely to be white objects, and the content of the image corresponding to the far color feature with a longer distance to the light source calibration point is not a white object The first standard light source is determined according to the near color feature and the one or more second standard light sources are determined according to the far color feature, which is equivalent to separately determining multiple ambient light sources according to white objects and non-white objects, and then according to multiple The color of the standard light source determines the white balance gain of the image, and uses this white balance gain to correct the image. When determining the white balance gain, it also combines the color of the ambient light source determined from white objects and non-white objects. Determine the color of the ambient light source with reference to a white object. Even if there is no white object in the image, you can determine the ambient light source based on the non-white object and correct the image according to the color of the ambient light source, thus ensuring the color of the corrected image Can be close to the real situation.
结合第一方面,在一种可能的实现方式中,可以分别确定多种环境光源的权重,然后根据多种环境光源各自对应的权重确定白平衡增益,上述根据第一标准光源的第一色彩特征和至少一个第二标准光源的第二色彩特征,确定第一白平衡增益的一种可行的实施方式为:确定第一标准光源的第一权重和至少一个第二标准光源的第二权重;以第一权重和至少一个第二标准光源的第二权重,对第一标准光源的第一色彩特征和至少一个第二标准光源的第二色彩特征进行加权求和计算,以得到融合色彩特征;根据该融合色彩特征,确定第一白平衡增益。通过分别为多种不同的标准光源的色彩特征赋予权重,得到一个综合性的环境光源的色彩特征,进而可以根据综合性的环境光源的色彩特征确定白平衡增益。With reference to the first aspect, in a possible implementation manner, the weights of multiple ambient light sources may be separately determined, and then the white balance gain may be determined according to the respective weights of the multiple ambient light sources. The above-mentioned first color characteristics of the first standard light source And a second color characteristic of at least one second standard light source, a feasible implementation manner of determining the first white balance gain is: determining a first weight of the first standard light source and a second weight of at least one second standard light source; The first weight and the second weight of the at least one second standard light source are weighted and summed over the first color feature of the first standard light source and the second color feature of the at least one second standard light source to obtain the fused color feature; This fused color feature determines the first white balance gain. By separately assigning weights to the color features of a variety of different standard light sources, a comprehensive environmental light source color feature is obtained, and then the white balance gain can be determined according to the comprehensive environmental light source color feature.
可选地,上述根据第一标准光源的第一色彩特征和至少一个第二标准光源的第二色彩特征,确定第一白平衡增益的另一种可行的实施方式为:根据第一标准光源的第一色彩特征确定第二白平衡增益;根据至少一个第二标准光源的第二色彩特征确定至少一个第三白平衡增益;确定第一标准光源的第一权重和至少一个第二标准光源的第二权重;以第一权重和至少一个第二标准光源的第二权重,对第二白平衡增益和该至少一个第三白平衡增益进行加权求和计算,以确定第一白平衡增益。通过分别确定多种不同的标准光源对应的白平衡增益,给这多个白平衡增益赋予权重,则可以确定一个综合性的白平衡增益,即确定第一图像的白平衡增益。Optionally, another feasible implementation manner of determining the first white balance gain according to the first color characteristic of the first standard light source and the second color characteristic of at least one second standard light source is: according to the The first color characteristic determines the second white balance gain; the at least one third white balance gain is determined according to the second color characteristic of the at least one second standard light source; the first weight of the first standard light source and the first Two weights; with the first weight and the second weight of at least one second standard light source, the second white balance gain and the at least one third white balance gain are weighted and summed to determine the first white balance gain. By separately determining the white balance gains corresponding to a plurality of different standard light sources and assigning weights to the multiple white balance gains, a comprehensive white balance gain can be determined, that is, the white balance gain of the first image can be determined.
结合第一方面,在一种可能的实现方式中,上述根据至少一个远色彩特征确定至少一个第二标准光源,包括:在色彩平面上对该至少一个远色彩特征进行划分,以得到至少一个远色彩特征群;确定该至少一个远色彩特征对应的亮度和该至少一个光源标定点对应的亮度;根据至少一个远色彩特征对应的亮度和该至少一个光源标定点对应的亮度,将该至少一个远色彩特征和该至少一个光源标定点映射至亮度色彩空间,该亮度色彩空间为色彩平面与亮度维度形成的三维空间;在亮度色彩空间中分别对该至少一个远色彩特征群进行线性回归,得到该至少一个远色彩特征群对应的至少一个回归平面;根据该至少一个回归平面,确定至少一个第二标准光源。通过将远色彩特征划分为远色彩特征群,可以将图像中颜色相近的物体对应的色彩特征划分在一起,通过对每个色彩特征群进行线性回归,可以确定该颜色相近的物体所具备的颜色的趋势和发展,进而根据颜色的趋势和发展确定环境光源的颜色。With reference to the first aspect, in a possible implementation manner, the determining at least one second standard light source according to at least one far color feature includes: dividing the at least one far color feature on a color plane to obtain at least one far color feature Color feature group; determining the brightness corresponding to the at least one far color feature and the brightness corresponding to the at least one light source calibration point; according to the brightness corresponding to the at least one far color feature and the brightness corresponding to the at least one light source calibration point, the at least one far The color feature and the at least one light source calibration point are mapped to a luma color space, which is a three-dimensional space formed by a color plane and a luma dimension; linear regression is performed on the at least one far-color feature group in the luma color space, respectively, to obtain the At least one regression plane corresponding to at least one distant color feature group; according to the at least one regression plane, at least one second standard light source is determined. By dividing the far color features into far color feature groups, the color features corresponding to objects with similar colors in the image can be divided together. By performing linear regression on each color feature group, the colors possessed by the objects with similar colors can be determined Trend and development, and then determine the color of the ambient light source according to the color trend and development.
结合第一方面,在一种可能的实现方式中,上述每个远色彩特征群包括的远色彩特征的数量大于或等于第一数量,且该远色彩特征群中的任一远色彩特征与其他至少一个远色彩特征在色彩平面上的距离小于或等于第二距离阈值。通过在色彩平面中将两两之间的距 离小于距离阈值的远色彩特征划分到一个远色彩特征群中,可以完成对远色彩特征的划分,从而得到一个或多个远色彩特征群。With reference to the first aspect, in a possible implementation manner, the number of far color features included in each far color feature group is greater than or equal to the first number, and any far color feature in the far color feature group is different from other The distance of the at least one far color feature on the color plane is less than or equal to the second distance threshold. By dividing the far-color features whose distance between them is less than the distance threshold into a far-color feature group in the color plane, the far-color features can be divided to obtain one or more far-color feature groups.
结合第一方面,在一种可能的实现方式中,上述根据至少一个回归平面,确定至少一个第二标准光源,包括:分别确定各个回归平面对应的第一参数、第二参数以及第三参数,其中,第一参数用于指示各个回归平面中的远色彩特征接近于任一标定光源点的颜色的概率,第二参数用于指示各个回归平面相对于色彩平面的倾斜程度,第三参数用于指示各个回归平面对应的图像在第一图像中的面积占比;分别根据各个回归平面对应的第一参数、第二参数以及第三参数,确定各个回归平面的可靠度;将可靠度处于前N位的回归平面确定为至少一个指向平面,N为大于或等于1的正整数,将至少一个第一光源标定点对应的标准光源确定为第二标准光源,该至少一个第一光源标定点为在亮度色彩空间中分别与该至少一个指向平面的距离最小的光源标定点。通过确定可靠度高的回归平面并将其确定为指向平面,可靠度高说明该指向平面对应的物体的颜色的趋势发展趋近于标准光源的颜色的可能性大,与指向平面距离最近的光源标定点可反映环境光源的颜色,将该光源标定点对应的标准光源确定为第二标准光源,可预测环境光源。With reference to the first aspect, in a possible implementation manner, the determining at least one second standard light source according to at least one regression plane includes: separately determining the first parameter, the second parameter, and the third parameter corresponding to each regression plane, Among them, the first parameter is used to indicate the probability that the far color features in each regression plane are close to the color of any calibrated light source point, the second parameter is used to indicate the degree of tilt of each regression plane relative to the color plane, and the third parameter is used to Indicate the area ratio of the image corresponding to each regression plane in the first image; determine the reliability of each regression plane according to the first parameter, second parameter, and third parameter corresponding to each regression plane; place the reliability in the top N The bit regression plane is determined as at least one pointing plane, N is a positive integer greater than or equal to 1, and the standard light source corresponding to at least one first light source calibration point is determined as the second standard light source, and the at least one first light source calibration point is at The light source calibration points with the smallest distance from the at least one pointing plane in the brightness color space respectively. By determining the highly reliable regression plane and determining it as the pointing plane, the high reliability indicates that the trend of the color of the object corresponding to the pointing plane is likely to be closer to the color of the standard light source, and the light source closest to the pointing plane The calibration point can reflect the color of the ambient light source, and the standard light source corresponding to the calibration point of the light source is determined as the second standard light source, which can predict the ambient light source.
结合第一方面,在一种可能的实现方式中,上述分别根据各个回归平面对应的第一参数、第二参数以及第三参数,确定各个回归平面的可靠度,包括:根据各个回归平面对应的第一参数的权重、各个回归平面对应的第二参数的权重以及各个回归平面对应的第三参数的权重,分别对各个回归平面对应的第一参数、各个回归平面对应的第二参数以及各个回归平面对应的第三参数进行加权求和计算,以分别确定各个回归平面的可靠度。通过从三个方面对回归平面进行评估,并赋予三个方面的参数不同的权重,可确定各个回归平面对应的物体的颜色趋势和发展趋近于标定光源点的颜色的可能性。With reference to the first aspect, in a possible implementation manner, the above determining the reliability of each regression plane according to the first parameter, the second parameter, and the third parameter corresponding to each regression plane respectively includes: according to the corresponding The weight of the first parameter, the weight of the second parameter corresponding to each regression plane, and the weight of the third parameter corresponding to each regression plane, respectively for the first parameter corresponding to each regression plane, the second parameter corresponding to each regression plane, and each regression The third parameter corresponding to the plane is weighted and summed to determine the reliability of each regression plane. By evaluating the regression plane from three aspects and giving different weights to the parameters of the three aspects, the color trend of the objects corresponding to each regression plane and the possibility of developing the color closer to the calibration light source point can be determined.
结合第一方面,在一种可能的实现方式中,上述确定第一标准光源的第一权重和至少一个第二标准光源的第二权重,包括:确定该至少一个指向平面中的各个指向平面对应的第一可靠度、第二可靠度以及第三可靠度,其中,第一可靠度为各个指向平面对应的第一参数,第二可靠度为各个指向平面对应的第二参数,第三可靠度为第二数量与第三数量的比值,第二数量为至少一个远色彩特征的总数量,第三数量为第一图像对应的多个色彩特征的总数量;根据各个指向平面对应的第一可靠度、第二可靠度以及第三可靠度,确定至少一个第二标准光源中各个第二标准光源的第二权重;根据各个第二标准光源的第二权重确定第一标准光源的第一权重。通过对远色彩特征群进行可靠度分析,可确定根据各个远色彩特征群确定的第二标准光源为环境光源的可能性,进而可确定第一标准光源为环境光源的可能性。With reference to the first aspect, in a possible implementation manner, the foregoing determining the first weight of the first standard light source and the second weight of the at least one second standard light source includes: determining that each of the at least one pointing plane corresponds to First reliability, second reliability and third reliability, where the first reliability is the first parameter corresponding to each pointing plane, the second reliability is the second parameter corresponding to each pointing plane, and the third reliability Is the ratio of the second quantity to the third quantity, the second quantity is the total quantity of at least one distant color feature, and the third quantity is the total quantity of multiple color features corresponding to the first image; according to the first reliability corresponding to each pointing plane Degree, second reliability and third reliability, determine the second weight of each second standard light source in at least one second standard light source; determine the first weight of the first standard light source according to the second weight of each second standard light source. By performing reliability analysis on the far color feature group, the possibility that the second standard light source determined according to each far color feature group is the ambient light source can be determined, and then the possibility that the first standard light source is the ambient light source can be determined.
结合第一方面,在一种可能的实现方式中,上述根据各个指向平面对应的第一可靠度、第二可靠度以及第三可靠度,确定至少一个第二标准光源中各个标准光源的第二权重,包括:根据各个指向平面对应的第一可靠度的权重、第二可靠度的权重以及第三可靠度的权重,对各个指向平面对应的第一可靠度、第二可靠度以及第三可靠度进行加权求和计算,以确定各个标准光源的第二权重。通过分别赋予三种可靠度不同的权重,对三种可靠度进行加权求和计算,可以确定各个第二标准光源为环境光源的可能性。With reference to the first aspect, in a possible implementation manner, according to the first reliability, the second reliability, and the third reliability corresponding to the respective pointing planes, the second of each standard light source among the at least one second standard light source is determined The weights include: according to the weights of the first reliability, the weights of the second reliability, and the weights of the third reliability corresponding to the respective pointing planes, the first reliability, the second reliability, and the third reliability corresponding to the respective pointing planes The weighted sum calculation is performed to determine the second weight of each standard light source. By assigning different weights to the three reliability levels and performing weighted sum calculation on the three reliability levels, it is possible to determine the possibility that each second standard light source is an ambient light source.
结合第一方面,在一种可能的实现方式中,将第一图像中多个图像块对应的多个色彩 特征划分为至少一个近色彩特征和至少一个远色彩特征之前,还包括:对第一图像进行图像分割,得到多个图像块;分别确定多个图像块中的各个图像块对应的色彩特征;根据各个图像块对应的色彩特征形成色彩平面。通过对第一图像进行分割处理和色彩特征化,可以确定第一图像对应的多个色彩特征和得到色彩平面。With reference to the first aspect, in a possible implementation manner, before dividing the multiple color features corresponding to the multiple image blocks in the first image into at least one near color feature and at least one far color feature, the method further includes: The image is image segmented to obtain multiple image blocks; the color features corresponding to each image block in the multiple image blocks are determined separately; and the color plane is formed according to the color features corresponding to each image block. By performing segmentation processing and color characterization on the first image, multiple color features corresponding to the first image can be determined and a color plane can be obtained.
第二方面,提供一种图像的白平衡处理装置,用于执行上述第一方面描述的图像的白平衡处理方法。该图像的白平衡处理装置可包括:存储器以及与该存储器耦合的处理器,其中:该存储器用于存储上述第一方面描述的图像的白平衡处理方法的程序代码,该处理器用于执行该存储器中存储的程序代码,即执行上述第一方面所提供的方法,或者上述第一方面可能的实现方式中的任意一种所提供的方法。In a second aspect, an image white balance processing device is provided for performing the image white balance processing method described in the first aspect above. The image white balance processing apparatus may include: a memory and a processor coupled to the memory, wherein: the memory is used to store the program code of the image white balance processing method described in the first aspect, and the processor is used to execute the memory The program code stored in executes the method provided in the above first aspect, or the method provided in any one of the possible implementation manners of the above first aspect.
第三方面,提供另一种图像的白平衡处理装置,该装置可包括多个功能模块,用于相应的执行上述第一方面所提供的方法,或者上述第一方面可能的实现方式中的任意一种所提供的方法。In a third aspect, another image white balance processing device is provided. The device may include a plurality of functional modules for correspondingly performing the method provided in the above first aspect, or any of the possible implementation manners of the above first aspect A method provided.
第四方面,提供一种计算机可读存储介质,该计算机可读存储介质上存储有指令,当其在计算机或处理器上运行时,使得计算机或处理器执行上述第一方面描述的图像的白平衡处理方法。According to a fourth aspect, there is provided a computer-readable storage medium having instructions stored on it, which when executed on a computer or processor, causes the computer or processor to execute the white of the image described in the first aspect above Balance processing method.
第五方面,提供一种包含指令的计算机程序产品,当其在计算机或处理器上运行时,使得计算机或处理器执行上述第一方面描述的图像的白平衡处理方法。According to a fifth aspect, there is provided a computer program product containing instructions that, when run on a computer or processor, causes the computer or processor to perform the white balance processing method of the image described in the first aspect above.
实施本申请的技术方案,在图像中没有白色物体的情况下,也可以使得白平衡处理得到的图像的物体的颜色能够接近于图像中的物体的真实颜色,提高了白平衡处理的准确度。By implementing the technical solution of the present application, when there is no white object in the image, the color of the object of the image obtained by the white balance process can be close to the true color of the object in the image, which improves the accuracy of the white balance process.
附图说明BRIEF DESCRIPTION
图1是本申请实施例提供的一种图像的白平衡处理方法的流程示意图;1 is a schematic flowchart of an image white balance processing method provided by an embodiment of the present application;
图2是本申请实施例提供的一种色彩特征分布示意图;2 is a schematic diagram of a color feature distribution provided by an embodiment of the present application;
图3是本申请实施例提供的根据远色彩特征确定第二标准光源的流程示意图;FIG. 3 is a schematic flowchart of determining a second standard light source according to far-color characteristics provided by an embodiment of the present application;
图4是本申请实施例提供的色彩平面中的色彩特征与亮度色彩空间中的三维数据的映射示意图;4 is a schematic diagram of mapping between color features in a color plane and three-dimensional data in a luminance color space provided by an embodiment of the present application;
图5是本申请实施例提供的在色彩亮度空间中对各个远色彩特征群进行线性回归得到回归平面的示意图;FIG. 5 is a schematic diagram of linear regression on each distant color feature group in a color brightness space provided by an embodiment of the present application to obtain a regression plane;
图6是本申请实施例提供的图像中的像素颜色分布示意图;6 is a schematic diagram of pixel color distribution in an image provided by an embodiment of the present application;
图7是本申请实施例提供的一种图像的白平衡处理装置的结构示意图;7 is a schematic structural diagram of an image white balance processing device provided by an embodiment of the present application;
图8是本申请实施例提供的一种图像的白平衡处理装置的结构框图。8 is a structural block diagram of an image white balance processing device provided by an embodiment of the present application.
具体实施方式detailed description
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。本申请的方案适用于对通过拍摄装置拍摄得到的并且未经处理的图像进行白平衡处理,使得经过白平衡处理得到的图像能够反映图像的真实颜色的场景。具体地,本申请的方案可适用于具有拍摄功能的设备在通过摄像头或相机镜头等成像部件拍摄得到图像后对图像进行AWB处理,以使得最后呈现在该设备中的图像中的物体的色彩接近于物体的真实色彩(即 接近于人眼看到的物体色彩)的场景,该具有拍摄功能的设备可以为具备拍摄功能的手机、单反相机、数码相机、录像机,等等,不限于这里的描述。或者,本申请的方案也可适用于对自身不具备AWB处理功能的并且具备拍摄功能的设备拍摄得到的图像进行AWB处理,以使得处理得到的图像中的物体的色彩接近于物体的真实色彩的场景,如可以利用电脑、服务器等设备对监控摄像头等设备拍摄得到的图像进行AWB处理,以使得处理得到的图像中的物体的色彩接近于物体的真实色彩的场景。又或者,本申请的方案还可以适用于对自身AWB处理效果不够好的并且具备拍摄功能的设备拍摄得到的图像进行进一步AWB处理,以使得处理得到的图像中的物体的色彩接近于物体的真实色彩的场景。The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. The solution of the present application is applicable to a scene where white balance processing is performed on an unprocessed image captured by a shooting device, so that the image obtained through the white balance processing can reflect the true color of the image. Specifically, the solution of the present application can be applied to a device with a shooting function that performs AWB processing on the image after the image is captured by an imaging component such as a camera or a camera lens, so that the colors of objects in the image finally presented in the device are close to For the scene of the true color of the object (that is, close to the color of the object seen by the human eye), the device with a shooting function may be a mobile phone, a SLR camera, a digital camera, a video recorder, etc. with a shooting function, which is not limited to the description here. Alternatively, the solution of the present application can also be applied to the AWB processing of the image captured by the device that does not have the AWB processing function and has the shooting function, so that the color of the object in the processed image is close to the true color of the object For scenes, for example, a computer, server, or other device can be used to perform AWB processing on an image captured by a monitoring camera or other device, so that the color of the object in the processed image is close to the real color of the object. Or, the solution of the present application can also be applied to further AWB processing of the image captured by the device with insufficient AWB processing effect and a shooting function, so that the color of the object in the processed image is close to the real object Color scene.
本申请通过根据图像中可能为白色物体的图像区域所对应的近色彩特征和图像中不为白色物体的图像区域所对应的远色彩特征分别确定一种或多种标准光源,以得到多种标准光源,根据多种标准光源确定该图像对应的拍摄环境中的环境光源,并根据该环境光源确定白平衡增益,然后根据该白平衡增益对图像进行白平衡处理,使得经过白平衡处理得到的图像中物体的色彩可以与物体的真实色彩相同或接近于物体的真实色彩,由于同时结合了白色物体和非白色物体所对应的色彩特征确定白平衡增益,即使在没有白色物体的情况下,也可以根据非白色物体所对应的远色彩特征确定环境光源,使得经过白平衡处理得到的图像的物体的颜色能够接近于图像中的物体的真实颜色,提高了白平衡处理的准确度。以下具体介绍本申请的方案。为便于理解本申请的方案,首先对本申请涉及的一些概念进行介绍。This application determines one or more standard light sources according to the near color features corresponding to the image area of the image that may be a white object and the far color features corresponding to the image area of the image that is not a white object, to obtain multiple standards Light source, determine the ambient light source in the shooting environment corresponding to the image according to multiple standard light sources, and determine the white balance gain according to the ambient light source, and then perform white balance processing on the image according to the white balance gain, so that the image obtained after the white balance processing The color of the object can be the same as the real color of the object or close to the real color of the object. Since the color characteristics corresponding to the white object and the non-white object are combined at the same time to determine the white balance gain, even if there is no white object, it can be The ambient light source is determined according to the far-color feature corresponding to the non-white object, so that the color of the object of the image obtained through the white balance process can be close to the true color of the object in the image, and the accuracy of the white balance process is improved. The scheme of this application is described in detail below. In order to facilitate the understanding of the scheme of this application, some concepts involved in this application are first introduced.
1、色彩特征1. Color characteristics
本申请中,色彩特征为用于定量表示颜色特征的特征数据,色彩特征对应多个色彩分量,多个色彩分量对应的色彩分量经过组合、转换后可得到该色彩特征对应的颜色,一个色彩特征可用于表示一种颜色。色彩分量与色彩特征可以有多种表现形式。具体地,色彩分量的表现形式可以为红(R)、绿(G)、蓝(B)各个颜色通道的数值,那么,色彩特征可以表示为(R/G,B/G)的格式,R/G和B/G分别为色彩特征的两个分量。色彩分量的表现形式也可以为颜色空间中的各个种类对应的数值,那么,色彩特征可以表示为(U,V)、(Cb,Cr)、(Pb,Pr)等格式,U和V,或,Cb和Cr,或,Pb和Pr分别为色彩特征的两个分量。In this application, the color feature is feature data used to quantitatively represent the color feature. The color feature corresponds to multiple color components. The color components corresponding to the multiple color components can be combined and converted to obtain the color corresponding to the color feature. One color feature Can be used to represent a color. The color components and color characteristics can have various expressions. Specifically, the representation form of the color component can be the values of the color channels of red (R), green (G), and blue (B). Then, the color characteristics can be expressed in the format of (R/G, B/G), R /G and B/G are the two components of color features, respectively. The expression form of the color component can also be the value corresponding to each type in the color space, then the color characteristics can be expressed in formats such as (U, V), (Cb, Cr), (Pb, Pr), U and V, or , Cb and Cr, or, Pb and Pr are the two components of color features, respectively.
2、色彩平面2. Color plane
本申请中,色彩平面为以色彩特征的两个分量分别作为两个维度形成的二维平面,色彩平面中的每个点可以用于定量表示一种颜色的色度,色彩平面中的每个点均可以表示为色彩特征的格式,一个点反映一种颜色的色彩特征。具体地,如果色彩特征的格式为(R/G,B/G),则色彩平面可以为以R/G为X坐标轴,以B/G为Y坐标轴的二维坐标平面,即可以用X坐标轴的数值表示色彩特征的R/G分量的数值,用Y坐标轴的数值表示色彩特征的B/G分量的数值;色彩平面也可以为以B/G为X坐标轴,以R/G为Y坐标轴的二维坐标平面,即可以用X坐标轴的数值表示色彩特征的B/G分量的数值,用Y坐标轴的数值表示色彩特征的R/G分量的数值。如果色彩特征的格式为(U,V),则色彩平面可以为以U为X坐标轴、以V为Y坐标轴的二维坐标平面,即可以用X坐标轴的数值表示色彩特征的U分量的数值,用Y坐标轴的数值表示色彩特征的V分量的数值;色彩平面也可以为以V为 X坐标轴,以U为Y坐标轴的二维坐标平面,即可以用X坐标轴的数值表示色彩特征的V分量的数值,用Y坐标轴的数值表示色彩特征的U分量的数值。如果色彩特征的格式为(Cb,Cr),则色彩平面可以为以Cb为X坐标轴,以Cr为Y坐标轴的二维坐标平面,即可以用X坐标轴的数值表示色彩特征的Cb分量的数值,用Y坐标轴的数值表示色彩特征的Cr分量的数值;色彩平面也可以为以Cr为X坐标轴,以Cb为Y坐标轴的二维坐标平面,即可以用X坐标轴的数值表示色彩特征的Cr分量的数值,用Y坐标轴的数值表示色彩特征的Cb分量的数值。如果色彩特征的格式为(Pb,Pr),则色彩平面可以为以Pb为X坐标轴,以Pr为Y坐标轴的二维坐标平面,即可以用X坐标轴的数值表示色彩特征的Pb分量的数值,用Y坐标轴的数值表示色彩特征的Pr分量的数值;色彩平面也可以为以Pr为X坐标轴,以Pb为Y坐标轴的二维坐标平面,即可以用X坐标轴的数值表示色彩特征的Pr分量的数值,用Y坐标轴的数值表示色彩特征的Pb分量的数值。In this application, a color plane is a two-dimensional plane formed by using two components of color features as two dimensions. Each point in the color plane can be used to quantitatively express the chromaticity of a color. All points can be expressed as a format of color features, and a point reflects the color features of a color. Specifically, if the color feature format is (R/G, B/G), the color plane can be a two-dimensional coordinate plane with R/G as the X coordinate axis and B/G as the Y coordinate axis, that is, it can be used The value of the X coordinate axis represents the value of the R/G component of the color feature, and the value of the Y coordinate axis represents the value of the B/G component of the color feature; the color plane can also be B/G as the X coordinate axis, and R/G G is the two-dimensional coordinate plane of the Y coordinate axis, that is, the value of the X coordinate axis can be used to represent the value of the B/G component of the color feature, and the value of the Y coordinate axis can represent the value of the R/G component of the color feature. If the color feature format is (U, V), the color plane can be a two-dimensional coordinate plane with U as the X coordinate axis and V as the Y coordinate axis, that is, the value of the X coordinate axis can be used to represent the U component of the color feature The value of the Y coordinate axis represents the value of the V component of the color feature; the color plane can also be a two-dimensional coordinate plane with V as the X coordinate axis and U as the Y coordinate axis, that is, the value of the X coordinate axis can be used Represents the value of the V component of the color feature, and the value of the Y coordinate axis represents the value of the U component of the color feature. If the color feature format is (Cb, Cr), the color plane can be a two-dimensional coordinate plane with Cb as the X coordinate axis and Cr as the Y coordinate axis, that is, the value of the X coordinate axis can be used to represent the Cb component of the color feature The value of the Y coordinate axis represents the value of the Cr component of the color feature; the color plane can also be a two-dimensional coordinate plane with Cr as the X coordinate axis and Cb as the Y coordinate axis, that is, the X coordinate axis value can be used Represents the value of the Cr component of the color feature, and the value of the Y coordinate axis represents the value of the Cb component of the color feature. If the format of the color feature is (Pb, Pr), the color plane can be a two-dimensional coordinate plane with Pb as the X coordinate axis and Pr as the Y coordinate axis, that is, the value of the X coordinate axis can be used to represent the Pb component of the color feature The value of the Y coordinate axis represents the value of the Pr component of the color feature; the color plane can also be a two-dimensional coordinate plane with Pr as the X coordinate axis and Pb as the Y coordinate axis, that is, the value of the X coordinate axis can be used The value of the Pr component representing the color feature, and the value of the Y coordinate axis represent the value of the Pb component of the color feature.
3、亮度色彩空间3. Luminance color space
本申请中,亮度色彩空间为以色彩特征对应的两个分量作为其中两个维度,并以色彩特征对应的亮度作为第三个维度形成的三维空间,该亮度色彩空间中的每个点可以用于定量表示一种颜色的亮度和色度,该三维空间中的每个点均可以表示为色彩特征与亮度的格式,一个点反映一种颜色。如果色彩特征的格式为(R/G,B/G),则亮度色彩空间中的点可以表示为(Y,R/G,B/G)的格式;如果色彩特征的格式为(U,V),则该亮度色彩空间中的点可以表示为(Y,U,V)的格式;如果色彩特征的格式为(Cb,Cr),则亮度色彩空间中的点可以表示为(Y,Cb,Cr)的格式;如果色彩特征的格式为(Pb,Pr),则亮度色彩空间中的点可以表示为(Y,Pb,Pr)的格式。在亮度色彩空间中的点对应的各种格式中,Y为色彩特征对应的亮度。具体地,可以分别用三维坐标空间中的X坐标轴的数值、Y坐标轴的数值以及Z坐标轴的数值分别表示Y分量的数值、R/G分量和B/G分量的数值,或者,用三维坐标空间中的X坐标轴的数值、Y坐标轴的数值以及Z坐标轴的数值分别表示Y分量的数值、U分量和V分量的数值,或者,用三维坐标空间中的X坐标轴的数值、Y坐标轴的数值以及Z坐标轴的数值分别表示Y分量的数值、Cb分量和Cr分量的数值,或者,用三维坐标空间中的X坐标轴的数值、Y坐标轴的数值以及Z坐标轴的数值分别表示Y分量的数值、Pb分量和Pr分量的数值,具体用哪个坐标轴的数值代表哪个分量的数值,本申请不作限制。In this application, the brightness color space is a three-dimensional space formed by taking two components corresponding to color features as two dimensions and using the brightness corresponding to color features as the third dimension. Each point in the brightness color space can be used To quantify the brightness and chroma of a color, each point in the three-dimensional space can be expressed as a format of color characteristics and brightness, and a point reflects a color. If the format of the color feature is (R/G, B/G), the points in the luminance color space can be expressed as (Y, R/G, B/G); if the format of the color feature is (U, V ), then the points in the brightness color space can be expressed in the format of (Y, U, V); if the format of the color feature is (Cb, Cr), the points in the brightness color space can be expressed as (Y, Cb, Cr) format; if the color feature format is (Pb, Pr), then the points in the luminance color space can be represented as (Y, Pb, Pr) format. In various formats corresponding to points in the brightness color space, Y is the brightness corresponding to the color feature. Specifically, the value of the X coordinate axis, the value of the Y coordinate axis, and the value of the Z coordinate axis in the three-dimensional coordinate space can be used to represent the value of the Y component, the R/G component, and the B/G component, respectively, or, The value of the X coordinate axis, the value of the Y coordinate axis, and the value of the Z coordinate axis in the three-dimensional coordinate space represent the value of the Y component, U component, and V component, respectively, or the value of the X coordinate axis in the three-dimensional coordinate space , The value of the Y coordinate axis and the value of the Z coordinate axis represent the value of the Y component, the Cb component and the Cr component, respectively, or the X coordinate axis value, the Y coordinate axis value and the Z coordinate axis in the three-dimensional coordinate space The numerical values of respectively indicate the numerical values of the Y component, the Pb component and the Pr component, which specific axis value represents which component value is used, and this application is not limited.
接下来介绍本申请的技术方案。参见图1,图1是本申请实施例提供的一种图像的白平衡处理方法的流程示意图,该方法可以实现在前述介绍的具有拍摄功能的设备、电脑、服务器等设备上,如图所示,该方法包括如下步骤:S101,将第一图像中多个图像块各自对应的多个色彩特征划分为至少一个近色彩特征和至少一个远色彩特征。S102,根据至少一个近色彩特征确定第一标准光源,并根据至少一个远色彩特征确定至少一个第二标准光源。S103,根据第一标准光源的第一色彩特征和至少一个第二标准光源的第二色彩特征,确定第一白平衡增益。S104,根据第一白平衡增益对第一图像进行白平衡处理,以得到第二图像。Next, the technical solution of this application is introduced. Referring to FIG. 1, FIG. 1 is a schematic flowchart of an image white balance processing method provided by an embodiment of the present application, and the method can be implemented on a device with a shooting function, a computer, a server, etc. as described above, as shown in the figure The method includes the following steps: S101. Divide a plurality of color features corresponding to a plurality of image blocks in a first image into at least one near color feature and at least one far color feature. S102. Determine a first standard light source according to at least one near color feature, and determine at least one second standard light source according to at least one far color feature. S103: Determine the first white balance gain according to the first color characteristic of the first standard light source and the second color characteristic of at least one second standard light source. S104. Perform white balance processing on the first image according to the first white balance gain to obtain a second image.
上述步骤S101和步骤S104中涉及的第一图像为需要进行白平衡处理的图像。第一图 像例如可以为前述提到的具有拍摄功能的设备通过摄像头或相机镜头等成像部件拍摄得到的图像;第一图像也可以为前述提到的自身不具备AWB处理功能的并且具备拍摄功能的设备拍摄得到的图像;第一图像还可以为自身AWB处理效果不够好并且具备拍摄功能的设备拍摄得到的图像。不限于这里的描述。The first image involved in the above steps S101 and S104 is an image that needs to be subjected to white balance processing. The first image may be, for example, an image captured by an imaging device such as a camera or a camera lens, etc., of the aforementioned device with a shooting function; the first image may also be the aforementioned one that does not have an AWB processing function and has a shooting function The image captured by the device; the first image can also be an image captured by a device that has insufficient AWB processing effect and has a shooting function. Not limited to the description here.
这里,请参考前述对色彩特征的描述,上述步骤S101涉及的第一图像中多个图像块对应的多个色彩特征为用于分别定量表示第一图像的各个图像区域的颜色特征的特征数据,例如,第一图像中的一个图像区域对应一个色彩特征。该多个色彩特征的格式可以为前述提到的色彩特征的格式中的任意一种格式。上述步骤S101中涉及的色彩平面为以色彩特征的两个分量分别作为两个维度形成的二维平面,色彩平面包括第一图像对应的多个色彩特征和至少一个光源标定点,每个光源标定点反映一个标准光源的色彩特征。第一图像对应的多个色彩特征和多个光源标定点以点的形式存在于该色彩平面中。Here, please refer to the foregoing description of the color features. The multiple color features corresponding to the multiple image blocks in the first image involved in step S101 above are feature data for quantitatively representing the color features of each image area of the first image, For example, an image area in the first image corresponds to a color feature. The format of the plurality of color features may be any of the aforementioned color feature formats. The color plane involved in the above step S101 is a two-dimensional plane formed by using two components of color features as two dimensions respectively. The color plane includes a plurality of color features corresponding to the first image and at least one light source calibration point. The fixed point reflects the color characteristics of a standard light source. Multiple color features and multiple light source calibration points corresponding to the first image exist in the form of dots in the color plane.
本申请实施例中,标准光源是指国际照明委员会为统一颜色测量所规定的用于模拟各种环境光线的光源。色彩平面中的至少一个光源标定点所对应的标准光源可包括D75光源、D65光源、D55光源、D50光源、CWF光源、TL84光源、U30光源、F光源、A光源以及H光源等光源中的部分或全部标准光源。其中,D75光源是指用于模拟北方平均太阳光的光源,D75光源的色温为7500开尔文(K);D75光源是指用于模拟蓝天日光的标准光源,D65的色温为6500K;D55光源是指用于模拟广告灯光箱的光源,D55的色温为5500K;D50光源为模拟太阳光的光源,D50光源的色温为5000K;CWF光源为模拟美国来白商店灯光(cool white fluorescent)的光源,CWF光源的色温为4100K;TL84光源为模拟欧洲、日本以及中国商店灯光的光源,TL84的色温为4000K;U30光源为模拟美国暖白商店灯光(warm white fluorescent)的光源,U30光源的色温为3000K;F光源为模拟家庭酒店暖色灯光的光源,F光源的色温为2700K,A光源为模拟美式橱窗射灯灯光的光源,A光源的色温为2800K;H光源为模拟水平日光的光源,H光源的色温为2300K。可选地,色彩平面中还可以包括除了上述提到的标准光源之外的其他标准光源对应的光源标定点。色彩平面中具体包括多少个光源标定点以及分别包括哪些标准光源对应的光源标定点可根据实际需求和设计确定。例如,可选用上述提到的标准光源中的D75光源、D65光源、D55光源、D50光源、CWF光源、TL84光源、U30光源、A光源、H光源作为进行白平衡处理时的标准光源,那么,色彩平面中的光源标定点可包括反映D75光源的色彩特征的光源标定点、反映D65光源的色彩特征的光源标定点、反映D55光源的色彩特征的光源标定点、反映D50光源的色彩特征的光源标定点、反映CWF光源的色彩特征的光源标定点、反映TL84光源的色彩特征的光源标定点、反映U30光源的色彩特征的标定点、反映A光源的色彩特征的光源标定点以及反映H光源的色彩特征的光源标定点。具体实现中,可通过感光元件确定各个标准光源的色彩特征所对应的色彩分量,从而确定多个光源标定点。In the embodiments of the present application, the standard light source refers to a light source specified by the International Lighting Commission for uniform color measurement and used to simulate various ambient light. The standard light source corresponding to the calibration point of at least one light source in the color plane may include some of the light sources such as D75 light source, D65 light source, D55 light source, D50 light source, CWF light source, TL84 light source, U30 light source, F light source, A light source and H light source Or all standard light sources. Among them, D75 light source refers to the light source used to simulate the average northern sunlight, D75 light source has a color temperature of 7500 Kelvin (K); D75 light source refers to the standard light source used to simulate blue sky and sunlight, D65 has a color temperature of 6500K; D55 light source refers to The light source used to simulate the advertising light box, the color temperature of D55 is 5500K; the light source of D50 is the light source simulating the sunlight, the color temperature of D50 light source is 5000K; the CWF light source is the light source simulating the cool white fluorescent light from the United States, CWF light source The color temperature is 4100K; the TL84 light source is a light source that simulates European, Japanese and Chinese store lights, the TL84 color temperature is 4000K; the U30 light source is a light source that simulates warm white store lights in the United States, and the U30 light source has a color temperature of 3000K; F The light source is a light source simulating the warm color light of a family hotel, the color temperature of light source F is 2700K, the light source A is a light source simulating American spotlight lighting, the color temperature of light source A is 2800K; the light source H is a light source simulating horizontal sunlight, and the color temperature of light source H is 2300K. Optionally, the color plane may further include a light source calibration point corresponding to a standard light source other than the standard light source mentioned above. How many light source calibration points specifically included in the color plane and which standard light sources respectively include the light source calibration points can be determined according to actual needs and designs. For example, the D75 light source, D65 light source, D55 light source, D50 light source, CWF light source, TL84 light source, U30 light source, A light source, and H light source among the standard light sources mentioned above can be selected as the standard light source for white balance processing, then, The light source calibration points in the color plane may include light source calibration points reflecting the color characteristics of the D75 light source, light source calibration points reflecting the color characteristics of the D65 light source, light source calibration points reflecting the color characteristics of the D55 light source, and light sources reflecting the color characteristics of the D50 light source Calibration points, light source calibration points reflecting the color characteristics of the CWF light source, light source calibration points reflecting the color characteristics of the TL84 light source, calibration points reflecting the color characteristics of the U30 light source, light source calibration points reflecting the color characteristics of the A light source, and reflecting the light source of the H light source Color characteristic light source calibration point. In a specific implementation, the color components corresponding to the color characteristics of each standard light source may be determined by the photosensitive element, so as to determine a plurality of light source calibration points.
上述步骤S101和步骤S102中涉及的近色彩特征是指在色彩平面中与色彩平面中的一个或多个光源标定点的距离小于或等于该一个或多个光源标定点对应的第一距离阈值的色彩特征。远色彩特征是指在色彩平面中与每个光源标定点的距离分别大于该每个光源标定点各自对应的第一距离阈值的色彩特征。即,如果目标色彩特征在色彩平面中与任一光源标定点的距离小于或等于该光源标定点对应的第一距离阈值,那么该目标色彩特征即为近 色彩特征;如果目标色彩特征在色彩平面中与每个光源标定点的距离均大于每个光源标定点各自对应的第一距离阈值,那么该目标色彩特征即为远色彩特征。The near-color feature involved in the above steps S101 and S102 refers to a distance in the color plane from one or more light source calibration points in the color plane less than or equal to the first distance threshold corresponding to the one or more light source calibration points Color characteristics. The far color feature refers to a color feature in the color plane where the distance from each light source calibration point is greater than the first distance threshold corresponding to each light source calibration point. That is, if the distance between the target color feature and any light source calibration point in the color plane is less than or equal to the first distance threshold corresponding to the light source calibration point, then the target color feature is a near color feature; if the target color feature is on the color plane The distance from the calibration point of each light source is greater than the first distance threshold corresponding to each calibration point of the light source, then the target color feature is the far color feature.
其中,各个光源标定点可对应同一个第一距离阈值,即,各个光源标定点对应的第一距离阈值相同。在各个光源标定点对应的同一个第一距离阈值的情况下,第一距离阈值只有一个。例如,各个光源标定点对应的第一距离阈值均为第二光源标定点与第三光源标定点在该色彩平面中的距离,第二光源标定点例如可以为D75光源对应的色彩特征,第三光源标定点例如可以为D65光源对应的色彩特征。各个光源标定点也可以对应不同的第一距离阈值,即各个光源标定点对应的第一距离阈值不同。在各个光源标定点对应不同的第一距离阈值的情况下,第一距离阈值有多个。例如,第三光源标定点对应的距离阈值为第二光源标定点与第三光源标定点在该色彩平面中的距离,第四光源标定点对应的距离阈值为第三光源标定点与第四光源标定点在该色彩平面中的距离,第二光源标定点例如可以为D75光源对应的色彩特征,第三光源标定点例如可以为D65光源对应的色彩特征,第四光源标定点例如可以为D50光源对应的色彩特征。Wherein, each light source calibration point may correspond to the same first distance threshold, that is, the first distance threshold corresponding to each light source calibration point is the same. In the case of the same first distance threshold corresponding to each light source calibration point, there is only one first distance threshold. For example, the first distance threshold corresponding to each light source calibration point is the distance between the second light source calibration point and the third light source calibration point in the color plane. The second light source calibration point may be, for example, the color feature corresponding to the D75 light source, the third The light source calibration point may be, for example, the color feature corresponding to the D65 light source. Each light source calibration point may also correspond to a different first distance threshold, that is, the first distance threshold corresponding to each light source calibration point is different. When each light source calibration point corresponds to a different first distance threshold, there are multiple first distance thresholds. For example, the distance threshold corresponding to the third light source calibration point is the distance between the second light source calibration point and the third light source calibration point in the color plane, and the distance threshold corresponding to the fourth light source calibration point is the third light source calibration point and the fourth light source The distance of the calibration point in the color plane, the second light source calibration point can be, for example, the color feature corresponding to the D75 light source, the third light source calibration point can be, for example, the color feature corresponding to the D65 light source, and the fourth light source calibration point can be, for example, the D50 light source Corresponding color characteristics.
示例性地,近色彩特征和远色彩特征在色彩平面的分布示意图可以如图2所示,图2是本申请实施例提供一种色彩特征分布示意图。图2中以色彩特征的分量为R/G分量和B/G分量为例,色彩平面的X坐标轴代表了色彩特征的R/G分量的数值,Y坐标轴代表了色彩特征的B/G分量的数值。在该色彩平面中,光源标定点分别为D75光源、D65光源、D55光源、D50光源、CWF光源、TL84光源、U30光源、A光源、H光源的色彩特征。除了光源标定点外,其他的点均表示第一图像对应的色彩特征。分别以各个光源标定对应的第一距离阈值为半径,可得到各个光源标定点对应的圆形区域。其中,处于圆形区域内的色彩特征与该圆形区域中的光源标定点的距离小于该光源标定点对应的第一距离阈值,在圆形区域的边界上的色彩特征与该圆形区域对应的光源标定点的距离等于该光源标定点对应的第一距离阈值,那么处于任一圆形区域内或任一圆形区域的边界上的色彩特征即为近色彩特征。处于圆形区域外的色彩特征与该圆形区域对应的光源标定点的距离大于该光源标定点对应的第一距离阈值,那么处于圆形区域外的色彩特征即为远色彩特征。在图2中,各个圆形区域的集合组成了近光源范围,在近光源范围内的浅灰色点所表示的色彩特征即为近色彩特征,在近光源范围外的黑色点所表示的色彩特征即为远色彩特征。Exemplarily, the schematic diagram of the distribution of the near-color features and the far-color features in the color plane may be as shown in FIG. Taking the color feature components as the R/G component and the B/G component in FIG. 2 as an example, the X coordinate axis of the color plane represents the value of the R/G component of the color feature, and the Y coordinate axis represents the B/G of the color feature The numeric value of the component. In this color plane, the light source calibration points are the color characteristics of D75 light source, D65 light source, D55 light source, D50 light source, CWF light source, TL84 light source, U30 light source, A light source, and H light source. Except for the calibration point of the light source, all other points represent the color features corresponding to the first image. The first distance threshold corresponding to the calibration of each light source is a radius, respectively, and the circular area corresponding to the calibration point of each light source can be obtained. The distance between the color feature in the circular area and the light source calibration point in the circular area is less than the first distance threshold corresponding to the light source calibration point, and the color feature on the boundary of the circular area corresponds to the circular area The distance of the calibration point of the light source is equal to the first distance threshold corresponding to the calibration point of the light source, then the color feature within any circular area or on the boundary of any circular area is the near color feature. The distance between the color feature outside the circular area and the light source calibration point corresponding to the circular area is greater than the first distance threshold corresponding to the light source calibration point, then the color feature outside the circular area is the far color feature. In Figure 2, the collection of various circular areas constitutes the near-light source range. The color features represented by the light gray dots in the near-light source range are near-color features, and the color features represented by the black dots outside the near-light source range It is the far color feature.
对于上述步骤S101,在一种具体实现方式中,可分别确定第一图像中多个图像块各自对应的多个色彩特征中的各个色彩特征的两个分量以及各个光源标定点表示的色彩特征的两个分量,根据各个色彩特征的两个分量与各个光源标定点的两个分量分别确定各个色彩特征与各个光源标定点的距离,再将各个色彩特征与各个光源标定点的距离分别与各个光源标定点对应的第一距离阈值进行比较,以分别确定各个色彩特征为近色彩特征还是远色彩特征。其中,第一图像对应的色彩特征的两个分量与光源标定点的色彩特征的两个分量的类型相同,例如均为R/G分量和B/G分量,或者均为U分量和V分量。具体地,可按照公式(1)分别确定第一图像对应的色彩特征与各个光源标定点的距离。For the above step S101, in a specific implementation manner, the two components of each of the plurality of color features corresponding to each of the plurality of image blocks in the first image and the color features represented by the calibration points of each light source may be separately determined Two components, according to the two components of each color feature and the two components of each light source calibration point, determine the distance between each color feature and each light source calibration point, and then the distance between each color feature and each light source calibration point and each light source The first distance threshold corresponding to the calibration point is compared to determine whether each color feature is a near color feature or a far color feature. The two components of the color feature corresponding to the first image are of the same type as the two components of the color feature of the calibration point of the light source, for example, they are both R/G components and B/G components, or both are U components and V components. Specifically, the distance between the color feature corresponding to the first image and the calibration point of each light source can be determined according to formula (1).
Figure PCTCN2019070660-appb-000001
Figure PCTCN2019070660-appb-000001
在公式(1)中,X1和Y1分别为标准光源表示的色彩特征的两个分量,即一个光源标定点的值,X2和Y2分别为第一图像对应的一个色彩特征的两个分量。In formula (1), X1 and Y1 are the two components of the color feature represented by the standard light source, namely, the value of a light source calibration point, and X2 and Y2 are the two components of a color feature corresponding to the first image, respectively.
以下举例对确定色彩特征具体为近色彩特征还是远色彩特征进行说明。The following is an example to determine whether the color feature is a near color feature or a far color feature.
例如,第一图像对应的多个色彩特征分别为色彩特征1~色彩特征100,色彩特征的两个分量分别为R/G分量和B/G分量,则色彩特征1~色彩特征100可以表示为(R1/G1,B1/G1),(R2/G2,B2/G2),(R3/G3,B3/G3),…….,(R99/G99,B99/G99),(R100/G100,B100/G100)。假定选用了前述介绍的标准光源中的9种标准光源,9种标准光源分别为D75光源、D65光源、D55光源、D50光源、CWF光源、TL84光源、U30光源、A光源以及H光源。其中,D75光源的色彩特征为(Rl1/Gl1,Bl1/Gl1),D75光源对应的第一距离阈值为D1;D65光源的色彩特征为(Rl2/Gl2,Bl2/Gl2),D65光源对应的第一距离阈值为D2;D55光源的色彩特征为(Rl3/Gl3,Bl3/Gl3),D55光源对应的第一距离阈值为D3;D50光源的色彩特征为(Rl4/Gl4,Bl4/Gl4),D50光源对应的第一距离阈值为D4;CWF光源的色彩特征为(Rl5/Gl5,Bl5/Gl5),CWF光源对应的第一距离阈值为D5;TL84光源的色彩特征为(Rl6/Gl6,Bl6/Gl6),TL84光源对应的第一距离阈值为D6;U30光源的色彩特征为(Rl7/Gl7,Bl7/Gl7),U30光源对应的第一距离阈值为D7;A光源的色彩特征为(Rl8/Gl8,Bl8/Gl8),A光源对应的第一距离阈值为D8;H光源的色彩特征为(Rl9/Gl9,Bl9/Gl9),H光源对应的第一距离阈值为D9。For example, if the multiple color features corresponding to the first image are color feature 1 to color feature 100, and the two components of the color feature are R/G and B/G components, respectively, then color feature 1 to color feature 100 can be expressed as (R1/G1, B1/G1), (R2/G2, B2/G2), (R3/G3, B3/G3), ..., (R99/G99, B99/G99), (R100/G100, B100 /G100). It is assumed that 9 standard light sources among the standard light sources described above are selected. The 9 standard light sources are D75 light source, D65 light source, D55 light source, D50 light source, CWF light source, TL84 light source, U30 light source, A light source, and H light source. Among them, the color characteristic of D75 light source is (Rl1/Gl1, Bl1/Gl1), the first distance threshold corresponding to D75 light source is D1; the color characteristic of D65 light source is (Rl2/Gl2, Bl2/Gl2), the corresponding A distance threshold is D2; the color characteristic of the D55 light source is (Rl3/Gl3, Bl3/Gl3), the first distance threshold corresponding to the D55 light source is D3; the color characteristic of the D50 light source is (Rl4/Gl4, Bl4/Gl4), D50 The first distance threshold corresponding to the light source is D4; the color characteristic of the CWF light source is (Rl5/Gl5, Bl5/Gl5), the first distance threshold corresponding to the CWF light source is D5; the color characteristic of the TL84 light source is (Rl6/Gl6, Bl6/ Gl6), the first distance threshold corresponding to the TL84 light source is D6; the color characteristic of the U30 light source is (Rl7/Gl7, Bl7/Gl7), the first distance threshold corresponding to the U30 light source is D7; the color characteristic of the A light source is (Rl8/ Gl8, Bl8/Gl8), the first distance threshold corresponding to the A light source is D8; the color characteristic of the H light source is (Rl9/Gl9, Bl9/Gl9), and the first distance threshold corresponding to the H light source is D9.
对色彩特征1~色彩特征100进行划分的过程可以如下:The process of dividing color feature 1 to color feature 100 can be as follows:
1)分别计算色彩特征1与各个光源标定点的距离,色彩特征1与各个光源标定点的距离分别为d11~d19,其中:1) Calculate the distance between the color feature 1 and the calibration point of each light source respectively. The distance between the color feature 1 and the calibration point of each light source is d11~d19, where:
Figure PCTCN2019070660-appb-000002
Figure PCTCN2019070660-appb-000002
Figure PCTCN2019070660-appb-000003
Figure PCTCN2019070660-appb-000003
Figure PCTCN2019070660-appb-000004
Figure PCTCN2019070660-appb-000004
Figure PCTCN2019070660-appb-000005
Figure PCTCN2019070660-appb-000005
Figure PCTCN2019070660-appb-000006
Figure PCTCN2019070660-appb-000006
Figure PCTCN2019070660-appb-000007
Figure PCTCN2019070660-appb-000007
Figure PCTCN2019070660-appb-000008
Figure PCTCN2019070660-appb-000008
Figure PCTCN2019070660-appb-000009
Figure PCTCN2019070660-appb-000009
Figure PCTCN2019070660-appb-000010
Figure PCTCN2019070660-appb-000010
2)如果d11大于D1,以及,d12大于D2,以及d13大于D3,以及,d14大于D4,以及d15大于D5,以及,d16大于D6,以及,d17大于D7,以及,d18大于D8,以及d19大于D9,则确定色彩特征1为远色彩特征;否则,则确定色彩特征1为近色彩特征。2) If d11 is greater than D1, and d12 is greater than D2, and d13 is greater than D3, and d14 is greater than D4, and d15 is greater than D5, and d16 is greater than D6, and, d17 is greater than D7, and, d18 is greater than D7, and, d18 is greater than D8, and d19 is greater than D9, it is determined that color feature 1 is a far color feature; otherwise, it is determined that color feature 1 is a near color feature.
3)按1)的方式分别计算色彩特征2~色彩特征100与各个光源标定点的距离,色彩特征2与各个光源标定点的距离分别为d21~d29,色彩特征3与各个光源标定点的距离分别为d31~d39,……,色彩特征100与各个光源标定点的距离分别为d1001~d1009。3) Calculate the distance between color feature 2 ~ color feature 100 and the calibration point of each light source according to 1), the distance between color feature 2 and the calibration point of each light source is d21 ~ d29, and the distance between color feature 3 and the calibration point of each light source D31 to d39, respectively... The distance between the color feature 100 and the calibration point of each light source is d1001 to d1009, respectively.
4)参考2)的方式分别确定色彩特征2~色彩特征100具体为哪种色彩特征。4) Refer to the method of 2) to determine which color feature the color feature 2 to color feature 100 are.
可选地,在确定各个色彩特征具体为哪种色彩特征的过程中,如果确定该色彩特征与某个光源标定点的距离小于该光源标定点对应的第一距离阈值,可直接确定该色彩特征为近色彩特征,省去计算该色彩特征与其他还未被用于计算的光源标定点之间的距离。例如,在上述过程1)~4)中,当计算得到d11后,确定d11小于D1,则直接确定色彩特征1为 近色彩特征,省去后续计算d12~d19的过程。Optionally, in the process of determining which color feature each color feature is specifically, if it is determined that the distance between the color feature and a certain light source calibration point is less than the first distance threshold corresponding to the light source calibration point, the color feature may be directly determined For the near color feature, the calculation of the distance between the color feature and other light source calibration points that have not been used for calculation is omitted. For example, in the above processes 1) to 4), when d11 is calculated and it is determined that d11 is less than D1, the color feature 1 is directly determined as a near color feature, and the subsequent calculation of d12 to d19 is omitted.
对于上述步骤S101,在另一种具体实现方式中,也可以将第一图像对应的多个色彩特征、各个光源标定点以及分别以各个光源标定点为圆心、以各个光源标定点对应的第一距离阈值为半径的圆形区域分别标示在二维坐标平面上,将第一图像对应的多个色彩特征中位于圆形区域内的色彩特征确定为近色彩特征,并将第一图像对应的多个色彩特征中位于圆形区域外的色彩特征确定为远色彩特征。For the above step S101, in another specific implementation manner, a plurality of color features corresponding to the first image, each light source calibration point, and the first corresponding to each light source calibration point and the first corresponding to each light source calibration point The circular areas with a distance threshold of radius are marked on the two-dimensional coordinate plane, and the color features located in the circular area among the multiple color features corresponding to the first image are determined as near-color features, and the multiple corresponding to the first image are determined. Among the color features, the color features located outside the circular area are determined as far color features.
对于上述步骤S102,可以分别根据该至少一个近色彩特征和该至少一个远色彩特征的变化规律确定该至少一个近色彩特征和该至少一个远色彩特征的趋势与发展,然后分别根据该至少一个近色彩特征和该至少一个远色彩特征的趋势与发展分别确定匹配于该至少一个近色彩特征和该至少一个远色彩特征的趋势发展的光源标定点,最后分别将匹配于该至少一个近色彩特征和该至少一个远色彩特征的趋势发展的一个或多个光源标定点对应的标准光源确定为第一标准光源和第二标准光源。其中,确定第一标准光源和第二标准光源的方法将可参见图3所示的方法实施例的介绍,此处不做过多描述。For the above step S102, the trends and developments of the at least one near-color feature and the at least one far-color feature can be determined according to the change laws of the at least one near-color feature and the at least one far-color feature, respectively, and then respectively according to the at least one near-color feature The color features and the trend and development of the at least one far color feature determine the light source calibration points that match the trend development of the at least one near color feature and the at least one far color feature, respectively, and finally match the at least one near color feature and the The standard light sources corresponding to the one or more light source calibration points of the trend development of the at least one distant color feature are determined as the first standard light source and the second standard light source. For the method of determining the first standard light source and the second standard light source, reference may be made to the introduction of the method embodiment shown in FIG. 3, and details are not described here.
上述步骤S103和步骤S104中涉及的第一白平衡增益包括R通道、G通道以及B通道三个通道的增益,R通道、G通道以及B通道三个通道的增益分别为R1-gain、G1-gain以及B1-gain,即第一白平衡增益为(R1-gain,G1-gain,B1-gain)。The first white balance gains involved in the above steps S103 and S104 include gains of three channels of R channel, G channel and B channel, and gains of three channels of R channel, G channel and B channel are R1-gain and G1- gain and B1-gain, that is, the first white balance gain is (R1-gain, G1-gain, B1-gain).
对于上述步骤S103,可确定第一标准光源的第一权重和第二标准光源的第二权重,然后根据第一光源的权重第一权重以及第二标准光源的第二权重并结合第一色彩特征和第二色彩特征,确定第一白平衡增益。其中,第一权重与第二权重的总和为1或等同于1的固定常数。例如,第一权重与第二权重之和可以设置为固定常数1024。在一种可能的情况中,第一权重与第二权重可以为预设的权重,即第一权重与第二权重的数值为固定值,并且第一权重与第二权重的总和为1或等同于1的固定常数。例如,固定常数为1024,则第一权重为512,第二权重为512。在另一种可能的情况中,第一权重与第二权重也可以不为预设的权重,第一权重和第二权重可以为根据近色彩特征以及远色彩特征的具体情况确定的权重,其中,根据近色彩特征以及远色彩特征的具体情况确定第一权重和第二权重的方式可参见后续方法实施例的介绍。For the above step S103, the first weight of the first standard light source and the second weight of the second standard light source may be determined, and then combined with the first color feature according to the first weight of the first light source and the second weight of the second standard light source And the second color feature, determine the first white balance gain. The sum of the first weight and the second weight is 1 or a fixed constant equivalent to 1. For example, the sum of the first weight and the second weight may be set to a fixed constant of 1024. In a possible situation, the first weight and the second weight may be preset weights, that is, the values of the first weight and the second weight are fixed values, and the sum of the first weight and the second weight is 1 or equivalent A fixed constant of 1. For example, if the fixed constant is 1024, the first weight is 512 and the second weight is 512. In another possible situation, the first weight and the second weight may not be preset weights, and the first weight and the second weight may be weights determined according to the specific conditions of the near color feature and the far color feature, where For the method of determining the first weight and the second weight according to the specific conditions of the near color feature and the far color feature, refer to the introduction of subsequent method embodiments.
在确定第一标准光源的第一权重和该至少一个第二标准光源的第二权重后,根据第一权重、第二权重并结合第一色彩特征和第二色彩特征,确定第一白平衡增益的方式可以有以下两种。After determining the first weight of the first standard light source and the second weight of the at least one second standard light source, the first white balance gain is determined according to the first weight, the second weight, and combining the first color characteristic and the second color characteristic There are two ways.
第一种方式:可以以第一权重和该至少一个第二标准光源的第二权重,对第一色彩特征和第二色彩特征进行加权求和计算,得到融合色彩特征;然后根据该融合色彩特征,确定第一白平衡增益。The first way: the first color feature and the second weight of the at least one second standard light source can be used to perform weighted sum calculation on the first color feature and the second color feature to obtain a fused color feature; then according to the fused color feature To determine the first white balance gain.
具体地,对第一色彩特征和第二色彩特征进行加权求和计算的公式为:融合色彩特征=第一权重×第一色彩特征+第二权重×第二色彩特征。Specifically, the formula for weighted sum calculation of the first color feature and the second color feature is: fusion color feature=first weight×first color feature+second weight×second color feature.
可选地,在确定的第二标准光源的数量为多个的情况下,第二色彩特征也有多个,则对第一色彩特征和第二色彩特征进行加权求和计算的公式为:融合色彩特征=第一权重×第一色彩特征+第二权重1×第二色彩特征1+第二权重2×第二色彩特征2+…+第二权重M×第 二色彩特征M,其中,M为第二标准光源的数量,第一权重与第二权重1、第二权重2、…、第二权重M的总和等于1或等同于1的固定常数。Optionally, when there are multiple determined second standard light sources and there are multiple second color features, the formula for weighted sum calculation of the first color feature and the second color feature is: fusion color Feature = first weight x first color feature + second weight 1 x second color feature 1 + second weight 2 x second color feature 2+... + second weight M x second color feature M, where M is The number of second standard light sources, the sum of the first weight and the second weight 1, the second weight 2, ..., the second weight M is equal to 1 or a fixed constant equal to 1.
在一种可行的实施方式中,如果第一色彩特征与第二色彩特征的格式为(R/G,B/G)的格式,则可以分别根据第一色彩特征的R/G分量和第二色彩特征的R/G分量,确定融合色彩特征的R/G分量;再分别根据第一色彩特征的B/G分量和第二色彩特征的B/G分量,确定融合色彩特征的B/G分量;然后根据融合色彩特征的R/G分量和B/G分量确定第一白平衡增益,其中,R1-gain可以为融合色彩特征的R/G分量的倒数,即R1-Gain=1/A1(R/G),A1(R/G)为融合色彩特征的R/G分量;G1-gain可以为1;B1-gain可以为融合色彩特征的B/G分量的倒数,即B1-gain=1/A1(B/G),A1(B/G)为融合色彩特征的B/G分量。In a feasible implementation manner, if the format of the first color feature and the second color feature is (R/G, B/G), the R/G component of the first color feature and the second The R/G component of the color feature determines the R/G component of the fused color feature; then the B/G component of the fused color feature is determined according to the B/G component of the first color feature and the B/G component of the second color feature, respectively ; Then the first white balance gain is determined according to the R/G and B/G components of the fused color feature, where R1-gain can be the reciprocal of the R/G component of the fused color feature, that is, R1-Gain=1/A1( R/G), A1(R/G) is the R/G component of the fused color feature; G1-gain can be 1; B1-gain can be the reciprocal of the B/G component of the fused color feature, ie B1-gain=1 /A1(B/G), A1(B/G) is the B/G component of fused color features.
例如,第一权重与第二权重均为0.5,第一色彩特征的R/G分量为3,第一色彩特征的B/G分量为4,第二色彩特征的数量为一个,第二色彩特征的R/G分量为5,第二色彩特征的B/G分量为6,则确定融合色彩特征的R/G分量为3×0.5+5×0.5=4,确定融合色彩特征的B/G分量为4×0.5+6×0.5=5,进而确定R1-gain为1/4,G1-gain为1,B1-gain为1/5。For example, both the first weight and the second weight are 0.5, the R/G component of the first color feature is 3, the B/G component of the first color feature is 4, the number of second color features is one, and the second color feature R/G component is 5, and the B/G component of the second color feature is 6, the R/G component of the fused color feature is determined to be 3×0.5+5×0.5=4, and the B/G component of the fused color feature is determined It is 4×0.5+6×0.5=5, and it is determined that R1-gain is 1/4, G1-gain is 1, and B1-gain is 1/5.
在另一种可行的实施方式中,如果第一色彩特征与第二色彩特征的格式不为(R/G,B/G)的格式,则可以根据第一色彩特征将第一色彩特征转换为格式为(R/G,B/G)的色彩特征F1,根据第二色彩特征将第二色彩特征转换为格式为(R/G,B/G)的色彩特征F2,然后根据色彩特征F1和色彩特征F2结合上述实施方式介绍的方式确定第一白平衡增益。In another feasible implementation manner, if the format of the first color feature and the second color feature is not the format of (R/G, B/G), the first color feature can be converted to The color feature F1 in the format (R/G, B/G), converts the second color feature into the color feature F2 in the format (R/G, B/G) according to the second color feature, and then according to the color feature F1 and The color characteristic F2 determines the first white balance gain in combination with the manner described in the above embodiment.
其中,根据第一色彩特征将第一色彩特征转换为格式为(R/G,B/G)的色彩特征F1的方式为:根据第一色彩特征和第一色彩特征对应的亮度确定第一色彩特征的R分量、G分量以及B分量,并根据第一色彩特征的R分量、G分量以及B分量确定色彩特征F1的R/G分量和B/G分量,色彩特征F1的R/G分量为第一色彩特征的R分量与第一色彩特征的G分量之商,色彩特征F1的B/G分量为第一色彩特征的B分量与第一色彩特征的G分量之商。根据第二色彩特征将第二色彩特征转换为格式为(R/G,B/G)的色彩特征F2的方式为:根据第二色彩特征和第二色彩特征对应的亮度确定第二色彩特征的R分量、G分量以及B分量,并根据第二色彩特征的R分量、G分量以及B分量确定色彩特征F2的R/G分量和B/G分量,色彩特征F2的R/G分量为第二色彩特征的R分量与第二色彩特征的G分量之商,色彩特征F2的B/G分量为第二色彩特征的B分量与第二色彩特征的G分量之商。The method for converting the first color feature to the color feature F1 in the format (R/G, B/G) according to the first color feature is: determining the first color according to the first color feature and the brightness corresponding to the first color feature The R component, G component and B component of the feature, and the R/G component and B/G component of the color feature F1 are determined according to the R component, G component and B component of the first color feature, and the R/G component of the color feature F1 is The quotient of the R component of the first color feature and the G component of the first color feature, and the B/G component of the color feature F1 is the quotient of the B component of the first color feature and the G component of the first color feature. The method for converting the second color feature to the color feature F2 in the format (R/G, B/G) according to the second color feature is: determining the second color feature according to the second color feature and the brightness corresponding to the second color feature R component, G component and B component, and the R/G component and B/G component of the color feature F2 are determined according to the R component, G component and B component of the second color feature, and the R/G component of the color feature F2 is the second The quotient of the R component of the color feature and the G component of the second color feature, and the B/G component of the color feature F2 is the quotient of the B component of the second color feature and the G component of the second color feature.
具体地,如果第一色彩特征和第二色彩特征的格式为(U,V)格式,则可根据公式(2)确定第一色彩特征和第二色彩特征的R分量、G分量以及B分量。Specifically, if the format of the first color feature and the second color feature is the (U, V) format, the R component, G component, and B component of the first color feature and the second color feature can be determined according to formula (2).
Figure PCTCN2019070660-appb-000011
Figure PCTCN2019070660-appb-000011
在公式(2)中,R、G、B分别为R分量、G分量以及B分量,Y为亮度,U和V分别为色彩特征的两个分量。In formula (2), R, G, and B are the R component, the G component, and the B component, Y is the brightness, and U and V are the two components of the color feature, respectively.
具体地,如果第一色彩特征和第二色彩特征的格式为(Cb,Cr)格式,则可根据公式(3)确定第一色彩特征和第二色彩特征的R分量、G分量以及B分量。Specifically, if the format of the first color feature and the second color feature is the (Cb, Cr) format, the R component, G component, and B component of the first color feature and the second color feature can be determined according to formula (3).
Figure PCTCN2019070660-appb-000012
Figure PCTCN2019070660-appb-000012
在公式(3)中,R、G、B分别为R分量、G分量以及B分量,Y为亮度,Cb和Cr分别为色彩特征的两个分量。In formula (3), R, G, and B are the R component, the G component, and the B component, Y is the brightness, and Cb and Cr are the two components of the color feature, respectively.
具体地,如果第一色彩特征和第二色彩特征的格式为(Pb,Pr)格式,则可根据公式(4)确定第一色彩特征和第二色彩特征的R分量、G分量以及B分量。Specifically, if the format of the first color feature and the second color feature is the (Pb, Pr) format, the R component, G component, and B component of the first color feature and the second color feature can be determined according to formula (4).
Figure PCTCN2019070660-appb-000013
Figure PCTCN2019070660-appb-000013
在公式(4)中,R、G、B分别为R分量、G分量以及B分量,Y为亮度,Pb和Pr分别为色彩特征的两个分量。In formula (4), R, G, and B are the R component, the G component, and the B component, Y is the brightness, and Pb and Pr are the two components of the color feature, respectively.
不限于这里的描述,当用其他的格式表示色彩特征时,均可以根据该其他的格式对应的分量与R分量、G分量、B分量之间的转换关系将其他格式的色彩特征转换为(R/G,B/G)格式的色彩特征后再确定白平衡增益。Not limited to the description here, when the color characteristics are expressed in other formats, the color characteristics in other formats can be converted to (R according to the conversion relationship between the component corresponding to the other format and the R component, G component, and B component /G, B/G) format and then determine the white balance gain.
第二种方式:可以根据第一色彩特征确定第二白平衡增益;根据第二色彩特征确定至少一个第三白平衡增益,然后以第一权重和和该至少一个第二标准光源的第二权重,对第二白平衡增益和该至少一个第三白平衡增益进行加权求和计算,确定第一白平衡增益。Second way: the second white balance gain can be determined according to the first color characteristic; at least one third white balance gain can be determined according to the second color characteristic, and then the second weight with the first weight and the at least one second standard light source , Performing weighted sum calculation on the second white balance gain and the at least one third white balance gain to determine the first white balance gain.
具体地,对第二白平衡增益和至少一个第三白平衡增益进行加权求和计算的公式为:第一白平衡增益=第一权重×第二白平衡增益+第二权重×第三白平衡增益。其中,第二白平衡增益为(R2-gain,G2-gain,B2-gain),第三白平衡增益为(R3-gain,G3-gain,B3-gain),即R1-gain=第一权重×R2-gain+第二权重×R3-gain,G1-gain=第一权重×G2-gain+第二权重×G3-gain,B1-gain=第一权重×B2-gain+第二权重×B3-gain。Specifically, the formula for weighted sum calculation of the second white balance gain and at least one third white balance gain is: first white balance gain=first weight×second white balance gain+second weight×third white balance Gain. Among them, the second white balance gain is (R2-gain, G2-gain, B2-gain), and the third white balance gain is (R3-gain, G3-gain, B3-gain), that is, R1-gain=first weight ×R2-gain+second weight×R3-gain, G1-gain=first weight×G2-gain+second weight×G3-gain, B1-gain=first weight×B2-gain+second weight×B3-gain.
可选地,在确定的第二标准光源的数量为多个的情况下,第二色彩特征有多个,那么,第三白平衡增益也有多个,第一白平衡增益=第一权重×第二白平衡增益+第二权重1×第三白平衡增益1+第二权重2×第三白平衡增益2+…+第二权重M×第三白平衡增益M,其中,M为第二标准光源的数量,第一权重与第二权重1、第二权重2、…、第二权重M的总和等于1或等同于1的固定常数。Optionally, when there are multiple determined second standard light sources, there are multiple second color features, then there are multiple third white balance gains, first white balance gain=first weight×th Second white balance gain + second weight 1 × third white balance gain 1 + second weight 2 × third white balance gain 2+... + second weight M × third white balance gain M, where M is the second standard The number of light sources, the sum of the first weight and the second weight 1, the second weight 2, ..., the second weight M is equal to 1 or a fixed constant equal to 1.
在一种可行的实施方式中,如果第一色彩特征与第二色彩特征的格式为(R/G,B/G)的格式,则可以确定第一色彩特征的R/G分量和B/G分量,然后根据第一色彩特征的R/G分量和B/G分量确定第二白平衡增益,其中,R2-gain可以为第一色彩特征的R/G分量的倒数,即R2-Gain=1/A2(R/G),A2(R/G)为第一色彩特征的R/G分量;G2-gain可以为1;B2-gain可以为第一色彩特征的B/G分量的倒数,即B2-gain=1/A2(B/G),A2(B/G)为第一色彩特征的B/G分量。再确定第二色彩特征的R/G分量和B/G分量,并根据第二色彩特征的R/G分量和B/G分量确定第三白平衡增益,其中,R3-gain可以为第一色彩特征的R/G分量的倒数,即R3-Gain=1/A3(R/G),A3(R/G)为第一色彩特征的B/G分量;G3-gain可以为1;B3-gain可以为第一色彩特征的B/G分量的倒数,即B3-gain=1/A3(B/G),A3(B/G)为第一色彩特征的B/G分量。In a feasible implementation manner, if the format of the first color feature and the second color feature is (R/G, B/G), the R/G component and B/G of the first color feature can be determined Component, and then determine the second white balance gain according to the R/G component and the B/G component of the first color feature, where R2-gain can be the reciprocal of the R/G component of the first color feature, ie R2-Gain=1 /A2(R/G), A2(R/G) is the R/G component of the first color feature; G2-gain can be 1; B2-gain can be the reciprocal of the B/G component of the first color feature, ie B2-gain=1/A2(B/G), A2(B/G) is the B/G component of the first color feature. Then determine the R/G component and B/G component of the second color feature, and determine the third white balance gain according to the R/G component and B/G component of the second color feature, where R3-gain can be the first color The reciprocal of the R/G component of the feature, ie R3-Gain=1/A3(R/G), A3(R/G) is the B/G component of the first color feature; G3-gain can be 1; B3-gain It may be the reciprocal of the B/G component of the first color feature, that is, B3-gain=1/A3(B/G), and A3(B/G) is the B/G component of the first color feature.
例如,第一权重与第二权重均为512,第一色彩特征的R/G分量为3,第一色彩特征的B/G分量为4,第二色彩特征只有一个,第二色彩特征的R/G分量为5,第二色彩特征的B/G分量为6,则确定R2-gain为1/3,G1-gain为1,B2-gain为1/4,R3-gain为1/5,G1-gain为1,B1-gain为1/6,进而确定R1-gain为230.4,G1-gain为1024,B1-gain为213.3。For example, the first weight and the second weight are both 512, the R/G component of the first color feature is 3, the B/G component of the first color feature is 4, there is only one second color feature, and the R of the second color feature /G component is 5, B/G component of the second color feature is 6, then it is determined that R2-gain is 1/3, G1-gain is 1, B2-gain is 1/4, R3-gain is 1/5, G1-gain is 1, B1-gain is 1/6, and it is further determined that R1-gain is 230.4, G1-gain is 1024, and B1-gain is 213.3.
在另一种可行的实施方式中,如果第一色彩特征与第二色彩特征的格式不为(R/G,B/G)的格式,则可以根据第一色彩特征将第一色彩特征转换为格式为(R/G,B/G)的色彩特征F1,再根据色彩特征F1确定第二白平衡增益;根据第二色彩特征将第二色彩特征转换为格式为(R/G,B/G)的色彩特征F2,再根据色彩特征F2确定第三白平衡增益。其中,根据第一色彩特征将第一色彩特征转换为格式为(R/G,B/G)的色彩特征F1、根据第二色彩特征将第二色彩特征转换为(R/G,B/G)的色彩特征F2、根据色彩特征F1确定第二白平衡增益以及根据色彩特征F2确定第三白平衡增益的方式可参考前述描述,这里不再赘述。In another feasible implementation manner, if the format of the first color feature and the second color feature is not the format of (R/G, B/G), the first color feature can be converted to Color feature F1 in the format (R/G, B/G), and then determine the second white balance gain according to the color feature F1; convert the second color feature into the format (R/G, B/G according to the second color feature ) Color characteristic F2, and then determine the third white balance gain according to the color characteristic F2. Wherein, according to the first color feature, the first color feature is converted into a color feature in the format (R/G, B/G) F1, and according to the second color feature, the second color feature is converted into (R/G, B/G ) For the color feature F2, the method for determining the second white balance gain according to the color feature F1, and the method for determining the third white balance gain according to the color feature F2, reference may be made to the foregoing description, and details are not repeated here.
对于上述步骤S104,可以将第一白平衡增益对应的R通道、G通道、B通道三个通道的增益分别与第一图像中的每个像素对应的R分量、G分量以及B分量相乘,将三个通道的增益与每个像素的R分量、G分量以及B分量相乘得到的R分量、G分量以及B分量作为每个像素的R分量、G分量以及B分量,以得到第二图像,即第二图像中的每个像素的R分量等于第一图像中的该像素的R分量与R1-gain之积,第二图像中的每个像素的G分量等于第一图像中的该像素的G分量与G1-gain之积,第二图像中的每个像素的B分量等于第一图像中的该像素的B分量与B1-gain之积。For the above step S104, the gains of the R channel, G channel, and B channel corresponding to the first white balance gain may be multiplied by the R component, G component, and B component corresponding to each pixel in the first image, The R component, G component, and B component obtained by multiplying the gains of the three channels and the R component, G component, and B component of each pixel are taken as the R component, G component, and B component of each pixel to obtain a second image , That is, the R component of each pixel in the second image is equal to the product of the R component and R1-gain of the pixel in the first image, and the G component of each pixel in the second image is equal to the pixel in the first image The product of the G component and G1-gain, the B component of each pixel in the second image is equal to the product of the B component of the pixel in the first image and B1-gain.
结合上述描述可知,在图1对应的实施例中,将第一图像中多个图像块各自对应的多个色彩特征划分为与光源标定点的距离较近的近色彩特征和与光源标定点的距离较远的远色彩特征,与光源标定点的距离较近的近色彩特征对应的图像的内容为白色物体的可能性较大,与光源标定点的距离较远的远色彩特征对应的图像的内容不为白色物体的可能性较大,分别根据近色彩特征确定第一标准光源和根据远色彩特征确定至少一个第二标准光源,相当于是分别根据白色物体和非白色物体分别确定多个标准光源,然后根据多个标准光源的颜色特征确定图像的白平衡增益,并利用该白平衡增益对图像进行修正,在确定白平衡增益时,同时结合了根据白色物体和非白色物体确定的环境光源的颜色,由于并不是完全参考白色物体确定环境光源的颜色,即使在图像中没有白色物体的情况下,也可以根据非白色物体确定环境光源,并根据环境光源的颜色对图像进行修正,从而保证了修正得到的图像的颜色可以接近于真实情况。It can be seen from the above description that, in the embodiment corresponding to FIG. 1, the multiple color features corresponding to the multiple image blocks in the first image are divided into near-color features closer to the light source calibration point and close to the light source calibration point. For far-distance color features that are farther away, the content of the image corresponding to the near-color feature that is closer to the light source calibration point is more likely to be a white object, and for the image that corresponds to the far-color features that are farther away from the light source calibration point It is more likely that the content is not a white object, and the first standard light source is determined according to the near color feature and the at least one second standard light source is determined according to the far color feature, which is equivalent to determining multiple standard light sources respectively based on the white object and the non-white object , And then determine the white balance gain of the image based on the color characteristics of multiple standard light sources, and use the white balance gain to correct the image. When determining the white balance gain, it combines the ambient light source determined by the white object and the non-white object. Color, because the color of the ambient light source is not completely referenced to the white object, even if there is no white object in the image, the ambient light source can be determined according to the non-white object, and the image can be corrected according to the color of the ambient light source, thereby ensuring The color of the corrected image can be close to the real situation.
在一些可能的实现方式中,可以通过线性回归的方式确定近色彩特征和远色彩特征的变化规律,以确定上述至少一个近色彩特征和至少一个远色彩特征的趋势与发展,从而确定匹配于该至少一个近色彩特征和该至少一个远色彩特征的趋势发展的光源标定点,以下进行具体介绍。In some possible implementations, the change rule of the near-color feature and the far-color feature can be determined by linear regression to determine the trend and development of the at least one near-color feature and the at least one far-color feature, so as to determine the match to the The light source calibration points of the trend development of at least one near color feature and the at least one far color feature will be described in detail below.
参见图3,图3是本申请实施例提供的根据远色彩特征确定第二标准光源的流程示意图,如图所示,该流程包括如下步骤:S301,在色彩平面上对第一图像对应的至少一个远 色彩特征进行划分,以得到至少一个远色彩特征群。S302,确定至少一个远色彩特征对应的亮度和至少一个光源标定点对应的亮度。S303,根据至少一个远色彩特征对应的亮度和至少一个光源标定点对应的亮度,将至少一个远色彩特征特征和至少一个光源标定点映射至亮度色彩空间。S304,在亮度色彩空间中分别对至少一个远色彩特征群进行线性回归,得到至少一个远色彩特征群对应的至少一个回归平面。S305,根据至少一个远色彩特征群对应的至少一个回归平面,确定至少一个第二标准光源。Referring to FIG. 3, FIG. 3 is a schematic diagram of a process for determining a second standard light source according to far-color characteristics provided by an embodiment of the present application. As shown in the figure, the process includes the following steps: S301, corresponding to at least at least one first image on a color plane A far-color feature is divided to obtain at least one far-color feature group. S302: Determine the brightness corresponding to at least one distant color feature and the brightness corresponding to at least one light source calibration point. S303: Map at least one far color feature feature and at least one light source calibration point to a brightness color space according to the brightness corresponding to at least one far color feature and the brightness corresponding to at least one light source calibration point. S304: Perform linear regression on at least one far-color feature group in the luminance color space to obtain at least one regression plane corresponding to at least one far-color feature group. S305: Determine at least one second standard light source according to at least one regression plane corresponding to at least one distant color feature group.
对于上述步骤S301,可以根据各个远色彩特征相互之间在色彩平面上的距离对第一图像对应的远色彩特征进行划分,以将第一图像对应的远色彩特征划分为一个或多个远色彩特征群。其中,每个远色彩特征群包括的远色彩特征的数量大于或等于第一数量,并且,每个远色彩特征群中的任一远色彩特征与该远色彩特征群中其他至少一个远色彩特征在色彩平面上的距离小于第二距离阈值。具体地,如果在该至少一个远色彩特征中,存在一种远色彩特征集合,该远色彩特征集合中的任一远色彩特征与该远色彩特征集合中其他至少一个远色彩特征在色彩平面上的距离小于第二距离阈值,并且,该远色彩特征集合中的远色彩特征的数量大于或等于第一数量,则该远色彩特征集合为远色彩特征群;如果在该至少一个远色彩特征中,存在另一种远色彩特征集合,该远色彩特征集合中的任一远色彩特征与该远色彩特征集合中其他至少一个远色彩特征在色彩平面上的距离小于第二距离阈值,并且,该远色彩特征集合中的远色彩特征的数量小于第一数量,则确定该远色彩特征集合中的远色彩特征为噪声,该远色彩特征集合中的远色彩特征不用于确定第二标准光源。For the above step S301, the far color features corresponding to the first image may be divided according to the distance between the respective far color features on the color plane to divide the far color features corresponding to the first image into one or more far colors Feature group. The number of far color features included in each far color feature group is greater than or equal to the first number, and any far color feature in each far color feature group and at least one other far color feature in the far color feature group The distance on the color plane is less than the second distance threshold. Specifically, if there is a set of far color features in the at least one far color feature, any far color feature in the far color feature set and at least one other far color feature in the far color feature set are on the color plane Is less than the second distance threshold, and the number of far color features in the far color feature set is greater than or equal to the first number, the far color feature set is a far color feature group; if in the at least one far color feature , There is another far-color feature set, the distance between any far-color feature in the far-color feature set and at least one other far-color feature in the far-color feature set on the color plane is less than the second distance threshold, and, If the number of far color features in the far color feature set is less than the first number, it is determined that the far color features in the far color feature set are noise, and the far color features in the far color feature set are not used to determine the second standard light source.
这里,第二距离阈值为用于衡量两个远色彩特征是否属于同一个远色彩特征集合的远色彩特征的距离。如果两个远色彩特征之间的距离大于该第二距离阈值,则确定该两个远色彩特征属于不同的远色彩特征集合。如果两个远色彩特征之间的距离小于或等于该第二距离阈值,则确定该两个远色彩特征属于同一远色彩特征集合。第二距离阈值可以与前述介绍的各个光源标定点对应的第一距离阈值相关联,例如,各个光源标定点对应的第一距离阈值均为第二光源标定点与第三光源标定点在该色彩平面中的距离的1.2倍,第二距离阈值可以为第二光源标定点与第三光源标定点在该色彩平面中的距离的0.05倍,即第二距离阈值为各个光源标定点对应的第一距离阈值的1/24。第二距离阈值也可以与前述介绍的各个光源标定点对应的第一距离阈值为相对独立的距离阈值。Here, the second distance threshold is the distance used to measure whether two far color features belong to the same far color feature set. If the distance between the two far color features is greater than the second distance threshold, it is determined that the two far color features belong to different sets of far color features. If the distance between the two far color features is less than or equal to the second distance threshold, it is determined that the two far color features belong to the same set of far color features. The second distance threshold may be associated with the first distance threshold corresponding to each light source calibration point described above, for example, the first distance threshold corresponding to each light source calibration point is both the second light source calibration point and the third light source calibration point in the color 1.2 times the distance in the plane, the second distance threshold can be 0.05 times the distance between the second light source calibration point and the third light source calibration point in the color plane, that is, the second distance threshold is the first corresponding to each light source calibration point 1/24 of the distance threshold. The second distance threshold may also be a relatively independent distance threshold corresponding to the first distance threshold corresponding to each light source calibration point described above.
这里,第一数量为用于衡量远色彩特征集合中的远色彩特征是否能够形成远色彩特征群的基准。如果远色彩特征集合中的远色彩特征的数量小于第一数量,则确定远色彩特征集合中的远色彩特征不能形成远色彩特征群。如果远色彩特征集合中的远色彩特征的数量大于或等于第一数量,则确定该远色彩特征集合中的远色彩特征的可以形成远色彩特征群。第一数量可以为大于或等于2的数值,例如,第一数量可以为5。Here, the first number is a reference for measuring whether the far-color features in the far-color feature set can form a far-color feature group. If the number of far color features in the far color feature set is less than the first number, it is determined that the far color features in the far color feature set cannot form a far color feature group. If the number of far color features in the far color feature set is greater than or equal to the first number, it is determined that the far color features in the far color feature set may form a far color feature group. The first number may be a value greater than or equal to 2, for example, the first number may be 5.
具体实现中,可分别确定各个远色彩特征的两个分量,根据各个远色彩特征的两个分量确定各个远色彩特征两两之间的距离,再将各个远色彩特征两两之间的距离与第二距离阈值进行比较,以确定各个远色彩特征是否属于同一个远色彩特征集合,并确定每个远色彩特征集合中的远色彩特征的数量是否大于或等于第一数量,以确定远色彩特征集合中的远色彩特征能否形成群。其中,可按照以下公式(5)确定各个远色彩特征两两之间的距离。In specific implementation, the two components of each far color feature can be determined separately, and the distance between each far color feature can be determined according to the two components of each far color feature, and then the distance between each far color feature can be determined The second distance threshold is compared to determine whether each far color feature belongs to the same far color feature set, and to determine whether the number of far color features in each far color feature set is greater than or equal to the first number to determine the far color feature Can the distant color features in the collection form a group. Among them, the distance between each distant color feature can be determined according to the following formula (5).
Figure PCTCN2019070660-appb-000014
Figure PCTCN2019070660-appb-000014
在公式(5)中,X3和Y3分别为两个远色彩特征中的其中一个远色彩特征对应的两个分量,Y4和Y4分别为两个远色彩特征中的另一个远色彩特征对应的两个分量。In formula (5), X3 and Y3 are the two components corresponding to one of the two far-color features, and Y4 and Y4 are the two components corresponding to the other far-color feature. Component.
对于上述步骤S302,在一种可行的实施方式中,如果第一图像对应的色彩特征的格式为(R/G,B/G)格式,则可以按照公式Y=0.299×R+0.587×G+0.114×B,确定该至少一个远色彩特征对应的亮度,并在该至少一个远色彩特征对应的亮度中确定数值最大的亮度,将该数值最大的亮度与第一系数的乘积确定为该至少一个光源标定点中的各个光源标定点对应的亮度。For the above step S302, in a feasible implementation manner, if the format of the color feature corresponding to the first image is the (R/G, B/G) format, then the formula Y=0.299×R+0.587×G+ 0.114×B, determining the brightness corresponding to the at least one far color feature, and determining the brightness with the largest value among the brightness corresponding to the at least one far color feature, and determining the product of the brightness with the largest value and the first coefficient as the at least one The brightness corresponding to each light source calibration point in the light source calibration point.
例如,第一图像对应的至少一个色彩特征为远色彩特征1~远色彩特征5,第一系数为1,其中,远色彩特征1的R、G、B分量分别为1、2、1;远色彩特征2的R、G、B分量分别为2、3、2;远色彩特征3的R、G、B分量分别为3、4、3;远色彩特征4的R、G、B分量分别为4、5、4;远色彩特征5的R、G、B分量分别为5、6、5。则可以确定远色彩特征1对应的亮度为1.587,远色彩特征2对应的亮度为2.587,远色彩特征3对应的亮度为3.587,远色彩特征4对应的亮度为4.587,远色彩特征对应的亮度为5.587,将数值最大的亮度与第一系数的乘积确定各个光源标定点对应的亮度,即将5.587确定为该至少一个光源标定点中的各个光源标定点对应的亮度。For example, at least one color feature corresponding to the first image is far color feature 1 to far color feature 5, and the first coefficient is 1, wherein the R, G, and B components of far color feature 1 are 1, 2, and 1, respectively; The R, G, and B components of color feature 2 are 2, 3, and 2; the R, G, and B components of far color feature 3 are 3, 4, and 3; the R, G, and B components of far color feature 4 are: 4, 5, 4; The R, G, and B components of the far color feature 5 are 5, 6, and 5, respectively. Then it can be determined that the brightness corresponding to the far color feature 1 is 1.587, the brightness corresponding to the far color feature 2 is 2.587, the brightness corresponding to the far color feature 3 is 3.587, the brightness corresponding to the far color feature 4 is 4.587, and the brightness corresponding to the far color feature is 5.587: Determine the brightness corresponding to each light source calibration point by multiplying the product of the brightness with the largest value and the first coefficient, that is, determine 5.587 as the brightness corresponding to each light source calibration point in the at least one light source calibration point.
对于上述步骤S302,在另一种可行的实施方式中,如果第一图像对应的色彩特征的格式不为(R/G,B/G)格式,则可以将在确定该至少一个远色彩特征所对应的两个分量的同时确定的亮度分别确定为该至少一个色彩特征对应的亮度,然后在该至少一个远色彩特征对应的亮度中确定数值最大的亮度,将该数值最大的亮度与第一系数和乘积确定为该至少一个光源标定点中的各个光源标定点对应的亮度。For the above step S302, in another feasible implementation manner, if the format of the color feature corresponding to the first image is not the (R/G, B/G) format, it may be determined that the at least one far color feature The simultaneously determined brightnesses of the corresponding two components are respectively determined as the brightnesses corresponding to the at least one color feature, and then the brightness with the largest value is determined among the brightnesses corresponding to the at least one far color feature, and the brightness with the largest value and the first coefficient The sum product is determined as the brightness corresponding to each light source calibration point in the at least one light source calibration point.
这里,请参考前述对亮度色彩空间的描述,上述步骤S303和步骤S304中涉及的亮度色彩空间为以色彩特征对应的格式对应的两个分量作为其中两个维度,并以色彩特征对应的亮度作为第三个维度形成的三维空间。Here, please refer to the foregoing description of the luminance color space. The luminance color space involved in the above steps S303 and S304 is the two components corresponding to the format corresponding to the color feature as two of the dimensions, and the brightness corresponding to the color feature as The three-dimensional space formed by the third dimension.
对于上述步骤S303,根据至少一个远色彩特征对应的亮度和至少一个光源标定点对应的亮度,将至少一个远色彩特征和至少一个光源标定点映射至亮度色彩空间可以理解为结合各个远色彩特征和各个光源标定点各自对应的两个分量以及各个远色彩特征和各个光源标定点各自对应的亮度,得到各个远色彩特征和各个光源标定点对应的三维数据。例如,远色彩特征对应的两个分量分别为1/2,1/2,远色彩特征对应的亮度为1.587,则远色彩特征对应的三维数据为(1/2,1/2,1.587)。进一步地,还可以理解为将各个远色彩特征和各个光源标定点对应的三维数据以点的形式标示在亮度色彩三维空间,即在亮度色彩空间中,该至少一个远色彩特征和该至少一个光源标定点以点的形式存在与该亮度色彩空间中,该亮度色彩空间中的点对应的三个数值分别为各个色彩特征的两个分量的数值和各个色彩特征对应的亮度的数值。For the above step S303, mapping at least one far color feature and at least one light source calibration point to the brightness color space according to the brightness corresponding to at least one far color feature and the brightness corresponding to at least one light source calibration point can be understood as combining each far color feature and The two components corresponding to each light source calibration point and the brightness corresponding to each far color feature and each light source calibration point respectively obtain three-dimensional data corresponding to each far color feature and each light source calibration point. For example, the two components corresponding to the far color feature are 1/2, 1/2, and the brightness corresponding to the far color feature is 1.587, then the three-dimensional data corresponding to the far color feature is (1/2, 1/2, 1.587). Further, it can also be understood that the three-dimensional data corresponding to each far-color feature and each light source calibration point are marked in the form of dots in the three-dimensional space of luma color, that is, in the luma color space, the at least one far-color feature and the at least one light source The calibration points exist in the form of points in the brightness color space, and the three values corresponding to the points in the brightness color space are the values of the two components of each color feature and the value of the brightness corresponding to each color feature.
示例性地,将色彩特征对应的三维数据以点的形式标示在亮度色彩空间的示意图可以参见图4。图4是本申请实施例提供的色彩平面中的色彩特征与亮度色彩空间中的三维数据的映射示意图。在图4的A中,各个色彩特征以点的形式标示在色彩平面上,色彩特征 分别为色彩特征1~色彩特征5,色彩特征1~色彩特征5的R、G、B分量,色彩特征1~5对应的亮度以及光源标定点对应的亮度如前述介绍步骤S302所述,将A所示的各个色彩特征对应的三维数据以点的形式标示在亮度色彩空间后如图4中的B所示,色彩平面中的一个点对应亮度色彩空间的一个点。Exemplarily, for a schematic diagram of marking the three-dimensional data corresponding to the color features in the form of dots in the luminance color space, see FIG. 4. FIG. 4 is a schematic diagram of mapping between color features in a color plane and three-dimensional data in a luminance color space provided by an embodiment of the present application. In A of FIG. 4, each color feature is marked on the color plane in the form of dots. The color features are color feature 1 to color feature 5, R, G, and B components of color feature 1 to color feature 5, and color feature 1. The brightness corresponding to ~5 and the brightness corresponding to the calibration point of the light source are as described in step S302 in the foregoing introduction, and the three-dimensional data corresponding to the color features shown in A are marked in dots in the brightness color space as shown in B in FIG. 4 , A point in the color plane corresponds to a point in the luminance color space.
对于上述步骤S304,在一种可行的实施方式中,可以预先建立多元线性回归模型,然后以该至少一个远色彩特征群中的各个远色彩特征群中的各个远色彩特征对应的三维数据分别作为数据样本,基于最小二乘法使得基于多元回归线性模型求得的数据与实际数据之间误差的平方和最小,将该平方和最小时多元回归线性模型的参数作为各个远色彩特征群对应的归回平面的对应的回归方程的参数,然后分别根据各个回归平面对应的回归方程确定各个回归平面。在另一种可行的实施方式中,也可以通过一阶自回归的方法对该至少一个远色彩特征群中的各个远色彩特征群进行线性回归,得到各个远色彩特征群对应的回归平面,从而得到至少一个远色彩特征群对应的至少一个回归平面。具体采用何种方式对各个远色彩特征群进行线性回归,得到回归平面,本申请实施例不做限制。For the above step S304, in a feasible implementation manner, a multiple linear regression model may be established in advance, and then the three-dimensional data corresponding to each distant color feature in each distant color feature group in the at least one distant color feature group are used as Data samples, based on least squares, minimize the sum of squared errors between the data obtained from the multiple regression linear model and the actual data, and use the parameters of the multiple regression linear model as the return plane corresponding to each distant color feature group when the squared sum is minimum Parameters of the corresponding regression equation, and then determine each regression plane according to the regression equation corresponding to each regression plane. In another feasible implementation manner, linear regression can also be performed on each of the at least one distant color feature group by using a first-order autoregressive method to obtain a regression plane corresponding to each distant color feature group, thereby At least one regression plane corresponding to at least one distant color feature group is obtained. The method used to perform linear regression on each distant color feature group to obtain a regression plane is not limited in the embodiment of the present application.
示例性地,各个远色彩特征群对应的回归平面的示意图可以参见图5,图5是本申请实施例提供的在色彩亮度空间中对各个远色彩特征群进行线性回归得到回归平面的示意图。在图5中,远色彩特征被分为远色彩特征群1和远色彩特征群2,如图5中的A所示,经过线性回归后,远色彩特征群1对应回归平面1,远色彩特征群2对应回归平面2,回归平面1和回归平面2如图5中的B所示。Exemplarily, for a schematic diagram of the regression plane corresponding to each far-color feature group, refer to FIG. 5. FIG. 5 is a schematic diagram of performing linear regression on each far-color feature group in a color brightness space according to an embodiment of the present application to obtain a regression plane. In FIG. 5, the far color features are divided into far color feature group 1 and far color feature group 2, as shown in A in FIG. 5, after linear regression, far color feature group 1 corresponds to regression plane 1, far color feature Group 2 corresponds to regression plane 2, and regression plane 1 and regression plane 2 are shown as B in FIG. 5.
对于上述步骤S305,根据各个远色彩特征群对应的回归平面确定第二标准光源的数量可以有一个或多个。For the above step S305, it is determined that there may be one or more second standard light sources according to the regression plane corresponding to each distant color feature group.
其中,可以在各个远色彩特征群对应的回归平面中确定可靠度高的回归平面作为指向平面,可靠度用于反映指向平面对应的物体的颜色趋势发展趋近于标准光源的颜色的可能性,然后根据指向平面确定一个或多个标准光源,其中,可以从以下三个方面评估回归平面的可靠度:1)如果回归平面距离任一光源标定点越近,则回归平面的可靠度越高,那么该回归平面越可成为指向平面;2)如果回归平面与色彩平面的夹角越接近于90度,则回归平面的可靠度越高,那么该回归平面越可成为指向平面;3)如果回归平面中包含的远色彩特征的数量越多,则回归平面的可靠度越高,那么该回归平面越可成为指向平面。Among them, the regression plane corresponding to each distant color feature group can be determined as a pointing plane with high reliability, and the reliability is used to reflect the possibility that the color trend of the object corresponding to the pointing plane develops closer to the color of the standard light source, Then determine one or more standard light sources according to the pointing plane, where the reliability of the regression plane can be evaluated from the following three aspects: 1) If the regression plane is closer to the calibration point of any light source, the reliability of the regression plane is higher, Then the more the regression plane can become the pointing plane; 2) If the angle between the regression plane and the color plane is closer to 90 degrees, the higher the reliability of the regression plane, the more the regression plane can become the pointing plane; 3) If the regression plane The greater the number of far-color features included in the plane, the higher the reliability of the regression plane, and the more the regression plane can become the pointing plane.
在一种可行的实施方式中,可分别用三个参数分别作为上述三个方面对应的量化值,则可以分别确定各个回归平面对应的第一参数、第二参数以及第三参数,其中,各个回归平面对应的第一参数分别用于指示各个回归平面中的色彩特征对应的颜色接近于任一标定光源点的颜色的概率,该概率反映了该回归平面对应的远色彩特征群所对应的图像的颜色与第一标准光源的颜色相同的可能性,该第一标准光源指该至少一个光源标定点对应的标准光源中最有可能为该回归平面对应的远色彩特征群所对应的图像的环境光源的标准光源。第二参数用于指示各个回归平面相对于色彩平面(这里指色彩特征的两个分量所对应的平面)的倾斜程度,第三参数用于指示回归平面对应的图像在第一图像中的面积占比;然后分别根据各个回归平面对应的第一参数、第二参数以及第三参数,确定各个回归平面的可靠度;将可靠度处于前N位的回归平面确定为至少一个指向平面,N为大于或等于1的正 整数;将至少一个第一光源标定点对应的标准光源确定为第二标准光源,该至少一个第一光源标定点为在亮度色彩空间中分别与该至少一个指向平面的距离最小的光源标定点。通过分别从三个方面对回归平面进行评估,可以找到颜色的发展趋势相对更趋近于环境光源的颜色的指向平面,与指向平面接近的光源标定点的颜色相对更接近于环境光源的颜色,根据与指向平面最近的光源标定点,可预测环境光源的颜色。In a feasible implementation manner, three parameters may be used as the quantization values corresponding to the above three aspects, respectively, and the first parameter, the second parameter, and the third parameter corresponding to each regression plane may be determined separately. The first parameters corresponding to the regression plane are used to indicate the probability that the color corresponding to the color feature in each regression plane is close to the color of any calibrated light source point, and the probability reflects the image corresponding to the far color feature group corresponding to the regression plane Is the same as the color of the first standard light source. The first standard light source refers to the environment most likely to be the image corresponding to the far color feature group corresponding to the regression plane among the standard light sources corresponding to the at least one light source calibration point Standard light source. The second parameter is used to indicate the degree of tilt of each regression plane relative to the color plane (here, the plane corresponding to the two components of the color feature), and the third parameter is used to indicate the area of the image corresponding to the regression plane in the first image. Ratio; then determine the reliability of each regression plane according to the first, second and third parameters corresponding to each regression plane; determine the regression plane whose reliability is in the top N positions as at least one pointing plane, N is greater than Or a positive integer equal to 1; the standard light source corresponding to at least one first light source calibration point is determined as the second standard light source, and the at least one first light source calibration point is the smallest distance from the at least one pointing plane in the luminance color space, respectively Calibration point of the light source. By evaluating the regression plane from three aspects respectively, you can find the pointing plane where the color development trend is relatively closer to the color of the ambient light source, and the color of the calibration point of the light source close to the pointing plane is relatively closer to the color of the ambient light source. According to the calibration point of the light source closest to the pointing plane, the color of the ambient light source can be predicted.
具体地,在N为1的情况下,确定的第一光源标定点的数量为一个,相应地,确定的第二标准光源的数量也为一个。在N大于1的情况下,确定的第一光源标定点的数量为多个,相应地,确定的第二标准光源的数量也为多个。即,第一光源标定点与第二标准光源的数量等于N。Specifically, when N is 1, the number of the determined first light source calibration point is one, and accordingly, the number of the determined second standard light source is also one. In the case where N is greater than 1, the determined number of first light source calibration points is multiple, and accordingly, the determined number of second standard light sources is also multiple. That is, the number of the first light source calibration point and the second standard light source is equal to N.
在一些可能的实施方式中,根据上述三个方面对回归平面的影响程度,可以分别为第一参数、第二参数以及第三参数赋予不同的权重,然后根据第一参数的权重、第二参数的权重、第三参数的权重,分别对各个回归平面对应的第一参数、第二参数以及第三参数进行加权求和计算,以分别确定各个回归平面的可靠度。这里,对一个回归平面对应的第一参数、第二参数以及第三参数进行加权求和计算的公式可以为:可靠度=参数权重1×第一参数+参数权重2×第二参数+参数权重3×第三参数。其中,参数权重1、参数权重2以及参数权重3分别为第一参数的权重、第二参数的权重以及第三参数的权重。其中,参数权重1、参数权重2以及参数权重3的总和为1或等同于1的固定常数。例如,参数权重1、参数权重2以及参数权重3的总和为1024。具体实现中,可以通过多次实验的方式确定第一参数、第二参数以及第三参数的权重,其中,可根据在不同的权重下对图像进行处理得到的图像的颜色与图像的真实颜色之间的差距,调整第一参数、第二参数以及第三参数的权重,以得到图像的颜色接近于图像的真实颜色时第一参数、第二参数以及第三参数各自的权重,将其分别确定为第一参数、第二参数以及第三参数的权重。In some possible implementations, according to the degree of influence of the above three aspects on the regression plane, different weights may be given to the first parameter, the second parameter, and the third parameter respectively, and then according to the weight of the first parameter, the second parameter The weight of and the weight of the third parameter are respectively calculated by weighting and summing the first parameter, the second parameter, and the third parameter corresponding to each regression plane to determine the reliability of each regression plane. Here, the formula for weighted sum calculation of the first parameter, the second parameter, and the third parameter corresponding to a regression plane may be: reliability = parameter weight 1 × first parameter + parameter weight 2 × second parameter + parameter weight 3× third parameter. The parameter weight 1, the parameter weight 2 and the parameter weight 3 are the weight of the first parameter, the weight of the second parameter and the weight of the third parameter, respectively. Among them, the sum of the parameter weight 1, the parameter weight 2 and the parameter weight 3 is 1 or a fixed constant equivalent to 1. For example, the sum of parameter weight 1, parameter weight 2, and parameter weight 3 is 1024. In a specific implementation, the weights of the first parameter, the second parameter, and the third parameter may be determined through multiple experiments, where the color of the image obtained by processing the image under different weights and the true color of the image The gap between them, adjust the weights of the first parameter, the second parameter and the third parameter to obtain the weights of the first parameter, the second parameter and the third parameter when the color of the image is close to the true color of the image, and determine them respectively It is the weight of the first parameter, the second parameter and the third parameter.
为了便于统一衡量各个回归平面的可靠度,各个回归平面对应的第一参数、第二参数以及第三参数可以为统一数值标准所对应的参数,即第一参数、第二参数以及第三参数对应的参数范围相同。在一种具体实现方式中,第一参数、第二参数以及第三参数对应的参数范围可以为0至1。在第一参数、第二参数以及第三参数的参数范围为0至1的情况下,第一参数可以为d1,d1=D/d min,其中,D可以为前述介绍的第一距离阈值与预设倍数之商,d min可以为各个光源标定点与回归平面的距离中的最小距离,d min越小,第一参数越大,回归平面越可成为指向平面;第二参数可以为d2,d2=θ/90,其中,θ为回归平面与色彩平面的锐夹角(指回归平面与色彩平面所形成的两个夹角中为锐角的夹角),θ越大,说明回归平面相对于色彩平面越垂直,回归平面越可成为指向平面;第三参数可以为d3,d3=p/t,其中,p为回归平面中的远色彩特征的数量,t为各个回归平面中的远色彩特征的数量的总和。在可选的实现方式中,第一参数、第二参数以及第三参数对应的参数范围也可以不为0至1,例如,第一参数、第二参数以及第三参数对应的参数范围也可以为1至10,本申请实施例不做限制。 In order to facilitate the uniform measurement of the reliability of each regression plane, the first parameter, second parameter, and third parameter corresponding to each regression plane may be the parameters corresponding to the unified numerical standard, that is, the first parameter, second parameter, and third parameter correspond to Has the same parameter range. In a specific implementation, the parameter range corresponding to the first parameter, the second parameter, and the third parameter may be 0 to 1. In the case where the parameter range of the first parameter, the second parameter, and the third parameter is 0 to 1, the first parameter may be d1, d1=D/d min , where D may be the first distance threshold and The quotient of the preset multiple, d min can be the minimum distance between the calibration point of each light source and the regression plane. The smaller d min , the larger the first parameter, the more the regression plane can become the pointing plane; the second parameter can be d2, d2=θ/90, where θ is the acute angle between the regression plane and the color plane (refers to the angle between the regression plane and the color plane which is the acute angle), the greater the θ, the regression plane is relative to The more vertical the color plane, the more the regression plane can become the pointing plane; the third parameter can be d3, d3 = p/t, where p is the number of far-color features in the regression plane, and t is the far-color features in each regression plane The sum of the number. In an optional implementation manner, the parameter range corresponding to the first parameter, the second parameter, and the third parameter may not be 0 to 1, for example, the parameter range corresponding to the first parameter, the second parameter, and the third parameter may also be From 1 to 10, the embodiments of the present application are not limited.
举例来对根据各个远色彩特征群对应的回归平面确定第二标准光源进行说明。For example, the determination of the second standard light source according to the regression plane corresponding to each distant color feature group will be described.
假设光源标定点有3个,分别为光源标定点1~光源标定点3,远色彩特征群的数量为5个,则回归平面的数量为5个,回归平面分别为回归平面1~回归平面5,其中,回归平 面1与光源标定点1的距离为0.005,回归平面1与光源标定点2的距离为0.002,回归平面1与光源标定点3的距离为0.004,回归平面1中的远色彩特征的数量为500,回归平面1与色彩平面的锐夹角为63度;回归平面2与光源标定点1的距离为0.003,回归平面2与光源标定点2的距离为0.002,回归平面2与光源标定点3的距离为0.006,回归平面2中的远色彩特征的数量为300,回归平面2与色彩平面的锐夹角为54度;回归平面3与光源标定点1的距离为0.002,回归平面3与光源标定点2的距离为0.007,回归平面3与光源标定点3的距离为0.004,回归平面3中的远色彩特征的数量为400,回归平面3与色彩平面的锐夹角为45度;回归平面4与光源标定点1的距离为0.008,回归平面4与光源标定点2的距离为0.004,回归平面4与光源标定点3的距离为0.009,回归平面4中的远色彩特征的数量为800,回归平面4与色彩平面的锐夹角为72度;回归平面5与光源标定点1的距离为0.01,回归平面5与光源标定点2的距离为0.02,回归平面5与光源标定点3的距离为0.005,回归平面5中的远色彩特征的数量为750,回归平面5与色彩平面的锐夹角为36度。假设第一距离阈值为0.2,预设倍数为200。第一参数的权重为384,第二参数的权重为512,第三参数的权重为128。N=1。Suppose there are 3 light source calibration points, namely light source calibration point 1 to light source calibration point 3, and the number of distant color feature groups is 5, then the number of regression planes is 5, and the regression planes are respectively regression plane 1 to regression plane 5 , Where the distance between regression plane 1 and light source calibration point 1 is 0.005, the distance between regression plane 1 and light source calibration point 2 is 0.002, the distance between regression plane 1 and light source calibration point 3 is 0.004, and the far color feature in regression plane 1 The number is 500, the acute angle between the regression plane 1 and the color plane is 63 degrees; the distance between the regression plane 2 and the light source calibration point 1 is 0.003, the distance between the regression plane 2 and the light source calibration point 2 is 0.002, and the regression plane 2 and the light source The distance of calibration point 3 is 0.006, the number of far-color features in regression plane 2 is 300, the acute angle between regression plane 2 and the color plane is 54 degrees; the distance between regression plane 3 and light source calibration point 1 is 0.002, and the regression plane The distance between 3 and the light source calibration point 2 is 0.007, the distance between the regression plane 3 and the light source calibration point 3 is 0.004, the number of distant color features in the regression plane 3 is 400, and the sharp angle between the regression plane 3 and the color plane is 45 degrees ; The distance between the regression plane 4 and the light source calibration point 1 is 0.008, the distance between the regression plane 4 and the light source calibration point 2 is 0.004, the distance between the regression plane 4 and the light source calibration point 3 is 0.009, and the number of far color features in the regression plane 4 Is 800, the sharp angle between the regression plane 4 and the color plane is 72 degrees; the distance between the regression plane 5 and the light source calibration point 1 is 0.01, the distance between the regression plane 5 and the light source calibration point 2 is 0.02, and the regression plane 5 and the light source calibration point The distance of 3 is 0.005, the number of distant color features in the regression plane 5 is 750, and the acute angle between the regression plane 5 and the color plane is 36 degrees. Assume that the first distance threshold is 0.2 and the preset multiple is 200. The weight of the first parameter is 384, the weight of the second parameter is 512, and the weight of the third parameter is 128. N=1.
确定第二标准光源的过程如下:The process of determining the second standard light source is as follows:
1、确定回归平面1~回归平面5的第一参数:回归平面1的第一参数为(0.2/200)/0.002=1/2;回归平面2的第一参数为(0.2/200)/0.002=1/2;回归平面3的第一参数为(0.2/200)/0.002=1/2;回归平面4的第一参数为(0.2/200)/0.004=1/4;回归平面5的第一参数为(0.2/200)/0.005=1/5。1. Determine the first parameters of regression plane 1 to regression plane 5: the first parameter of regression plane 1 is (0.2/200)/0.002=1/2; the first parameter of regression plane 2 is (0.2/200)/0.002 =1/2; the first parameter of regression plane 3 is (0.2/200)/0.002=1/2; the first parameter of regression plane 4 is (0.2/200)/0.004=1/4; the first parameter of regression plane 5 One parameter is (0.2/200)/0.005=1/5.
2、确定回归平面1~回归平面5的第二参数:回归平面1的第二参数为63/90=0.7;回归平面2的第二参数为54/90=0.6;回归平面3的第二参数为45/90=0.5;回归平面4的第二参数为72/90=0.8;回归平面5的第二参数为36/90=0.4。2. Determine the second parameters of regression plane 1 to regression plane 5: the second parameter of regression plane 1 is 63/90 = 0.7; the second parameter of regression plane 2 is 54/90 = 0.6; the second parameter of regression plane 3 45/90=0.5; the second parameter of the regression plane 4 is 72/90=0.8; the second parameter of the regression plane 5 is 36/90=0.4.
3、确定回归平面1~回归平面5的第三参数:各个回归平面的远色彩特征的数量的总和为500+300+400+800+750=2750,则回归平面1的第三参数为500/2750=10/55;回归平面2的第三参数为300/2750=6/55;回归平面3的第三参数为400/2750=8/55;回归平面4的第三参数为800/2750=16/55;回归平面5的第三参数为750/2750=15/55。3. Determine the third parameter of regression plane 1 to regression plane 5: the sum of the number of distant color features of each regression plane is 500+300+400+800+750=2750, then the third parameter of regression plane 1 is 500/ 2750=10/55; the third parameter of regression plane 2 is 300/2750=6/55; the third parameter of regression plane 3 is 400/2750=8/55; the third parameter of regression plane 4 is 800/2750= 16/55; the third parameter of the regression plane 5 is 750/2750=15/55.
4、确定回归平面1~回归平面5的可靠度:4. Determine the reliability of regression plane 1 to regression plane 5:
回归平面1的可靠度为384×1/2+512×0.7+128×10/55=573.67;The reliability of the regression plane 1 is 384×1/2+512×0.7+128×10/55=573.67;
回归平面2的可靠度为384×1/2+512×0.6+128×6/55=513.16;The reliability of the regression plane 2 is 384×1/2+512×0.6+128×6/55=513.16;
回归平面3的可靠度为384×1/2+512×0.5+128×8/55=446.62;The reliability of the regression plane 3 is 384×1/2+512×0.5+128×8/55=446.62;
回归平面4的可靠度为384×1/4+512×0.8+128×16/55=542.83;The reliability of the regression plane 4 is 384×1/4+512×0.8+128×16/55=542.83;
回归平面5的可靠度为384×1/5+512×0.4+128×15/55=316.5。The reliability of the regression plane 5 is 384×1/5+512×0.4+128×15/55=316.5.
5、将回归平面1确定为指向平面,将光源标定点2对应的标准光源确定为第二标准光源。5. Determine the regression plane 1 as the pointing plane, and determine the standard light source corresponding to the light source calibration point 2 as the second standard light source.
可选地,如果N为3,则可以将回归平面1、回归平面4以及回归平面2均确定为指向平面,与回归平面1、回归平面4以及回归平面2最近的光源标定点均为光源标定点2,进一步则将光源标定点2对应的标准光源确定为第二标准光源。Alternatively, if N is 3, the regression plane 1, the regression plane 4 and the regression plane 2 can be determined as pointing planes, and the light source calibration points closest to the regression plane 1, the regression plane 4 and the regression plane 2 are all the light source calibration points Fix point 2, and further determine the standard light source corresponding to the light source calibration point 2 as the second standard light source.
结合上述描述可知,在图3对应的实施例中,通过将远色彩特征划分为一个或多个远 色彩特征群,可以将第一图像中颜色相近的物体对应的色彩特征划分在一起,对每个色彩特征群进行线性归回归得到每个色彩特征群对应的回归平面,通过回归平面可以确定第一图像中颜色相近的物体的颜色的发展趋势,根据线性归回平面确定指向平面可确定颜色发展趋势趋近于标准光源的颜色所对应的平面,与指向平面最近的光源标定点的颜色相对更接近于环境光源的颜色,根据与指向平面最近的光源标定点,可预测环境光源的颜色,从而确定颜色不为白色的物体所对应的环境光源。It can be seen from the above description that, in the embodiment corresponding to FIG. 3, by dividing the far color features into one or more far color feature groups, the color features corresponding to the objects with similar colors in the first image can be divided together. The linear regression of each color feature group is used to obtain the regression plane corresponding to each color feature group. Through the regression plane, the color development trend of objects with similar colors in the first image can be determined, and the direction of the color development trend can be determined according to the linear return plane. The plane corresponding to the color of the standard light source is closer to the color of the calibration point of the light source closest to the plane. According to the calibration point of the light source closest to the plane, the color of the environmental light source can be predicted to determine Ambient light source corresponding to objects whose color is not white.
可选地,在一种可行的实施方式中,还可以参考上述步骤S301~S302的具体实现方式确定第一标准光源,其中,将步骤S301~S302中的远色彩特征替换为近色彩特征即可确定近色彩特征对应的标准光源,根据近色彩特征确定的标准光源即为第一标准光源。在另一些实施方式中,也可以参考其他以图像中的白色物体或颜色接近于白色的物体呈现中的色彩特征为参考确定标准光源的方法确定第一标准光源,例如,可以根据各个近色彩特征计算近色彩特征的均值,将该均值确定为第一标准光源的色彩特征。对于具体采用何种方式根据近色彩特征确定第一标准光源,本申请实施例不做限制。Optionally, in a feasible implementation manner, the first standard light source may also be determined by referring to the specific implementation manners of steps S301 to S302 above, wherein the far color features in steps S301 to S302 may be replaced with near color features The standard light source corresponding to the near color feature is determined, and the standard light source determined according to the near color feature is the first standard light source. In some other embodiments, the first standard light source may be determined by referring to the method of determining the standard light source by referring to the color feature in the white object in the image or the object with a color close to white, for example, according to each near-color feature Calculate the average value of the near color features, and determine the average value as the color feature of the first standard light source. The method for determining the first standard light source according to the near-color characteristics in a specific manner is not limited in the embodiments of the present application.
可选地,在根据上述图3对应的实施例确定出至少一个指向平面后,还可以根据该至少一个指向平面的相关情况确定该至少一个指向平面对应的标准光源的权重。在一种可行的实施方式中,可以确定该至少一个指向平面中的各个指向平面对应的第一可靠度、第二可靠度以及第三可靠度,其中,第一可靠度为各个指向平面对应的第一参数,第二可靠度为各个指向平面对应的第二参数,第三可靠度为第二数量与第三数量的比值,第二数量为该至少一个远色彩特征的总数量,第三数量为第一图像对应的多个色彩特征的总数量;然后根据各个指向平面对应的第一可靠度、第二可靠度以及第三可靠度确定该至少一个标准光源中各个第二标准光源的第二权重;最后根据各个第二标准光源的第二权重确定第一标准光源的第一权重。这里,第一权重等于1或等同于1的固定常数减去第二权重。Optionally, after the at least one pointing plane is determined according to the embodiment corresponding to FIG. 3, the weight of the standard light source corresponding to the at least one pointing plane may also be determined according to the relevant situation of the at least one pointing plane. In a feasible implementation manner, the first reliability, the second reliability, and the third reliability corresponding to each of the at least one pointing plane may be determined, where the first reliability is corresponding to each pointing plane The first parameter, the second reliability is the second parameter corresponding to each pointing plane, the third reliability is the ratio of the second quantity to the third quantity, the second quantity is the total quantity of the at least one distant color feature, the third quantity Is the total number of multiple color features corresponding to the first image; then the second of each second standard light source among the at least one standard light source is determined according to the first reliability, the second reliability, and the third reliability corresponding to the respective pointing planes Weights; finally determine the first weight of the first standard light source according to the second weight of each second standard light source. Here, the first weight is equal to 1 or a fixed constant equivalent to 1 minus the second weight.
在一种可能的实施方式中,根据第一可靠度、第二可靠度以及第三可靠度的重要程度,可以分别为第一可靠度、第二可靠度以及第三可靠度赋予不同的权重,然后根据第一可靠度的权重、第二可靠度的权重以及第三可靠度的权重,分别对第一可靠度、第二可靠度以及第三可靠度进行加权求和计算,以确定各个指向平面对应的权重,然后将各个指向平面对应的权重分别确定为各个指向平面对应的标准光源的第二权重。其中,在多个指向平面对应同一个标准光源的情况下,可以将根据可靠度最高的指向平面所确定的权重作为该多个指向平面对应的标准光源的第二权重。这里,指向平面对应的权重的计算公式可以为:指向平面对应的权重=可靠度权重1×第一可靠度+可靠度权重2×第二可靠度+可靠度权重3×第三可靠度。其中,可靠度权重1、可靠度权重2以及可靠度权重3分别为第一可靠度的权重、第二可靠度的权重以及第三可靠度权重。可靠度权重1、可靠度权重2以及可靠度权重3的总和为1或等同于1的固定常数。例如,可靠度权重1、可靠度权重2以及可靠度权重3的总和为1024。具体实现中,可以通过多次实验的方式确定第一可靠度、第二可靠度以及第三可靠度的权重,其中,可根据在不同的权重下对图像进行处理得到的图像的颜色与图像的真实颜色之间的差距,调整第一可靠度、第二可靠度以及第三可靠度的权重,以得到图像的颜色接近于图像的真实颜色时第一可靠度、第二可靠度以及第三可靠度 各自的权重,将其分别确定为第一可靠度、第二可靠度以及第三可靠度的权重。In a possible implementation manner, according to the importance levels of the first reliability, the second reliability, and the third reliability, different weights may be given to the first reliability, the second reliability, and the third reliability, respectively. Then, according to the weight of the first reliability, the weight of the second reliability, and the weight of the third reliability, the first reliability, the second reliability, and the third reliability are respectively weighted and calculated to determine each pointing plane Corresponding weights, and then determine the weights corresponding to the respective pointing planes as the second weights of the standard light sources corresponding to the respective pointing planes. Wherein, when multiple pointing planes correspond to the same standard light source, the weight determined according to the most reliable pointing plane can be used as the second weight of the standard light sources corresponding to the multiple pointing planes. Here, the calculation formula of the weight corresponding to the pointing plane may be: weight corresponding to the pointing plane=reliability weight 1×first reliability+reliability weight 2×second reliability+reliability weight 3×third reliability. Among them, the reliability weight 1, the reliability weight 2 and the reliability weight 3 are respectively the weight of the first reliability, the weight of the second reliability and the third reliability. The sum of reliability weight 1, reliability weight 2, and reliability weight 3 is 1 or a fixed constant equivalent to 1. For example, the sum of reliability weight 1, reliability weight 2, and reliability weight 3 is 1024. In a specific implementation, the weights of the first reliability, the second reliability, and the third reliability can be determined through multiple experiments, in which the color of the image obtained by processing the image under different weights and the image The difference between the true colors, adjust the weights of the first reliability, the second reliability and the third reliability to get the first reliability, the second reliability and the third reliability when the color of the image is close to the true color of the image The respective weights of the degrees are determined as the weights of the first reliability, the second reliability, and the third reliability, respectively.
这里,在分别为第一可靠度、第二可靠度以及第三可靠度赋予不同的权重的情况下,如果第二标准光源的数量为一个,则第二权重有一个,第二权重与第一权重的总和等于第一可靠度的权重、第二可靠度的权重以及第三可靠度的总和;如果第二标准光源的数量为多个,则第二权重有多个,第二权重与第一权重的总和等于N与第一可靠度的权重、第二可靠度的权重以及第三可靠度的权重的总和的乘积,N为第二标准光源的数量。Here, when different weights are given to the first reliability, the second reliability, and the third reliability, respectively, if the number of second standard light sources is one, there is one second weight, and the second weight is different from the first The sum of the weights is equal to the sum of the weight of the first reliability, the weight of the second reliability, and the sum of the third reliability; if there are multiple second standard light sources, there are multiple second weights, the second weight and the first The sum of the weights is equal to the product of N and the sum of the weight of the first reliability, the weight of the second reliability, and the weight of the third reliability, where N is the number of second standard light sources.
通过从三个方面并结合不同的权重对根据远色彩特征确定的标准光源进行可靠度分析,可以确定根据远色彩特征确定的标准光源的可能性和根据近色彩特征确定的标准光源的可能性,进而结合两种光源的可能性确定环境光源。By performing reliability analysis on the standard light source determined according to the far color feature from three aspects and combining different weights, the possibility of the standard light source determined according to the far color feature and the standard light source determined according to the near color feature can be determined. Furthermore, the possibility of two light sources is combined to determine the ambient light source.
在上述介绍的方案中,在根据第一图像对应的色彩特征确定第一白平衡增益并根据第一白平衡增益对第一图像进行白平衡处理,以完成对第一图像的修正之前,还可以确定第一图像对应的色彩特征。In the solution introduced above, before determining the first white balance gain according to the color characteristics corresponding to the first image and performing the white balance processing on the first image according to the first white balance gain to complete the correction of the first image, it may be Determine the color features corresponding to the first image.
在一种可行的实施方式中,可以对第一图像进行图像分割,得到多个图像块;然后分别确定多个图像块中的各个图像块对应的色彩特征;最后根据各个图像块对应的色彩特征形成色彩平面。In a feasible implementation manner, the first image can be image segmented to obtain multiple image blocks; then the color features corresponding to each image block in the multiple image blocks are separately determined; and finally, the color features corresponding to each image block Form a color plane.
具体地,每个图像块包括至少一个像素。在对第一图像进行图像分割时,可以将图像分割为n×m个图像块,n与m的取值可取决于第一图像的像素。例如,第一图像的像素为512×512像素,则可以将图像分割为512×512个图像块,即将第一图像的每个像素对应的图像作为一个图像块,也可以将图像分给为256×256个图像块,即将4个像素对应的图像作为一个图像块。可选地,n目标与m的取值可以取决于其他的与第一图像有关的因素,n与m的具体取值可根据实际情况确定。Specifically, each image block includes at least one pixel. When performing image segmentation on the first image, the image may be divided into n×m image blocks, and the values of n and m may depend on the pixels of the first image. For example, if the pixels of the first image are 512×512 pixels, the image can be divided into 512×512 image blocks, that is, the image corresponding to each pixel of the first image can be used as an image block, or the image can be divided into 256 ×256 image blocks, that is, images corresponding to 4 pixels are used as one image block. Optionally, the values of n target and m may depend on other factors related to the first image, and the specific values of n and m may be determined according to actual conditions.
这里,确定图像块对应的色彩特征是指确定图像块中的所有像素的两个分量的均值,该两个分量为色彩特征的两个分量。如果色彩特征的格式为(R/G,B/G)格式,则确定图像块对应的色彩特征是指确定图像块中的所有像素对应的R/G分量的均值和所有像素对应的B/G分量的均值。如果色彩特征的格式为(U,V)格式,则确定图像块对应的色彩特征是指确定图像块中的所有像素对应的U分量的均值和所有像素对应的V分量的均值。如果色彩特征的格式为(Cb,Cr)格式,则确定图像块对应的色彩特征是指确定图像块中的所有像素对应的Cb分量的均值和所有像素对应的Cr分量的均值。如果色彩特征的格式为(Pb,Pr)格式,则确定图像块对应的色彩特征是指图像块中的所有像素对应的Pb分量的均值和所有像素对应的Pr分量的均值。具体实现中,如果图像块包括一个像素,则图像块的色彩特征为该一个像素对应的两个分量。如果图像块包括多个像素,则可以分别确定图像块中的各个像素对应的两个分量,将各个像素对应的两个分量分别求和后求均值,则可确定图像块对应的色彩特征。Here, determining the color feature corresponding to the image block refers to determining the average value of two components of all pixels in the image block, the two components being the two components of the color feature. If the format of the color feature is (R/G, B/G) format, then determining the color feature corresponding to the image block refers to determining the average value of the R/G components corresponding to all pixels in the image block and the B/G corresponding to all pixels The mean of the components. If the format of the color feature is the (U, V) format, determining the color feature corresponding to the image block refers to determining the average value of the U component corresponding to all pixels in the image block and the average value of the V component corresponding to all pixels. If the format of the color feature is the (Cb, Cr) format, determining the color feature corresponding to the image block refers to determining the average value of the Cb component corresponding to all pixels in the image block and the average value of the Cr component corresponding to all pixels. If the format of the color feature is (Pb, Pr) format, it is determined that the color feature corresponding to the image block refers to the average value of the Pb component corresponding to all pixels in the image block and the average value of the Pr component corresponding to all pixels. In a specific implementation, if the image block includes one pixel, the color characteristics of the image block are two components corresponding to the one pixel. If the image block includes multiple pixels, the two components corresponding to each pixel in the image block can be determined separately, and the two components corresponding to each pixel can be summed and then averaged to determine the color features corresponding to the image block.
以下举例对确定第一图像对应的色彩特征进行说明。参见图6,图6是本申请实施例提供的图像中的像素颜色分布示意图。假设图6所示的图像为第一图像,第一图像包括36个像素,每个像素的R分量、G分量以及B分量如图6所示,假设将第一图像划分为2×3个图像块,一个图像块包括2×3个像素,色彩特征的格式为(R/G,B/G),则确定第一图 像对应的色彩特征的过程为:The following describes, by way of example, the determination of color features corresponding to the first image. Referring to FIG. 6, FIG. 6 is a schematic diagram of pixel color distribution in an image provided by an embodiment of the present application. Assuming that the image shown in FIG. 6 is the first image, the first image includes 36 pixels, and the R component, G component, and B component of each pixel are as shown in FIG. 6, assuming that the first image is divided into 2×3 images Block, an image block includes 2×3 pixels, and the color feature format is (R/G, B/G), then the process of determining the color feature corresponding to the first image is:
1、确定图像块1的色彩特征:图像块1中的所有像素的R分量的均值为(30+31+34+35+38+39)/6=34.5,图像块1中的所有像素的G分量的均值为(40+41+44+45+48+49)/6=44.5,图像块1中的所有像素的B分量的均值为(50+51+54+55+58+59)/6=54.5,图像块1的R/G分量为34.5/44.5,图像块的B/G分量为54.5/44.5;1. Determine the color characteristics of image block 1: the average value of the R components of all pixels in image block 1 is (30+31+34+35+38+39)/6=34.5, and the G of all pixels in image block 1 The average value of the components is (40+41+44+45+48+49)/6=44.5, and the average value of the B component of all pixels in image block 1 is (50+51+54+55+58+59)/6 = 54.5, the R/G component of image block 1 is 34.5/44.5, and the B/G component of image block is 54.5/44.5;
2、确定图像块2的色彩特征:图像块2中的所有像素的R分量的均值为(32+33+36+37+40+41)/6=36.5,图像块2中的所有像素的G分量的均值为(42+43+46+47+50+51)/6=46.5,图像块2中的所有像素的B分量的均值为(52+53+56+57+60+61)/6=56.5,图像块2的R/G分量为36.5/46.5,图像块的B/G分量为56.5/46.5;2. Determine the color characteristics of image block 2: the average value of the R components of all pixels in image block 2 is (32+33+36+37+40+41)/6=36.5, and the G of all pixels in image block 2 The average value of the components is (42+43+46+47+50+51)/6=46.5, and the average value of the B component of all pixels in image block 2 is (52+53+56+57+60+61)/6 = 56.5, the R/G component of image block 2 is 36.5/46.5, and the B/G component of image block is 56.5/46.5;
3、确定图像块3的色彩特征:图像块3中的所有像素的R分量的均值为(42+43+46+47+50+51)/6=46.5,图像块3中的所有像素的G分量的均值为(52+53+56+57+60+61)/6=56.5,图像块3中的所有像素的B分量的均值为(62+63+66+67+70+71)/6=66.5,图像块3的R/G分量为46.5/56.5,图像块的B/G分量为66.5/56.5;3. Determine the color characteristics of image block 3: the average value of the R components of all pixels in image block 3 is (42+43+46+47+50+51)/6=46.5, and the G of all pixels in image block 3 The average value of the components is (52+53+56+57+60+61)/6=56.5, and the average value of the B component of all pixels in image block 3 is (62+63+66+67+70+71)/6 = 66.5, the R/G component of image block 3 is 46.5/56.5, and the B/G component of image block is 66.5/56.5;
4、确定图像块4的色彩特征:图像块4中的所有像素的R分量的均值为(44+45+48+49+52+53)/6=48.5,图像块4中的所有像素的G分量的均值为(54+55+58+59+62+63)/6=58.5,图像块4中的所有像素的B分量的均值为(64+65+68+69+72+73)/6=68.5,图像块4的R/G分量为48.5/58.5,图像块的B/G分量为68.5/58.5;4. Determine the color characteristics of image block 4: the average value of the R components of all pixels in image block 4 is (44+45+48+49+52+53)/6=48.5, and the G of all pixels in image block 4 The average value of the components is (54+55+58+59+62+63)/6=58.5, and the average value of the B component of all pixels in image block 4 is (64+65+68+69+72+73)/6 = 68.5, the R/G component of image block 4 is 48.5/58.5, and the B/G component of image block is 68.5/58.5;
5、确定图像块5的色彩特征:图像块5中的所有像素的R分量的均值为(54+55+58+59+62+63)/6=58.5,图像块5中的所有像素的G分量的均值为(64+65+68+69+72+73)/6=68.5,图像块5中的所有像素的B分量的均值为(74+75+78+79+82+83)/6=78.5,图像块5的R/G分量为58.5/68.5,图像块的B/G分量为78.5/68.5;5. Determine the color characteristics of image block 5: The average value of the R components of all pixels in image block 5 is (54+55+58+59+62+63)/6=58.5, and the G of all pixels in image block 5 The average value of the components is (64+65+68+69+72+73)/6=68.5, and the average value of the B component of all pixels in image block 5 is (74+75+78+79+82+83)/6 = 78.5, the R/G component of image block 5 is 58.5/68.5, and the B/G component of image block is 78.5/68.5;
6、确定图像块6的色彩特征:图像块6中的所有像素的R分量的均值为(56+57+60+61+64+65)/6=60.5,图像块6中的所有像素的G分量的均值为(66+67+70+71+74+75)/6=70.5,图像块6中的所有像素的B分量的均值为(76+77+80+81+84+85)/6=80.5,图像块6的R/G分量为60.5/70.5,图像块的B/G分量为80.5/70.5;6. Determine the color characteristics of image block 6: The average value of the R components of all pixels in image block 6 is (56+57+60+61+64+65)/6=60.5, and the G of all pixels in image block 6 The average value of the components is (66+67+70+71+74+75)/6=70.5, and the average value of the B component of all pixels in image block 6 is (76+77+80+81+84+85)/6 = 80.5, the R/G component of image block 6 is 60.5/70.5, and the B/G component of image block is 80.5/70.5;
7、根据1-6,确定图6中的图像对应的色彩特征为(34.5/44.5,54.5/44.5),(36.5/46.5,56.5/46.5),(66.5,66.5/56.5),(48.5/58.5,68.5/58.5),(58.5/68.5,78.5/68.5),(60.5/70.5,图像块的B/G分量为80.5/70.5)。7. According to 1-6, determine the corresponding color features of the image in Figure 6 as (34.5/44.5, 54.5/44.5), (36.5/46.5, 56.5/46.5), (66.5, 66.5/56.5), (48.5/58.5 , 68.5/58.5), (58.5/68.5, 78.5/68.5), (60.5/70.5, the B/G component of the image block is 80.5/70.5).
这里,将第一图像对应的多个色彩特征以及光源标定点表示在二维坐标平面中,可得到色彩平面。Here, a plurality of color features and light source calibration points corresponding to the first image are represented in a two-dimensional coordinate plane, and a color plane can be obtained.
通过对第一图像进行分割处理和色彩特征化,可以确定第一图像对应的多个色彩特征和得到色彩平面,进而可以根据第一图像对应的色彩特征在色彩平面中的分布情况预测环 境光源。By performing segmentation processing and color characterization on the first image, multiple color features corresponding to the first image can be determined and a color plane can be obtained, and then the environmental light source can be predicted according to the distribution of the color features corresponding to the first image in the color plane.
上述对本申请实施例的方法进行了介绍,接下来对本申请实施例的装置。The method of the embodiment of the present application is introduced above, and then the device of the embodiment of the present application is described.
参见图7,图7是本申请实施例提供的一种图像的白平衡处理装置的结构示意图,该装置可以为前述介绍的具有拍摄功能的设备、电脑、服务器等设备上,如图7所示,该装置700包括数据划分模块701、光源确定模块702、增益模块703以及处理模块704,其中:数据划分模块701,用于将第一图像中多个图像块各自对应的多个色彩特征划分为至少一个近色彩特征和至少一个远色彩特征,每个近色彩特征在色彩平面中与至少一个光源标定点中的一个或多个光源标定点的距离小于或等于该一个或多个光源标定点各自对应的第一距离阈值,每个远色彩特征在色彩平面中与该至少一个光源标定点中的每个光源标定点的距离分别大于每个光源标定点各自对应的第一距离阈值,该色彩平面是反映色彩特征的二维平面且包括该多个色彩特征和该至少一个光源标定点,每个光源标定点反映一标准光源的色彩特征;光源确定模块702,用于根据至少一个近色彩特征确定第一标准光源,并根据至少一个远色彩特征确定至少一个第二标准光源;增益确定模块703,用于根据第一标准光源的第一色彩特征和至少一个第二标准光源的第二色彩特征,确定第一白平衡增益;处理模块704,用于根据第一白平衡增益对第一图像进行白平衡处理,以得到第二图像。这里,有关于色彩特征、色彩平面、近色彩特征、远色彩特征、光源标定点的描述,可参考图1所示方法实施例的相关描述。Referring to FIG. 7, FIG. 7 is a schematic structural diagram of an image white balance processing device provided by an embodiment of the present application. The device may be the previously described device with a shooting function, a computer, a server, etc., as shown in FIG. 7. The device 700 includes a data division module 701, a light source determination module 702, a gain module 703, and a processing module 704, wherein: the data division module 701 is used to divide the multiple color features corresponding to each image block in the first image into At least one near-color feature and at least one far-color feature, each near-color feature in a color plane having a distance from one or more light source calibration points in at least one light source calibration point less than or equal to the one or more light source calibration points Corresponding to the first distance threshold, the distance of each far color feature in the color plane from each light source calibration point in the at least one light source calibration point is respectively greater than the first distance threshold corresponding to each light source calibration point, the color plane It is a two-dimensional plane reflecting color features and includes the plurality of color features and the at least one light source calibration point, each light source calibration point reflects the color features of a standard light source; the light source determining module 702 is used to determine according to at least one near color feature A first standard light source, and determining at least one second standard light source according to at least one far color characteristic; a gain determination module 703, configured to use the first color characteristic of the first standard light source and the second color characteristic of at least one second standard light source, The first white balance gain is determined; the processing module 704 is configured to perform white balance processing on the first image according to the first white balance gain to obtain the second image. Here, for the description of the color feature, color plane, near color feature, far color feature, and light source calibration point, reference may be made to the related description of the method embodiment shown in FIG. 1.
数据划分模块701可用于执行图1所示方法实施例中的步骤S101,光源确定模块702可用于执行图1所示方法实施例中的步骤S102或图3所示方法实施例中的步骤S301~S304,,增益确定模块703可用于执行图1所示方法实施例中的步骤S103,处理模块可用于执行图1所示方法实施例中的步骤S104,具体可参考图1所示方法实施例或图3所示方法实施例的描述,在此不再赘述。The data division module 701 can be used to perform step S101 in the method embodiment shown in FIG. 1, and the light source determination module 702 can be used to perform step S102 in the method embodiment shown in FIG. 1 or step S301 in the method embodiment shown in FIG. 3. S304,, the gain determination module 703 can be used to perform step S103 in the method embodiment shown in FIG. 1, and the processing module can be used to perform step S104 in the method embodiment shown in FIG. 1, for details, refer to the method embodiment shown in FIG. 1 or The description of the method embodiment shown in FIG. 3 will not be repeated here.
可选地,该装置700还可包括图像分割模块705、数据确定模块706以及色彩平面形成模块707,其中,图像分割模块705用于对第一图像进行图像分割,得到多个图像块;数据确定模块706用于分别确定多个图像块中的各个图像块对应的色彩特征,;色彩平面形成模块707,用于根据各个图像块对应的色彩特征形成色彩平面。具体可参考图6对应的相关描述,在此不再赘述。Optionally, the device 700 may further include an image segmentation module 705, a data determination module 706, and a color plane forming module 707, where the image segmentation module 705 is used to perform image segmentation on the first image to obtain multiple image blocks; data determination The module 706 is used to determine the color features corresponding to each image block in the plurality of image blocks, respectively; the color plane forming module 707 is used to form a color plane according to the color features corresponding to each image block. For details, reference may be made to the relevant description corresponding to FIG. 6, and details are not described herein again.
以上模块的任一个可以软件、硬件或二者结合来实现。当以上任一模块以软件实现的时候,所述软件以计算机程序指令的方式存在,并被存储在存储器中,处理器可以用于执行所述程序指令以实现以上方法流程。所述处理器可以包括但不限于以下至少一种:中央处理单元(central processing unit,CPU)、微处理器、数字信号处理器(DSP)、微控制器(microcontroller unit,MCU)、或人工智能处理器等各类运行软件的计算设备,每种计算设备可包括一个或多个用于执行软件指令以进行运算或处理的核。该处理器可以是个单独的半导体芯片,也可以跟其他电路一起集成为一个半导体芯片,例如,可以跟其他电路(如编解码电路、硬件加速电路或各种总线和接口电路)构成一个SoC(片上系统),或者也可以作为一个ASIC的内置处理器集成在所述ASIC当中,该集成了处理器的ASIC可以单独封装或者也可以跟其他电路封装在一起。该处理器除了包括用于执行软件指令以进行运算 或处理的核外,还可进一步包括必要的硬件加速器,如现场可编程门阵列(field programmable gate array,FPGA)、PLD(可编程逻辑器件)、或者实现专用逻辑运算的逻辑电路。当以上模块或单元以硬件实现的时候,该硬件可以是CPU、微处理器、DSP、MCU、人工智能处理器、ASIC、SoC、FPGA、PLD、专用数字电路、硬件加速器或非集成的分立器件中的任一个或任一组合,其可以运行必要的软件或不依赖于软件以执行以上方法流程。Any of the above modules can be implemented by software, hardware, or a combination of both. When any of the above modules is implemented in software, the software exists in the form of computer program instructions and is stored in the memory, and the processor may be used to execute the program instructions to implement the above method flow. The processor may include, but is not limited to, at least one of the following: central processing unit (central processing unit, CPU), microprocessor, digital signal processor (DSP), microcontroller (microcontroller unit, MCU), or artificial intelligence Various computing devices that run software, such as processors, and each computing device may include one or more cores for executing software instructions to perform operations or processing. The processor can be a separate semiconductor chip, or it can be integrated into a semiconductor chip with other circuits. For example, it can form an SoC (on-chip) with other circuits (such as codec circuits, hardware acceleration circuits, or various bus and interface circuits). System), or may be integrated in the ASIC as a built-in processor of an ASIC, and the ASIC with integrated processor may be packaged separately or together with other circuits. In addition to the core for executing software instructions for calculation or processing, the processor may further include necessary hardware accelerators, such as field programmable gate array (FPGA), PLD (programmable logic device) Or a logic circuit that implements dedicated logic operations. When the above modules or units are implemented in hardware, the hardware may be CPU, microprocessor, DSP, MCU, artificial intelligence processor, ASIC, SoC, FPGA, PLD, dedicated digital circuit, hardware accelerator or non-integrated discrete device Any one or any combination of them can run the necessary software or do not depend on the software to perform the above method flow.
参见图8,图8是本申请实施例提供的一种图像的白平衡处理装置的结构框图,该装置可以为前述介绍的具有拍摄功能的设备、电脑、服务器等设备,如图8所示,该装置800包括:处理器801和存储器802。处理器801与存储器通过一个或多个总线连接,或者其他方式连接。Referring to FIG. 8, FIG. 8 is a structural block diagram of an image white balance processing device provided by an embodiment of the present application. The device may be the previously described device with a shooting function, a computer, a server, etc., as shown in FIG. 8, The device 800 includes a processor 801 and a memory 802. The processor 801 and the memory are connected through one or more buses, or in other ways.
存储器802与处理器801耦合,用于存储各种软件程序和/或多组指令。具体实现中,存储器802可包括高速随机存取的存储器,并且也可以包括非易失性存储器。存储器802中可以内置有操作系统,例如Android、Linux等操作系统。在一些实施例中,存储器可以为处理器801内部的存储器。在本申请实施例中,存储器802用于存储本申请方法实施例提供的图像的白平衡处理方法的实现软件程序,关于本申请提供的图像的白平衡处理方法的实现,可参考前述实施例。在可选实施例中,存储器可以存储第一图像对应的多个色彩特征、光源标定点以及前述方法实施例涉及的各种权重等。关于本申请涉及的第一图像对应的多个色彩特征、光源标定点以及前述方法实施例涉及的各种权重,请参考前述方法实施例的描述。The memory 802 is coupled to the processor 801 and is used to store various software programs and/or multiple sets of instructions. In a specific implementation, the memory 802 may include a high-speed random access memory, and may also include a non-volatile memory. An operating system may be built into the memory 802, such as Android, Linux and other operating systems. In some embodiments, the memory may be a memory inside the processor 801. In the embodiment of the present application, the memory 802 is used to store an implementation software program of the image white balance processing method provided by the method embodiment of the present application. For the implementation of the image white balance processing method provided by the present application, refer to the foregoing embodiments. In an alternative embodiment, the memory may store multiple color features corresponding to the first image, light source calibration points, various weights involved in the foregoing method embodiments, and the like. For the multiple color features, the light source calibration points corresponding to the first image involved in the present application, and the various weights involved in the foregoing method embodiments, please refer to the description of the foregoing method embodiments.
处理器801可以包括通用处理器,例如中央处理器(central processing unit,CPU),处理器801还可包括硬件芯片,上述硬件芯片可以是以下一种或多种的组合:专用集成电路(application specific integrated circuit,ASIC)、现场可编程逻辑门阵列(field programmable gate array,FPGA),复杂可编程逻辑器件(complex programmable logic device,CPLD)。本申请实施例中,处理器801可包括应用处理器(application processor,AP)和图像信号处理器(image signal processor,ISP),AP用于处理与操作系统、操作系统中的系统应用、服务应用有关的事项;ISP用于完成对与图像信号相关的处理。其中,AP和ISP可以是两个相对独立的部件,也可以集成在一个集成电路上,本申请实施例不做限制。The processor 801 may include a general-purpose processor, such as a central processing unit (CPU), and the processor 801 may also include a hardware chip, and the hardware chip may be one or a combination of the following: application specific integrated circuit (application specific) integrated circuit (ASIC), field programmable logic gate array (field programmable gate array, FPGA), complex programmable logic device (complex programmable logic device (CPLD)). In the embodiment of the present application, the processor 801 may include an application processor (application processor, AP) and an image signal processor (ISP). The AP is used to process an operating system, a system application in the operating system, and a service application. Related matters; ISP is used to complete the processing related to the image signal. Among them, AP and ISP may be two relatively independent components, or may be integrated on an integrated circuit, which is not limited in the embodiments of the present application.
本申请实施例中,AP和ISP可用于读取和执行计算机可读指令。具体的,AP和/或ISP可用于调用存储于存储器802中的程序,例如本申请的一个或多个实施例提供的图像的白平衡处理方法的实现程序,并执行该实现程序包含的指令。In the embodiments of the present application, AP and ISP can be used to read and execute computer-readable instructions. Specifically, the AP and/or ISP may be used to call a program stored in the memory 802, such as an implementation program of an image white balance processing method provided by one or more embodiments of the present application, and execute instructions contained in the implementation program.
本申请实施例中,AP和/或ISP用于根据图像对应的多个色彩特征确定图像中的物体所处的环境中的环境光源以及该环境光源对应的白平衡增益,根据该白平衡增益对图像进行白平衡处理,以使处理得到的图像中物体的颜色接近于物体真实的颜色。处理器801确定根据图像对应的多个色彩特征确定图像中的物体所处的环境中的环境光源以及该环境光源对应的白平衡增益,根据该白平衡增益对图像进行白平衡处理,以使处理得到的图像中物体的颜色接近于物体真实的颜色的具体实现可参考前述方法实施例。在一些实施例中,AP和/或ISP还用于确定图像对应的多个色彩特征等,AP和/或ISP确定图像对应的多个色彩特征的具体实现可参考前述方法实施例。In the embodiment of the present application, the AP and/or ISP are used to determine the ambient light source in the environment where the object in the image is located according to multiple color features corresponding to the image and the white balance gain corresponding to the ambient light source, according to the white balance gain pair The image is subjected to white balance processing so that the color of the object in the processed image is close to the true color of the object. The processor 801 determines the ambient light source in the environment in which the object in the image is located according to multiple color features corresponding to the image and the white balance gain corresponding to the ambient light source, and performs white balance processing on the image according to the white balance gain to enable the processing For a specific implementation of the color of the object in the obtained image close to the real color of the object, reference may be made to the foregoing method embodiments. In some embodiments, the AP and/or ISP are also used to determine multiple color features corresponding to the image, etc. For specific implementation of the AP and/or ISP determining multiple color features corresponding to the image, reference may be made to the foregoing method embodiments.
可选地,该装置800还可以包括外围系统803,外围系统803可用于实现该装置800 与用户或外部环境之间的交互功能。其中,外围系统803可包括摄像头控制器和传感器管理部件,摄像头控制器与摄像头控制器对应的外围设备(这里指摄像头)耦合,传感器管理部件与传感器管理部件对应的外围设备(这里指传感器)耦合。不限于这里的描述,外围系统还可以包括更多的外设。Optionally, the device 800 may further include a peripheral system 803, and the peripheral system 803 may be used to implement an interactive function between the device 800 and a user or an external environment. The peripheral system 803 may include a camera controller and a sensor management component. The camera controller is coupled to a peripheral device corresponding to the camera controller (here, the camera), and the sensor management component is coupled to the peripheral device corresponding to the sensor management component (here, the sensor). . Not limited to the description here, the peripheral system may also include more peripherals.
应理解的是,图8所示的图像的白平衡处理装置800仅为本申请的一种实现方式,实际应用中,图像的白平衡处理装置800可以包括更多或更少的部件,本申请不作限制。It should be understood that the image white balance processing apparatus 800 shown in FIG. 8 is only one implementation manner of the present application. In practical applications, the image white balance processing apparatus 800 may include more or fewer components. No restrictions.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机指令可以存储在计算机可读存储介质中,或者通过所述计算机可读存储介质进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是半导体介质(例如SSD)等。In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, all or part of the processes or functions according to the embodiments of the present application are generated. The computer instructions may be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device including one or more available medium integrated servers, data centers, and the like. The usable medium may be a semiconductor medium (for example, SSD) or the like.
本领域普通技术人员可以意识到,结合本申请中所公开的实施例描述的各示例的模块及方法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art may realize that the modules and method steps of the examples described in conjunction with the embodiments disclosed in this application can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in hardware or software depends on the specific application of the technical solution and design constraints. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
需说明,本申请实施例所涉及的第一、第二、第三以及各种数字编号仅为描述方便进行的区分,并不用来限制本申请实施例的范围。It should be noted that the first, second, third, and various numerical numbers involved in the embodiments of the present application are only for the convenience of description, and are not used to limit the scope of the embodiments of the present application.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above is only the specific implementation of this application, but the scope of protection of this application is not limited to this, any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in this application. It should be covered by the scope of protection of this application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (14)

  1. 一种图像的白平衡处理方法,其特征在于,包括:An image white balance processing method, characterized in that it includes:
    将第一图像中多个图像块各自对应的多个色彩特征划分为至少一个近色彩特征和至少一个远色彩特征,每个近色彩特征在色彩平面中与至少一个光源标定点中的一个或多个光源标定点的距离小于或等于所述一个或多个光源标定点各自对应的第一距离阈值,每个远色彩特征在所述色彩平面中与所述至少一个光源标定点中每个光源标定点的距离分别大于所述每个光源标定点各自对应的第一距离阈值,所述色彩平面是反映色彩特征的二维平面且包括所述多个色彩特征和所述至少一个光源标定点,每个光源标定点反映一标准光源的色彩特征;Divide multiple color features corresponding to multiple image blocks in the first image into at least one near-color feature and at least one far-color feature, each near-color feature in the color plane and one or more of at least one light source calibration point The distance of each light source calibration point is less than or equal to the first distance threshold corresponding to each of the one or more light source calibration points, each far color feature is in the color plane and each light source calibration point of the at least one light source calibration point The distances of the fixed points are respectively greater than the first distance thresholds corresponding to the calibration points of each light source. The color plane is a two-dimensional plane reflecting color features and includes the plurality of color features and the at least one light source calibration point. The calibration points of each light source reflect the color characteristics of a standard light source;
    根据所述至少一个近色彩特征确定第一标准光源,并根据所述至少一个远色彩特征确定至少一个第二标准光源;Determining a first standard light source according to the at least one near color feature, and determining at least one second standard light source according to the at least one far color feature;
    根据所述第一标准光源的第一色彩特征和所述至少一个第二标准光源的第二色彩特征,确定第一白平衡增益;Determine the first white balance gain according to the first color characteristic of the first standard light source and the second color characteristic of the at least one second standard light source;
    根据所述第一白平衡增益对所述第一图像进行白平衡处理,以得到第二图像。Perform white balance processing on the first image according to the first white balance gain to obtain a second image.
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述第一标准光源的第一色彩特征和所述至少一个第二标准光源的第二色彩特征,确定第一白平衡增益,包括:The method according to claim 1, wherein the determining the first white balance gain according to the first color characteristic of the first standard light source and the second color characteristic of the at least one second standard light source includes :
    确定所述第一标准光源的第一权重和所述至少一个第二标准光源的第二权重;Determining a first weight of the first standard light source and a second weight of the at least one second standard light source;
    以所述第一权重和所述至少一个第二标准光源的第二权重,对所述第一标准光源的第一色彩特征和所述至少一个第二标准光源的第二色彩特征进行加权求和计算,以得到融合色彩特征;Weighting and summing the first color characteristic of the first standard light source and the second color characteristic of the at least one second standard light source with the first weight and the second weight of the at least one second standard light source Calculate to get the fusion color features;
    根据所述融合色彩特征,确定所述第一白平衡增益。According to the fused color feature, the first white balance gain is determined.
  3. 根据权利要求1所述的方法,其特征在于,所述根据所述第一标准光源的第一色彩特征和所述至少一个第二标准光源的第二色彩特征,确定第一白平衡增益,包括:The method according to claim 1, wherein the determining the first white balance gain according to the first color characteristic of the first standard light source and the second color characteristic of the at least one second standard light source includes :
    根据所述第一标准光源的第一色彩特征确定第二白平衡增益;Determining a second white balance gain according to the first color characteristic of the first standard light source;
    根据所述至少一个第二标准光源的第二色彩特征确定至少一个第三白平衡增益;Determine at least one third white balance gain according to the second color characteristic of the at least one second standard light source;
    确定所述第一标准光源的第一权重和所述至少一个第二标准光源的第二权重;Determining a first weight of the first standard light source and a second weight of the at least one second standard light source;
    以所述第一权重和所述至少一个第二标准光源的第二权重,对所述第二白平衡增益和所述至少一个第三白平衡增益进行加权求和计算,以确定所述第一白平衡增益。Weighting and summing the second white balance gain and the at least one third white balance gain with the first weight and the second weight of the at least one second standard light source to determine the first White balance gain.
  4. 根据权利要求1-3任一项所述的方法,其特征在于,所述根据所述至少一个远色彩特征确定至少一个第二标准光源,包括:The method according to any one of claims 1 to 3, wherein the determining at least one second standard light source according to the at least one far color feature includes:
    在所述色彩平面上对所述至少一个远色彩特征进行划分,以得到至少一个远色彩特征群;Dividing the at least one far color feature on the color plane to obtain at least one far color feature group;
    确定所述至少一个远色彩特征对应的亮度和所述至少一个光源标定点对应的亮度;Determining the brightness corresponding to the at least one distant color feature and the brightness corresponding to the at least one light source calibration point;
    根据所述至少一个远色彩特征对应的亮度和所述至少一个光源标定点对应的亮度,将所述至少一个远色彩特征和所述至少一个光源标定点映射至亮度色彩空间,所述亮度色彩 空间为所述色彩平面与亮度维度形成的三维空间;Mapping the at least one far color feature and the at least one light source calibration point to a brightness color space according to the brightness corresponding to the at least one far color feature and the brightness corresponding to the at least one light source calibration point, the brightness color space A three-dimensional space formed by the color plane and the brightness dimension;
    在所述亮度色彩空间中分别对所述至少一个远色彩特征群进行线性回归,得到所述至少一个远色彩特征群对应的至少一个回归平面;Performing linear regression on the at least one far color feature group in the brightness color space to obtain at least one regression plane corresponding to the at least one far color feature group;
    根据所述至少一个回归平面,确定所述至少一个第二标准光源。According to the at least one regression plane, the at least one second standard light source is determined.
  5. 根据权利要求4所述的方法,其特征在于,每个远色彩特征群包括的远色彩特征的数量大于或等于第一数量,且该远色彩特征群中的任一远色彩特征与其他至少一个远色彩特征在所述色彩平面上的距离小于或等于第二距离阈值。The method according to claim 4, wherein each far color feature group includes a number of far color features greater than or equal to the first number, and any far color feature in the far color feature group and at least one other The distance of the far color feature on the color plane is less than or equal to the second distance threshold.
  6. 根据权利要求4或5所述的方法,其特征在于,所述根据所述至少一个回归平面,确定所述至少一个第二标准光源,包括:The method according to claim 4 or 5, wherein the determining the at least one second standard light source according to the at least one regression plane includes:
    分别确定各个回归平面对应的第一参数、第二参数以及第三参数,所述第一参数用于指示所述各个回归平面中的远色彩特征对应的颜色接近于任一标定光源点的颜色的概率,所述第二参数用于指示所述各个回归平面相对于所述色彩平面的倾斜程度,所述第三参数用于指示所述各个回归平面对应的图像在所述第一图像中的面积占比;Determine the first parameter, the second parameter and the third parameter corresponding to each regression plane respectively, the first parameter is used to indicate that the color corresponding to the far color feature in each regression plane is close to the color of any calibration light source point Probability, the second parameter is used to indicate the degree of tilt of each regression plane relative to the color plane, and the third parameter is used to indicate the area of the image corresponding to each regression plane in the first image Proportion
    分别根据所述各个回归平面对应的第一参数、第二参数以及第三参数,确定所述各个回归平面的可靠度;Determine the reliability of each regression plane according to the first parameter, the second parameter, and the third parameter corresponding to each regression plane, respectively;
    将可靠度处于前N位的回归平面确定为至少一个指向平面,N为大于或等于1的正整数;The regression plane whose reliability is in the top N is determined as at least one pointing plane, and N is a positive integer greater than or equal to 1;
    将至少一个第一光源标定点对应的标准光源确定为所述至少一个第二标准光源,所述至少一个第一光源标定点为在所述亮度色彩空间中分别与所述至少一个指向平面的距离最小的光源标定点。A standard light source corresponding to at least one first light source calibration point is determined as the at least one second standard light source, and the at least one first light source calibration point is a distance from the at least one pointing plane in the brightness color space, respectively The smallest light source calibration point.
  7. 一种图像的白平衡处理装置,其特征在于,包括:An image white balance processing device, characterized in that it includes:
    数据划分模块,用于将第一图像中多个图像块各自对应的多个色彩特征划分为至少一个近色彩特征和至少一个远色彩特征,每个近色彩特征在色彩平面中与至少一个光源标定点中的一个或多个光源标定点的距离小于或等于所述一个或多个光源标定点各自对应的第一距离阈值,每个远色彩特征在所述色彩平面中与所述至少一个光源标定点中每个光源标定点的距离分别大于所述每个光源标定点各自对应的第一距离阈值,所述色彩平面是反映色彩特征的二维平面且包括所述多个色彩特征和所述至少一个光源标定点,每个光源标定点反映一标准光源的色彩特征;The data dividing module is used to divide the multiple color features corresponding to the multiple image blocks in the first image into at least one near color feature and at least one far color feature, each near color feature is at least one light source mark in the color plane The distance of one or more light source calibration points in the fixed point is less than or equal to the first distance threshold corresponding to each of the one or more light source calibration points, each far color feature is in the color plane with the at least one light source target The distance of each light source calibration point in the fixed point is respectively greater than the first distance threshold corresponding to each of the light source calibration points, the color plane is a two-dimensional plane reflecting color features and includes the plurality of color features and the at least One light source calibration point, each light source calibration point reflects the color characteristics of a standard light source;
    光源确定模块,用于根据所述至少一个近色彩特征确定第一标准光源,并根据所述至少一个远色彩特征确定至少一个第二标准光源;A light source determining module, configured to determine a first standard light source according to the at least one near color feature, and determine at least one second standard light source according to the at least one far color feature;
    增益确定模块,用于根据所述第一标准光源的第一色彩特征和所述至少一个第二标准光源的第二色彩特征,确定第一白平衡增益;A gain determination module, configured to determine a first white balance gain according to the first color characteristic of the first standard light source and the second color characteristic of the at least one second standard light source;
    处理模块,用于根据所述第一白平衡增益对所述第一图像进行白平衡处理,以得到第二图像。The processing module is configured to perform white balance processing on the first image according to the first white balance gain to obtain a second image.
  8. 根据权利要求7所述的装置,其特征在于,所述增益确定模块具体用于:The apparatus according to claim 7, wherein the gain determination module is specifically configured to:
    确定所述第一标准光源的第一权重和所述至少一个第二标准光源的第二权重;Determining a first weight of the first standard light source and a second weight of the at least one second standard light source;
    以所述第一权重和所述至少一个标准光源的第二权重,对所述第一标准光源的第一色彩特征和所述至少一个第二标准光源的第二色彩特征进行加权求和计算,以得到融合色彩特征;Weighting and summing the first color characteristic of the first standard light source and the second color characteristic of the at least one second standard light source with the first weight and the second weight of the at least one standard light source, In order to get the fusion color characteristics;
    根据所述融合色彩特征,确定所述第一白平衡增益。According to the fused color feature, the first white balance gain is determined.
  9. 根据权利要求7所述的装置,其特征在于,所述增益确定模块具体用于:The apparatus according to claim 7, wherein the gain determination module is specifically configured to:
    根据所述第一标准光源的第一色彩特征确定第二白平衡增益;Determining a second white balance gain according to the first color characteristic of the first standard light source;
    根据所述至少一个第二标准光源的第二色彩特征确定至少一个第三白平衡增益;Determine at least one third white balance gain according to the second color characteristic of the at least one second standard light source;
    确定所述第一标准光源的第一权重和所述至少一个第二标准光源的第二权重;Determining a first weight of the first standard light source and a second weight of the at least one second standard light source;
    以所述第一权重和所述至少一个第二标准光源的第二权重,对所述第二白平衡增益和所述至少一个第三白平衡增益进行加权求和计算,以确定所述第一白平衡增益。Weighting and summing the second white balance gain and the at least one third white balance gain with the first weight and the second weight of the at least one second standard light source to determine the first White balance gain.
  10. 根据权利要求7-9任一项所述的装置,其特征在于,所述光源确定模块具体用于:The device according to any one of claims 7-9, wherein the light source determining module is specifically configured to:
    在所述色彩平面上对所述至少一个远色彩特征进行划分,以得到至少一个远色彩特征群;Dividing the at least one far color feature on the color plane to obtain at least one far color feature group;
    确定所述至少一个远色彩特征对应的亮度和所述至少一个光源标定点对应的亮度;Determining the brightness corresponding to the at least one distant color feature and the brightness corresponding to the at least one light source calibration point;
    根据所述至少一个远色彩特征对应的亮度和所述至少一个光源标定点对应的亮度,将所述至少一个远色彩特征和所述至少一个光源标定点映射至亮度色彩空间,所述亮度色彩空间为所述色彩平面与亮度维度形成的三维空间;Mapping the at least one far color feature and the at least one light source calibration point to a brightness color space according to the brightness corresponding to the at least one far color feature and the brightness corresponding to the at least one light source calibration point, the brightness color space A three-dimensional space formed by the color plane and the brightness dimension;
    在所述亮度色彩空间中分别对所述至少一个远色彩特征群进行线性回归,得到所述至少一个远色彩特征群对应的至少一个回归平面;Performing linear regression on the at least one far color feature group in the brightness color space to obtain at least one regression plane corresponding to the at least one far color feature group;
    根据所述至少一个回归平面,确定所述至少一个第二标准光源。According to the at least one regression plane, the at least one second standard light source is determined.
  11. 根据权利要求10所述的装置,其特征在于,每个远色彩特征群包括的远色彩特征的数量大于或等于第一数量,且该远色彩特征群中的任一远色彩特征与其他至少一个远色彩特征在所述色彩平面上的距离小于或等于第二距离阈值。The device according to claim 10, wherein each far color feature group includes a number of far color features greater than or equal to the first number, and any far color feature in the far color feature group and at least one other The distance of the far color feature on the color plane is less than or equal to the second distance threshold.
  12. 根据权利要求10或11所述的装置,其特征在于,所述光源确定模块具体用于:The device according to claim 10 or 11, wherein the light source determining module is specifically used to:
    分别确定各个回归平面对应的第一参数、第二参数以及第三参数,所述第一参数用于指示所述各个回归平面中的远色彩特征对应的颜色接近于任一标定光源点的颜色的概率,所述第二参数用于指示所述各个回归平面相对于所述色彩平面的倾斜程度,所述第三参数用于指示所述各个回归平面对应的图像在所述第一图像中的面积占比;Determine the first parameter, the second parameter and the third parameter corresponding to each regression plane respectively, the first parameter is used to indicate that the color corresponding to the far color feature in each regression plane is close to the color of any calibration light source point Probability, the second parameter is used to indicate the degree of tilt of each regression plane relative to the color plane, and the third parameter is used to indicate the area of the image corresponding to each regression plane in the first image Proportion
    分别根据所述各个回归平面对应的第一参数、第二参数以及第三参数,确定所述各个回归平面的可靠度;Determine the reliability of each regression plane according to the first parameter, the second parameter, and the third parameter corresponding to each regression plane, respectively;
    将可靠度处于前N位的回归平面确定为至少一个指向平面,N为大于或等于1的正整数;The regression plane whose reliability is in the top N is determined as at least one pointing plane, and N is a positive integer greater than or equal to 1;
    将至少一个第一光源标定点对应的标准光源确定为所述至少一个第二标准光源,所述至少一个第一光源标定点为在所述亮度色彩空间中分别与所述至少一个指向平面的距离最小的光源标定点。A standard light source corresponding to at least one first light source calibration point is determined as the at least one second standard light source, and the at least one first light source calibration point is a distance from the at least one pointing plane in the brightness color space, respectively The smallest light source calibration point.
  13. 一种图像的白平衡处理装置,其特征在于,包括存储器以及与所述存储器耦合的处理器,其中:所述存储器用于存储程序代码,所述处理器用于调用所述程序代码,执行如权利要求1-6任一项所述的图像的白平衡处理方法。An image white balance processing device, characterized in that it includes a memory and a processor coupled to the memory, wherein: the memory is used to store program code, and the processor is used to call the program code, executing The image white balance processing method according to any one of claims 1 to 6 is required.
  14. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有指令,当所述指令在计算机上运行时,使得计算机执行如权利要求1-6任一项所述的图像的白平衡处理方法。A computer-readable storage medium, characterized in that instructions are stored on the computer-readable storage medium, and when the instructions run on a computer, the computer is caused to execute the image according to any one of claims 1-6 White balance processing method.
PCT/CN2019/070660 2019-01-07 2019-01-07 White balance processing method and device for image WO2020142871A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2019/070660 WO2020142871A1 (en) 2019-01-07 2019-01-07 White balance processing method and device for image
CN201980006940.2A CN111670575B (en) 2019-01-07 2019-01-07 White balance processing method and device for image

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/070660 WO2020142871A1 (en) 2019-01-07 2019-01-07 White balance processing method and device for image

Publications (1)

Publication Number Publication Date
WO2020142871A1 true WO2020142871A1 (en) 2020-07-16

Family

ID=71521918

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/070660 WO2020142871A1 (en) 2019-01-07 2019-01-07 White balance processing method and device for image

Country Status (2)

Country Link
CN (1) CN111670575B (en)
WO (1) WO2020142871A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20210081770A1 (en) * 2019-09-17 2021-03-18 GOWN Semiconductor Corporation System architecture based on soc fpga for edge artificial intelligence computing
CN114449243A (en) * 2022-01-28 2022-05-06 青岛海信移动通信技术股份有限公司 White balance method and terminal equipment
CN114500969A (en) * 2022-01-17 2022-05-13 Oppo广东移动通信有限公司 Image processing method, image processing device, storage medium and terminal
WO2022257574A1 (en) * 2021-06-07 2022-12-15 荣耀终端有限公司 Fusion algorithm of ai automatic white balance and automatic white balance, and electronic device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101079954A (en) * 2007-06-26 2007-11-28 北京中星微电子有限公司 Method and device for realizing white balance correction
CN101166285A (en) * 2006-10-16 2008-04-23 展讯通信(上海)有限公司 Automatic white balance method and device
US20090207274A1 (en) * 2008-02-12 2009-08-20 Samsung Electronics Co., Ltd. Apparatus and method for adjusting white balance in a digital imaging device
CN107483908A (en) * 2017-09-27 2017-12-15 歌尔科技有限公司 White balance calibration method and electronic equipment
CN108377373A (en) * 2018-05-10 2018-08-07 杭州雄迈集成电路技术有限公司 A kind of color rendition device and method pixel-based
CN108462865A (en) * 2017-02-06 2018-08-28 联发科技股份有限公司 It determines the light source of image and carries out the method and apparatus of colour vision adaptation to image

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5358344B2 (en) * 2009-08-12 2013-12-04 三星テクウィン株式会社 Imaging apparatus and imaging method
JP6934240B2 (en) * 2017-03-01 2021-09-15 株式会社ブライセン Image processing device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101166285A (en) * 2006-10-16 2008-04-23 展讯通信(上海)有限公司 Automatic white balance method and device
CN101079954A (en) * 2007-06-26 2007-11-28 北京中星微电子有限公司 Method and device for realizing white balance correction
US20090207274A1 (en) * 2008-02-12 2009-08-20 Samsung Electronics Co., Ltd. Apparatus and method for adjusting white balance in a digital imaging device
CN108462865A (en) * 2017-02-06 2018-08-28 联发科技股份有限公司 It determines the light source of image and carries out the method and apparatus of colour vision adaptation to image
CN107483908A (en) * 2017-09-27 2017-12-15 歌尔科技有限公司 White balance calibration method and electronic equipment
CN108377373A (en) * 2018-05-10 2018-08-07 杭州雄迈集成电路技术有限公司 A kind of color rendition device and method pixel-based

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20210081770A1 (en) * 2019-09-17 2021-03-18 GOWN Semiconductor Corporation System architecture based on soc fpga for edge artificial intelligence computing
US11544544B2 (en) * 2019-09-17 2023-01-03 Gowin Semiconductor Corporation System architecture based on SoC FPGA for edge artificial intelligence computing
WO2022257574A1 (en) * 2021-06-07 2022-12-15 荣耀终端有限公司 Fusion algorithm of ai automatic white balance and automatic white balance, and electronic device
CN114500969A (en) * 2022-01-17 2022-05-13 Oppo广东移动通信有限公司 Image processing method, image processing device, storage medium and terminal
CN114449243A (en) * 2022-01-28 2022-05-06 青岛海信移动通信技术股份有限公司 White balance method and terminal equipment
CN114449243B (en) * 2022-01-28 2023-12-12 青岛海信移动通信技术有限公司 White balance method and terminal equipment

Also Published As

Publication number Publication date
CN111670575B (en) 2021-09-21
CN111670575A (en) 2020-09-15

Similar Documents

Publication Publication Date Title
WO2020142871A1 (en) White balance processing method and device for image
US10542243B2 (en) Method and system of light source estimation for image processing
TWI660633B (en) White balance calibration method based on skin color data and image processing apparatus thereof
CN108234971B (en) White balance parameter determines method, white balance adjustment method and device, storage medium, terminal
CN105681775A (en) White balance method and device
WO2020124374A1 (en) Image processing method, terminal device and storage medium
WO2019029573A1 (en) Image blurring method, computer-readable storage medium and computer device
CN111836029B (en) White balance adjusting method and system based on color gamut mapping and white balance terminal
US20120070082A1 (en) Color correction for digital images
WO2019227355A1 (en) Image processing method and apparatus
CN112584057B (en) Illuminance detection method and device
CN107464225A (en) Image processing method, device, computer-readable recording medium and mobile terminal
CN112492286A (en) Automatic white balance correction method, device and computer storage medium
CN114286000B (en) Image color processing method and device and electronic equipment
WO2019137396A1 (en) Image processing method and device
CN112995633B (en) Image white balance processing method and device, electronic equipment and storage medium
CN115426487A (en) Color correction matrix adjusting method and device, electronic equipment and readable storage medium
CN113793291A (en) Image fusion method and device, electronic equipment and storage medium
WO2022120799A9 (en) Image processing method and apparatus, electronic device, and storage medium
CN113473101A (en) Color correction method and device, electronic equipment and storage medium
CN114866755B (en) Automatic white balance method and device, computer storage medium and electronic equipment
CN116419076B (en) Image processing method and device, electronic equipment and chip
CN104869379A (en) White balance compensation method and electronic device
CN112243118A (en) White balance correction method, device, equipment and storage medium
CN113395503B (en) Method, apparatus, device and medium for correcting white balance of image

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19909264

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19909264

Country of ref document: EP

Kind code of ref document: A1