[go: up one dir, main page]

CN115988335A - Image white balance correction method, device and equipment for multiple light sources and storage medium - Google Patents

Image white balance correction method, device and equipment for multiple light sources and storage medium Download PDF

Info

Publication number
CN115988335A
CN115988335A CN202211321442.7A CN202211321442A CN115988335A CN 115988335 A CN115988335 A CN 115988335A CN 202211321442 A CN202211321442 A CN 202211321442A CN 115988335 A CN115988335 A CN 115988335A
Authority
CN
China
Prior art keywords
light source
image
equivalent
calculating
cell response
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211321442.7A
Other languages
Chinese (zh)
Inventor
马诗宁
宋维涛
刘越
王涌天
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Institute of Technology BIT
Original Assignee
Beijing Institute of Technology BIT
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 Beijing Institute of Technology BIT filed Critical Beijing Institute of Technology BIT
Publication of CN115988335A publication Critical patent/CN115988335A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02BCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO BUILDINGS, e.g. HOUSING, HOUSE APPLIANCES OR RELATED END-USER APPLICATIONS
    • Y02B20/00Energy efficient lighting technologies, e.g. halogen lamps or gas discharge lamps
    • Y02B20/40Control techniques providing energy savings, e.g. smart controller or presence detection

Landscapes

  • Processing Of Color Television Signals (AREA)

Abstract

The application belongs to the technical field of image processing, and discloses a multi-light-source-oriented image white balance correction method, device, equipment and storage medium, which can be suitable for white balance correction in a multi-light-source environment. Calculating the influence weight of the environment light sources at different positions on each pixel position in the shot image, and calculating an equivalent light source cone cell response value equivalent to the multiple light sources based on the influence weight and the cone cell response value of the multiple light sources; calculating an influence factor of the equivalent light source on each pixel position on the image, and calculating the adaptation degree of the equivalent light source based on the influence factor; calculating a gain coefficient of each viewing cone channel based on the adaptation degree, the viewing cone cell response values of the equivalent light source and the reference light source; and calculating corresponding colors of the shot images under the reference light source by using the gain coefficients, and converting the corresponding colors into RGB (red, green and blue) output of the corrected images to realize white balance correction of the shot images.

Description

面向多光源的图像白平衡校正方法、装置、设备及存储介质Image white balance correction method, device, equipment and storage medium for multiple light sources

技术领域Technical Field

本发明涉及相机白平衡校正技术领域,具体涉及一种面向多光源的图像白平衡校正方法、装置、设备及存储介质。The present invention relates to the technical field of camera white balance correction, and in particular to a method, device, equipment and storage medium for multi-light source image white balance correction.

背景技术Background Art

人眼视觉系统具有色适应调节的能力,可以根据适应光环境的颜色和亮度调节视锥细胞的敏感曲线,从而在不同光源下保持物体色貌的相对稳定。数码相机信号处理流程中的白平衡模块承担了色适应参考光源作为校正目标调节的功能,使得白平衡校正后的图像与人眼对真实场景的视觉感知相一致。相机的白平衡校正算法包括光源估计和色适应调整:基于图像颜色信息,光源估计模块能够预估出适应环境中的光源颜色和亮度;根据预估出的光源信息,色适应调整模块计算得到每个通道的增益系数,并使用该系数对原图像的三通道响应值做独立线性调节。The human visual system has the ability to adjust color adaptation, and can adjust the sensitivity curve of cone cells according to the color and brightness of the adapted light environment, so as to keep the color appearance of objects relatively stable under different light sources. The white balance module in the digital camera signal processing flow assumes the function of adjusting the color adaptation reference light source as the correction target, so that the image after white balance correction is consistent with the human eye's visual perception of the real scene. The camera's white balance correction algorithm includes light source estimation and color adaptation adjustment: based on the image color information, the light source estimation module can estimate the color and brightness of the light source in the adapted environment; based on the estimated light source information, the color adaptation adjustment module calculates the gain coefficient of each channel, and uses this coefficient to make independent linear adjustments to the three-channel response values of the original image.

区别于理想的单光源环境,真实适应环境中可能存在多种不同的光源。但目前的白平衡算法主要针对单一光源的适应环境,对于多光源的复杂适应场,白平衡算法中的色适应调整方法存在一系列问题和挑战:(1)光源颜色的空间分布对于适应状态的影响未知。在沃克里斯色适应变换的理论框架下,增益系数计算所用的测试光源即为估计所得的环境光源。但对于多光源环境,目前的白平衡算法并没有考虑不同光源之间的相互影响,因此测试光源的计算方法仍然未知;(2)现有的白平衡算法假设人眼达到了完全适应的状态,并没有考虑多光源环境的颜色空间分布、亮度空间分布、适应场大小等因素对于适应程度的影响,导致颜色还原结果偏离人眼感知。Different from the ideal single-light source environment, there may be multiple different light sources in the real adaptation environment. However, the current white balance algorithm is mainly aimed at the adaptation environment of a single light source. For the complex adaptation field of multiple light sources, the color adaptation adjustment method in the white balance algorithm has a series of problems and challenges: (1) The influence of the spatial distribution of the light source color on the adaptation state is unknown. Under the theoretical framework of the Walkers chromatic adaptation transform, the test light source used for gain coefficient calculation is the estimated ambient light source. However, for the multi-light source environment, the current white balance algorithm does not consider the mutual influence between different light sources, so the calculation method of the test light source is still unknown; (2) The existing white balance algorithm assumes that the human eye has reached a state of complete adaptation, and does not consider the influence of factors such as the color space distribution, brightness space distribution, and adaptation field size of the multi-light source environment on the degree of adaptation, resulting in the color restoration result deviating from the human eye perception.

发明内容Summary of the invention

有鉴于此,本申请实施例提供一种面向多光源的图像白平衡校正方法、装置、设备及存储介质,能够适用于多光源环境。In view of this, the embodiments of the present application provide a method, device, equipment and storage medium for image white balance correction for multiple light sources, which can be applicable to multiple light source environments.

第一方面,本申请一实施例提供了一种面向多光源的图像白平衡校正方法,具体步骤包括:In a first aspect, an embodiment of the present application provides a method for image white balance correction for multiple light sources, and the specific steps include:

计算不同位置环境光源对拍摄图像中每一像素位置的影响权重,基于所述影响权重与多光源的视锥细胞响应值,计算等效于所述多光源的等效光源视锥细胞响应值;Calculating the influence weight of ambient light sources at different positions on each pixel position in the captured image, and calculating the cone cell response value of an equivalent light source equivalent to the multiple light sources based on the influence weight and the cone cell response value of the multiple light sources;

计算等效光源对于图像上每一像素位置的影响因子,基于所述影响因子计算等效光源的适应程度;Calculating an influence factor of an equivalent light source on each pixel position on the image, and calculating an adaptability of the equivalent light source based on the influence factor;

基于所述适应程度、等效光源和参考光源的视锥细胞响应值,计算每一视锥通道的增益系数;Calculating a gain coefficient of each cone channel based on the adaptation degree, the cone cell response values of the equivalent light source and the reference light source;

利用所述增益系数计算拍摄图像在参考光源下的对应色,将所述对应色转换成校正图像的RGB输出,实现拍摄图像的白平衡校正。The gain coefficient is used to calculate the corresponding color of the captured image under the reference light source, and the corresponding color is converted into the RGB output of the correction image to achieve white balance correction of the captured image.

可选的,基于图像相邻像素对应的实际间距、水平和垂直方向高斯分布函数,设定不同位置光源对拍摄图像中每一像素位置的影响权重。Optionally, based on the actual spacing corresponding to adjacent pixels of the image and Gaussian distribution functions in the horizontal and vertical directions, the weight of influence of light sources at different positions on each pixel position in the captured image is set.

可选的,针对拍摄图像中某一像素(i,j),所述影响权重设定为ws(m,n,i,j):Optionally, for a certain pixel (i, j) in the captured image, the influence weight is set to w s (m, n, i, j):

Figure SMS_1
Figure SMS_1

其中,d0为图像相邻像素点对应的实际间距;σ和k分别为水平和垂直方向高斯分布曲线的待定常数,(m,n)为光源的空间坐标,M、N分别代表图像在水平和垂直方向上的像素数目,0≤i≤M,0≤j≤N;Where, d 0 is the actual spacing between adjacent pixels in the image; σ and k are the unknown constants of the Gaussian distribution curves in the horizontal and vertical directions, respectively; (m, n) is the spatial coordinate of the light source; M and N represent the number of pixels in the horizontal and vertical directions of the image, respectively; 0≤i≤M, 0≤j≤N;

基于图像采集设备的特性化矩阵和锥体响应变换矩阵,获得多光源锥体细胞响应值

Figure SMS_2
所述基于所述影响权重与多光源的视锥细胞响应值,计算像素(i,j)的等效光源视锥细胞响应值
Figure SMS_3
为:Based on the characteristic matrix of the image acquisition device and the cone response transformation matrix, the cone cell response values of multiple light sources are obtained.
Figure SMS_2
The equivalent light source cone cell response value of pixel (i, j) is calculated based on the influence weight and the cone cell response values of multiple light sources.
Figure SMS_3
for:

Figure SMS_4
Figure SMS_4

可选的,所述计算等效光源对于图像上每一像素位置的影响因子,基于所述影响因子计算等效光源的适应程度为:Optionally, the calculation of the influence factor of the equivalent light source for each pixel position on the image and the degree of adaptability of the equivalent light source calculated based on the influence factor are:

计算等效光源对于图像上每一像素点的色度因子和亮度因子,计算等效光源的尺度因子;将所述色度因子、亮度因子及尺度因子的乘积作为等效光源的适应程度。The chromaticity factor and brightness factor of the equivalent light source for each pixel on the image are calculated, and the scale factor of the equivalent light source is calculated; and the product of the chromaticity factor, the brightness factor and the scale factor is used as the adaptability of the equivalent light source.

可选地,所述基于所述适应程度、等效光源和参考光源的视锥细胞响应值,计算每一视锥通道的增益系数为:Optionally, the gain coefficient of each cone channel is calculated based on the adaptation degree, the cone cell response value of the equivalent light source and the reference light source as follows:

Figure SMS_5
Figure SMS_5

Figure SMS_6
Figure SMS_6

Figure SMS_7
Figure SMS_7

其中,

Figure SMS_8
为参考光源的锥体细胞响应值,
Figure SMS_9
为等效光源的锥体细胞响应值,D(i,j)为等效光源的适应程度。in,
Figure SMS_8
is the cone cell response value of the reference light source,
Figure SMS_9
is the cone cell response value of the equivalent light source, and D(i,j) is the adaptation degree of the equivalent light source.

可选的,所述利用所述增益系数计算拍摄图像在参考光源下的对应色为:Optionally, the corresponding color of the captured image under the reference light source is calculated by using the gain coefficient:

基于图像采集设备的特性化矩阵和锥体响应变换矩阵,获得拍摄图像锥体细胞响应值,将所述增益系数与拍摄图像锥体细胞响应值相乘,计算出拍摄图像在参考光源下的对应色;Based on the characteristic matrix of the image acquisition device and the cone response transformation matrix, the cone cell response value of the captured image is obtained, and the gain coefficient is multiplied by the cone cell response value of the captured image to calculate the corresponding color of the captured image under the reference light source;

Figure SMS_10
Figure SMS_10

其中,

Figure SMS_11
为拍摄图像中坐标为(i,j)的像素点在参考光源下对应色的锥体细胞响应值,
Figure SMS_12
为拍摄图像中坐标为(i,j)的像素点锥体细胞响应值;in,
Figure SMS_11
is the cone cell response value of the corresponding color of the pixel with coordinate (i, j) in the captured image under the reference light source,
Figure SMS_12
is the cone cell response value of the pixel with coordinates (i, j) in the captured image;

所述将所述对应色转换成校正图像的RGB为:The corresponding color is converted into the RGB of the corrected image:

通过锥体响应变换逆矩阵和相机特性化逆矩阵,将图片在参考光源下对应色的锥体细胞响应值重新转换到所用相机的RGB空间:Through the inverse matrix of cone response transformation and the inverse matrix of camera characterization, the cone cell response value of the corresponding color of the image under the reference light source is converted back to the RGB space of the camera used:

Figure SMS_13
Figure SMS_13

其中,A-1为相机特性化逆矩阵,

Figure SMS_14
为锥体响应变换逆矩阵。Among them, A -1 is the camera characterization inverse matrix,
Figure SMS_14
is the inverse matrix of the cone response transformation.

可选的,所述参考光源为等能白光源,通过对其三刺激值进行缩放,使得其亮度与相应位置的等效光源相同,获得参考光源的三刺激值,利用锥体响应变换矩阵将其转换为锥体细胞响应值。Optionally, the reference light source is an isoenergetic white light source, and its tristimulus values are scaled so that its brightness is the same as that of an equivalent light source at a corresponding position, thereby obtaining the tristimulus values of the reference light source, which are then converted into cone cell response values using a cone response transformation matrix.

第二方面,本申请一实施例提供了面向多光源的图像白平衡校正装置,包括:等效光源模块、适应程度模块、增益系数模块及校正模块;In a second aspect, an embodiment of the present application provides an image white balance correction device for multiple light sources, including: an equivalent light source module, an adaptation degree module, a gain coefficient module and a correction module;

等效光源模块,用于计算不同位置环境光源对拍摄图像中每一像素位置的影响权重,基于所述影响权重与多光源的视锥细胞响应值,计算等效于所述多光源的等效光源视锥细胞响应值;An equivalent light source module is used to calculate the influence weight of the ambient light sources at different positions on each pixel position in the captured image, and calculate the cone cell response value of the equivalent light source equivalent to the multiple light sources based on the influence weight and the cone cell response value of the multiple light sources;

适应程度模块,用于计算等效光源对于图像上每一像素位置的影响因子,基于所述影响因子计算等效光源的适应程度;An adaptability module, used to calculate an influence factor of an equivalent light source on each pixel position on an image, and calculate an adaptability degree of the equivalent light source based on the influence factor;

增益系数模块,用于基于所述适应程度、等效光源和参考光源的视锥细胞响应值,计算每一视锥通道的增益系数;A gain coefficient module, used for calculating the gain coefficient of each cone channel based on the adaptation degree, the cone cell response value of the equivalent light source and the reference light source;

校正模块,利用所述增益系数计算拍摄图像在参考光源下的对应色,实现拍摄图像的白平衡校正。The correction module calculates the corresponding color of the captured image under the reference light source using the gain coefficient to achieve white balance correction of the captured image.

第三方面,本申请一实施例提供了一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其中,处理器执行计算机程序时实现上述任一种方法的步骤。In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any of the above methods when executing the computer program.

第四方面,本申请一实施例提供了一种计算机可读存储介质,其上存储有计算机程序指令,该计算机程序指令被处理器执行时实现上述任一种方法的步骤。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having computer program instructions stored thereon, which implement the steps of any of the above methods when executed by a processor.

有益效果Beneficial Effects

第一,本申请实施例基于多光源的位置信息,设定其对应与拍摄图像中每一像素的影响权重,利用所述影响权重将多光源等效为一个等效光源,从而保证该方法可以适用于环境中具有多个光源的情形。First, the embodiment of the present application sets the influence weights corresponding to each pixel in the captured image based on the position information of multiple light sources, and uses the influence weights to equate the multiple light sources to one equivalent light source, thereby ensuring that the method can be applied to situations where there are multiple light sources in the environment.

第二,本申请实例基于色适应状态主要受中心视场影响的研究结果,用二维空间高斯分布函数模拟不同位置光源对于等效光源的影响权重,从而保证该方法和人眼视觉感知保持一致。Second, based on the research result that the color adaptation state is mainly affected by the central field of view, the example of this application uses a two-dimensional Gaussian distribution function to simulate the influence weight of light sources in different positions on the equivalent light source, thereby ensuring that the method is consistent with the visual perception of the human eye.

第三,本申请实施例充分考虑光源颜色、亮度、大小等因素对于适应程度的影响,利用光源颜色、亮度、大小及环境因子的乘积来计算增益系数,可以避免白平衡矫正后的图像与人眼视觉之间存在偏差。Third, the embodiment of the present application fully considers the influence of factors such as light source color, brightness, size, etc. on the degree of adaptation, and uses the product of light source color, brightness, size and environmental factors to calculate the gain coefficient, which can avoid the deviation between the image after white balance correction and the human eye vision.

第四,本申请可以应用于不同的成像电子设备中,具有很好的适用前景。Fourth, the present application can be applied to different imaging electronic devices and has a good applicability prospect.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

为了更清楚地说明本发明实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

图1为本发明方法流程图。FIG1 is a flow chart of the method of the present invention.

图2为本发明方法中的具体特性化流程示意图。FIG. 2 is a schematic diagram of a specific characterization process in the method of the present invention.

图3为本发明实施例中,参数σ在不同数值下,等效光源计算公式中的位置权重与光源相对位置在水平/垂直方向上距离之间的对应关系示意图。3 is a schematic diagram showing the corresponding relationship between the position weight in the equivalent light source calculation formula and the distance between the relative position of the light source in the horizontal/vertical direction when the parameter σ has different values in an embodiment of the present invention.

图4为本发明实施例中,以位于图像(1000,1000)位置的像素点为参考对象,拍摄所得图片的光源位置权重与二维空间像素坐标之间的对应关系示意图。4 is a schematic diagram of the correspondence between the light source position weight and the two-dimensional space pixel coordinates of a captured image, taking the pixel point located at the position (1000, 1000) of the image as a reference object in an embodiment of the present invention.

具体实施方式DETAILED DESCRIPTION

下面结合附图对本发明实施例进行详细描述。The embodiments of the present invention are described in detail below with reference to the accompanying drawings.

需说明的是,在不冲突的情况下,以下实施例及实施例中的特征可以相互组合;并且,基于本公开中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本公开保护的范围。It should be noted that the following embodiments and features in the embodiments may be combined with each other in the absence of conflict; and, based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without making any creative work are within the scope of protection of the present disclosure.

需要说明的是,下文描述在所附权利要求书的范围内的实施例的各种方面。应显而易见,本文中所描述的方面可体现于广泛多种形式中,且本文中所描述的任何特定结构及/或功能仅为说明性的。基于本公开,所属领域的技术人员应了解,本文中所描述的一个方面可与任何其它方面独立地实施,且可以各种方式组合这些方面中的两者或两者以上。举例来说,可使用本文中所阐述的任何数目个方面来实施设备及/或实践方法。另外,可使用除了本文中所阐述的方面中的一或多者之外的其它结构及/或功能性实施此设备及/或实践此方法。It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein may be embodied in a wide variety of forms, and any specific structure and/or function described herein is merely illustrative. Based on the present disclosure, it should be understood by those skilled in the art that an aspect described herein may be implemented independently of any other aspect, and two or more of these aspects may be combined in various ways. For example, any number of aspects described herein may be used to implement the device and/or practice the method. In addition, other structures and/or functionalities other than one or more of the aspects described herein may be used to implement this device and/or practice this method.

本申请的设计思想为:(1)针对存在多光源的拍摄环境,基于光源位置设定影响权重,将不同位置的多光源等效为一个等效光源,基于等效光源的相关信息进行白平衡校正,从而使得该方法可以适用于存在多个光源的拍摄环境中;(2)将拍摄图像转换到LMS空间中进行,处理过程更贴近人眼视锥细胞光谱敏感度在不同光环境下的变化过程;(3)增益系数的计算引入了一个新变量——适应程度D,用来量化光环境颜色、亮度、大小等参数对于适应程度的影响,形成了一个准确、全面、应用范围广的适应程度评估模型,并结合相机颜色特性化模型和光源估计算法;基于上述三种设计思想实现了对多光源环境拍摄图像的白平衡校正,且符合人眼真实感知的彩色相机白平衡矫正。The design ideas of this application are: (1) For shooting environments with multiple light sources, influence weights are set based on the positions of the light sources, and multiple light sources at different positions are equivalent to one equivalent light source. White balance correction is performed based on the relevant information of the equivalent light source, so that the method can be applied to shooting environments with multiple light sources; (2) The captured image is converted into the LMS space, and the processing process is closer to the change process of the spectral sensitivity of the cone cells of the human eye under different light environments; (3) A new variable, the degree of adaptation D, is introduced into the calculation of the gain coefficient to quantify the influence of parameters such as the color, brightness, and size of the light environment on the degree of adaptation, forming an accurate, comprehensive, and widely applicable degree of adaptation evaluation model, and combining it with the camera color characterization model and the light source estimation algorithm; Based on the above three design ideas, white balance correction of images shot in a multi-light source environment is realized, and the white balance correction of the color camera is consistent with the real perception of the human eye.

本申请实施例不考虑光源估计问题,假设实际拍摄场景中的光源颜色已经由现有光源估计模块计算得出。The embodiment of the present application does not consider the light source estimation problem, and assumes that the light source color in the actual shooting scene has been calculated by the existing light source estimation module.

如图1所示,本申请一实施例,一种面向多光源环境的白平衡校正方法,具体过程为:As shown in FIG1 , an embodiment of the present application is a white balance correction method for a multi-light source environment, and the specific process is as follows:

设定不同位置环境光源对拍摄图像中每一像素位置的影响权重,基于所述影响权重与多光源的视锥细胞响应值,计算等效于所述多光源的等效光源视锥细胞响应值;计算等效光源对于图像上每一像素位置的影响因子,基于所述影响因子计算等效光源的适应程度;基于所述适应程度、等效光源和参考光源的视锥细胞响应值,计算每一视锥通道的增益系数;利用所述增益系数计算拍摄图像在参考光源下的对应色(即图像LMS视锥响应),将所述对应色转换成校正图像的RGB输出,实现拍摄图像的白平衡校正。The weights of influence of ambient light sources at different positions on each pixel position in the captured image are set, and based on the influence weights and the cone cell response values of the multiple light sources, the cone cell response values of the equivalent light source equivalent to the multiple light sources are calculated; the influence factor of the equivalent light source on each pixel position on the image is calculated, and the adaptation degree of the equivalent light source is calculated based on the influence factor; the gain coefficient of each cone channel is calculated based on the adaptation degree, the cone cell response values of the equivalent light source and the reference light source; the corresponding color of the captured image under the reference light source (i.e., the image LMS cone response) is calculated using the gain coefficient, and the corresponding color is converted into the RGB output of the corrected image to achieve white balance correction of the captured image.

本实施例基于多光源的位置信息,设定其对应与拍摄图像中每一像素的影响权重,利用所述影响权重将多光源等效为一个等效光源,从而保证该方法可以适用于环境中具有多个光源的情形。This embodiment sets the influence weights corresponding to each pixel in the captured image based on the position information of multiple light sources, and uses the influence weights to equate the multiple light sources to one equivalent light source, thereby ensuring that the method can be applied to situations where there are multiple light sources in the environment.

结合上述实施例可选的,基于图像相邻像素对应的实际间距、水平和垂直方向高斯分布函数,设定不同位置光源对拍摄图像中每一像素位置的影响权重。Optionally, in combination with the above embodiment, based on the actual spacing between adjacent pixels of the image and Gaussian distribution functions in the horizontal and vertical directions, the weight of influence of light sources at different positions on each pixel position in the captured image is set.

本申请实例基于色适应状态主要受中心视场影响的研究结果,用二维空间高斯分布函数模拟不同位置光源对于等效光源的影响权重,从而保证该方法和人眼视觉感知保持一致。The example of this application is based on the research result that the color adaptation state is mainly affected by the central field of view, and uses a two-dimensional Gaussian distribution function to simulate the influence weight of light sources in different positions on the equivalent light source, thereby ensuring that the method is consistent with the visual perception of the human eye.

结合上述实施例可选的,针对拍摄图像中某一像素(i,j),所述影响权重设定为ws(m,n,i,j):In combination with the above embodiment, for a certain pixel (i, j) in the captured image, the influence weight is set to w s (m, n, i, j):

Figure SMS_15
Figure SMS_15

其中,d0为图像相邻像素点对应的实际间距;σ和k分别为水平和垂直方向高斯分布曲线的待定常数,(m,n)为光源的空间坐标,M、N分别代表图像在水平和垂直方向上的像素数目,0≤i≤M,0≤j≤N;Where, d 0 is the actual spacing between adjacent pixels in the image; σ and k are the unknown constants of the Gaussian distribution curves in the horizontal and vertical directions, respectively; (m, n) is the spatial coordinate of the light source; M and N represent the number of pixels in the horizontal and vertical directions of the image, respectively; 0≤i≤M, 0≤j≤N;

基于图像采集设备的特性化矩阵和锥体响应变换矩阵,获得多光源锥体细胞响应值

Figure SMS_16
所述基于所述影响权重与多光源的视锥细胞响应值,计算像素(i,j)的等效光源视锥细胞响应值
Figure SMS_17
为:Based on the characteristic matrix of the image acquisition device and the cone response transformation matrix, the cone cell response values of multiple light sources are obtained.
Figure SMS_16
The equivalent light source cone cell response value of pixel (i, j) is calculated based on the influence weight and the cone cell response values of multiple light sources.
Figure SMS_17
for:

Figure SMS_18
Figure SMS_18

结合上述实施例可选的,计算等效光源对于图像上每一像素位置的影响因子,基于所述影响因子计算等效光源的适应程度为:In combination with the above embodiment, optionally, the influence factor of the equivalent light source for each pixel position on the image is calculated, and the adaptability of the equivalent light source is calculated based on the influence factor as follows:

计算等效光源对于图像上每一像素点的色度因子和亮度因子,计算等效光源的尺度因子;将所述色度因子、亮度因子及尺度因子的乘积作为等效光源的适应程度。The chromaticity factor and brightness factor of the equivalent light source for each pixel on the image are calculated, and the scale factor of the equivalent light source is calculated; and the product of the chromaticity factor, the brightness factor and the scale factor is used as the adaptability of the equivalent light source.

本实施例充分考虑光源颜色、亮度、大小等因素对于适应程度的影响,利用光源颜色、亮度、大小及环境因子的乘积来计算增益系数,可以避免白平衡矫正后的图像与人眼视觉之间存在偏差,合形成了一个准确、全面、适用于各种多光源环境的色适应调整方法,实现了与人眼真实感知一致的彩色相机白平衡校正。This embodiment fully considers the influence of factors such as light source color, brightness, size, etc. on the degree of adaptation, and uses the product of light source color, brightness, size and environmental factors to calculate the gain coefficient, which can avoid the deviation between the image after white balance correction and human vision, and jointly forms an accurate, comprehensive, and color adaptation adjustment method suitable for various multi-light source environments, thereby realizing the white balance correction of color cameras consistent with the real perception of the human eye.

结合上述实施例可选的,基于所述适应程度、等效光源和参考光源的视锥细胞响应值,计算每一视锥通道的增益系数为:In combination with the above embodiment, optionally, based on the adaptation degree, the cone cell response values of the equivalent light source and the reference light source, the gain coefficient of each cone channel is calculated as:

Figure SMS_19
Figure SMS_19

Figure SMS_20
Figure SMS_20

Figure SMS_21
Figure SMS_21

其中,

Figure SMS_22
为参考光源的锥体细胞响应值,
Figure SMS_23
为等效光源的锥体细胞响应值,D(i,j)为等效光源的适应程度。in,
Figure SMS_22
is the cone cell response value of the reference light source,
Figure SMS_23
is the cone cell response value of the equivalent light source, and D(i,j) is the adaptation degree of the equivalent light source.

结合上述实施例可选的,所述利用所述增益系数计算拍摄图像在参考光源下的对应色为:In combination with the above embodiment, the corresponding color of the captured image under the reference light source calculated by using the gain coefficient is:

基于图像采集设备的特性化矩阵和锥体响应变换矩阵,获得拍摄图像锥体细胞响应值值,将所述增益系数与拍摄图像锥体细胞响应值相乘,计算出拍摄图像在参考光源下的对应色;Based on the characteristic matrix of the image acquisition device and the cone response transformation matrix, the cone cell response value of the captured image is obtained, and the gain coefficient is multiplied by the cone cell response value of the captured image to calculate the corresponding color of the captured image under the reference light source;

Figure SMS_24
Figure SMS_24

其中,

Figure SMS_25
为拍摄图像中坐标为(i,j)的像素点在参考光源下对应色的锥体细胞响应值,
Figure SMS_26
为拍摄图像中坐标为(i,j)的像素点锥体细胞响应值;in,
Figure SMS_25
is the cone cell response value of the corresponding color of the pixel with coordinate (i, j) in the captured image under the reference light source,
Figure SMS_26
is the cone cell response value of the pixel with coordinates (i, j) in the captured image;

所述将所述对应色转换成校正图像的RGB为:The corresponding color is converted into the RGB of the corrected image:

通过锥体响应变换逆矩阵和相机特性化逆矩阵,将图片在参考光源下对应色的锥体细胞响应值重新转换到所用相机的RGB空间:Through the inverse matrix of cone response transformation and the inverse matrix of camera characterization, the cone cell response value of the corresponding color of the image under the reference light source is converted back to the RGB space of the camera used:

Figure SMS_27
Figure SMS_27

其中,A-1为相机特性化逆矩阵,

Figure SMS_28
为锥体响应变换逆矩阵。Among them, A -1 is the camera characterization inverse matrix,
Figure SMS_28
is the inverse matrix of the cone response transformation.

本实施例中利用图像采集设备的特性化矩阵和锥体响应变换矩阵,预先获得多光源环境下每一光源的锥体细胞响应值,结合影响权重来获得与多光源等效的一个等效光源的锥体细胞响应值,保证所获得的等效光源锥体细胞响应值可以准确的表示环境中多光源的特性。本实施例利用利用图像采集设备的特性化矩阵和锥体响应变换矩阵将拍摄图像转换到LMS空间中进行校正,相比于现有技术在基于设备相关的RGB空间或者R/G,B/G空间进行,本实施例能够更精准的解决锥细胞光谱敏感度随光环境变化导致的问题,的从而保证颜色校正结果与人眼的感知一致。In this embodiment, the characteristic matrix and cone response transformation matrix of the image acquisition device are used to obtain the cone cell response value of each light source in a multi-light source environment in advance, and the cone cell response value of an equivalent light source equivalent to the multi-light source is obtained by combining the influence weight, so as to ensure that the obtained cone cell response value of the equivalent light source can accurately represent the characteristics of the multi-light source in the environment. In this embodiment, the characteristic matrix and cone response transformation matrix of the image acquisition device are used to convert the captured image into the LMS space for correction. Compared with the prior art based on the device-related RGB space or R/G, B/G space, this embodiment can more accurately solve the problem caused by the change of cone cell spectral sensitivity with the light environment, thereby ensuring that the color correction result is consistent with the perception of the human eye.

结合上述实施例可选的,所述参考光源为等能白光源,通过对其三刺激值进行缩放,使得其亮度与相应位置的等效光源相同,获得参考光源的三刺激值,利用锥体响应变换矩阵将其转换为锥体细胞响应值。In combination with the above embodiment, optionally, the reference light source is an isoenergetic white light source, and its tristimulus values are scaled so that its brightness is the same as that of an equivalent light source at a corresponding position, thereby obtaining the tristimulus values of the reference light source, which are then converted into cone cell response values using a cone response transformation matrix.

实例:Examples:

本实施例图像采集设备为数码相机,通过对数码相机采集的图像进行白平衡校正。In this embodiment, the image acquisition device is a digital camera, and white balance correction is performed on the image acquired by the digital camera.

(1)利用模拟D65光源,获取相机的特性化矩阵A;(1) Using simulated D65 light source, obtain the camera’s characterization matrix A;

如图2所示,该步骤的具体过程如下:As shown in Figure 2, the specific process of this step is as follows:

101,对于光谱功率分布为P(λ)的模拟D65光源,使用颜色匹配函数(colormatching functions)

Figure SMS_29
计算标准色卡第i个色块在该光源下的色度值XYZ:101, for a simulated D65 light source with a spectral power distribution of P(λ), use the color matching functions
Figure SMS_29
Calculate the chromaticity value XYZ of the i-th color block of the standard color card under the light source:

Figure SMS_30
Figure SMS_30

Figure SMS_31
Figure SMS_31

Figure SMS_32
Figure SMS_32

其中,Ri(λ)是标准色卡第i个色块的光谱反射率。标准色卡中共有N个色块,组合得到N×3的XYZ三刺激值矩阵X,每一行对应色卡中的一个色块。其中,所用的颜色匹配函数可以根据实际场景中的物体大小在CIE 1931 2°,CIE 1964 10°,CIE 2006 2°,CIE 200610°标准观察者颜色匹配函数中进行选择。Where R i (λ) is the spectral reflectance of the i-th color block in the standard color card. There are N color blocks in the standard color card, which are combined to obtain an N×3 XYZ tristimulus value matrix X, where each row corresponds to a color block in the color card. The color matching function used can be selected from the CIE 1931 2°, CIE 1964 10°, CIE 2006 2°, and CIE 200610° standard observer color matching functions according to the size of the object in the actual scene.

102,使用待标定数码相机获取D65光源下标准色卡中各个色块的RGB响应值,其中第i个色块的响应值记为RiGiBi。标准色卡中的N个色块组合得到N×3的RGB相机响应值矩阵V0,每一行对应色卡中的一个色块。102, using the digital camera to be calibrated to obtain the RGB response value of each color block in the standard color card under the D65 light source, wherein the response value of the i-th color block is recorded as R i G i B i . The N color blocks in the standard color card are combined to obtain an N×3 RGB camera response value matrix V 0 , where each row corresponds to a color block in the color card.

103,拓展相机响应值矩阵到N×11,记为V,其中s≥3,代表所选取的多项式项数,在s=11时,其中第i行对应:103, expand the camera response value matrix to N×11, denoted as V, where s≥3, represents the number of selected polynomial terms, when s=11, the i-th row corresponds to:

Figure SMS_33
Figure SMS_33

104,计算相机的特性化矩阵:104. Calculate the camera characterization matrix:

A=(VTV)-1VTXA=(V T V) -1 V T X

其中,上角标T表示转置矩阵,上角标-1表示逆矩阵。Among them, the superscript T represents the transposed matrix, and the superscript -1 represents the inverse matrix.

(2)基于所述相机的特性化矩阵和锥体响应变换矩阵,获得多个环境光源的锥体细胞响应值和拍摄图像的锥体细胞响应值;本步骤的具体过程为:(2) Based on the camera's characterization matrix and cone response transformation matrix, cone cell response values of multiple ambient light sources and cone cell response values of captured images are obtained; the specific process of this step is:

基于所述相机的特性矩阵,将实际环境中的光源色度值和所拍摄图像的相机响应值转化到XYZ颜色空间上:Based on the characteristic matrix of the camera, the chromaticity value of the light source in the actual environment and the camera response value of the captured image are converted to the XYZ color space:

[XI,YI,ZI]=VI·A[X I ,Y I ,Z I ]=V I ·A

其中,VI是坐标为拍摄图像的相机响应值(即图像的像素值),XI,YI,ZI是特性化转换后得到的拍摄图像色度值(即三刺激值)。Wherein, V I is the camera response value of the captured image (i.e., the pixel value of the image), and X I , Y I , and Z I are the chromaticity values of the captured image obtained after characteristic transformation (i.e., the tristimulus values).

实际环境中的光源色度值可以采用上述方式进行转换,转换得到三刺激值

Figure SMS_34
本步骤中光源色度值可以采用现有技术获得,本申请不在此做进一步描述。The chromaticity value of the light source in the actual environment can be converted in the above way to obtain the tristimulus value
Figure SMS_34
The chromaticity value of the light source in this step can be obtained using existing technology, and this application will not describe it further here.

基于锥体响应变换矩阵,将环境光源空间分布和拍摄图像的XYZ三刺激值转换到LMS空间上,得到多个环境光源的锥体细胞响应值和拍摄图像的锥体细胞响应值:Based on the cone response transformation matrix, the spatial distribution of the ambient light source and the XYZ tristimulus values of the captured image are converted to the LMS space to obtain the cone cell response values of multiple ambient light sources and the cone cell response values of the captured image:

Figure SMS_35
Figure SMS_35

其中,Mxyz2lms为选取的锥体响应变换矩阵,可选取的变换矩阵包括HPE矩阵、CAT02矩阵、CAT16矩阵、Sharp矩阵、BFD矩阵、CIE 2006 LMS转换矩阵等。Among them, M xyz2lms is the selected cone response transformation matrix. The selectable transformation matrices include HPE matrix, CAT02 matrix, CAT16 matrix, Sharp matrix, BFD matrix, CIE 2006 LMS conversion matrix, etc.

(3)基于将多个环境光源等效为一个等效光源的设计思想,利用设定的光源位置权重及多个环境光源的锥体细胞响应值,计算等效光源的锥体细胞响应值,并将其转换值XYZ色度空间上;具体过程如下:(3) Based on the design concept of equating multiple ambient light sources to one equivalent light source, the cone cell response values of the equivalent light source are calculated using the set light source position weights and the cone cell response values of multiple ambient light sources, and converted to the XYZ color space; the specific process is as follows:

Figure SMS_36
Figure SMS_36

Figure SMS_37
Figure SMS_37

其中,M,N分别代表图像在水平和垂直方向上的像素数目,0≤i≤M,0≤j≤N;

Figure SMS_38
为针对空间坐标为(i,j)的图像像素点对应的等效光源锥体细胞响应值;ws(m,n,i,j)为空间坐标为(m,n)的环境光源对于空间坐标为(i,j)的图像像素点适应状态的影响权重;d0为图像相邻像素点对应的实际间距;σ和k分别为水平和垂直方向高斯分布曲线的待定常数,二元高斯分布中各个待定常数的具体数值可以通过实验结果优化获取,可能会随着适应环境和观察方式的变化而变化。其中参数σ在不同数值下,等效光源计算公式中的位置权重与光源相对刺激物体在水平/垂直方向上距离之间的对应关系示意图如图3所示;以位于(1000,1000)的像素点为参考对象,拍摄所得图片的光源位置权重与二维空间像素坐标之间的对应关系示意图如图4所示。Where M and N represent the number of pixels in the horizontal and vertical directions of the image, respectively, 0≤i≤M, 0≤j≤N;
Figure SMS_38
is the cone cell response value of the equivalent light source corresponding to the image pixel with spatial coordinates (i, j); ws (m,n,i,j) is the influence weight of the ambient light source with spatial coordinates (m,n) on the adaptation state of the image pixel with spatial coordinates (i,j); d0 is the actual spacing corresponding to adjacent pixels in the image; σ and k are the undetermined constants of the Gaussian distribution curve in the horizontal and vertical directions respectively. The specific values of each undetermined constant in the binary Gaussian distribution can be obtained through optimization of experimental results and may change with changes in the adaptation environment and observation methods. The corresponding relationship between the position weight in the equivalent light source calculation formula and the horizontal/vertical distance of the light source relative to the stimulus object under different values of the parameter σ is shown in Figure 3; the corresponding relationship between the light source position weight and the two-dimensional space pixel coordinates of the captured image with the pixel at (1000,1000) as the reference object is shown in Figure 4.

将等效光源的锥体细胞响应值

Figure SMS_39
转换到XYZ色度空间上
Figure SMS_40
The cone cell response value of the equivalent light source
Figure SMS_39
Convert to XYZ color space
Figure SMS_40

Figure SMS_41
Figure SMS_41

(4)获取参考光源的色度三刺激值,并将其转换值LMS空间上,获得参考光源的锥体细胞响应值;本步骤的具体过程为:(4) Obtain the chromaticity tristimulus values of the reference light source and convert them into LMS space to obtain the cone cell response values of the reference light source. The specific process of this step is as follows:

对作为参考光源的等能白的三刺激值进行缩放,使得其亮度与相应(i,j)位置等效光源相同,参考光源色度三刺激值为

Figure SMS_42
并且满足
Figure SMS_43
The three stimulus values of the isoenergetic white as the reference light source are scaled so that its brightness is the same as the equivalent light source at the corresponding (i, j) position. The chromaticity three stimulus values of the reference light source are
Figure SMS_42
And satisfy
Figure SMS_43

接下来将参考光源色度三刺激值转换到LMS空间上:Next, convert the reference light source chromaticity tristimulus values to the LMS space:

Figure SMS_44
Figure SMS_44

(5)基于所述等效光源的锥体细胞响应值和参考光源的锥体细胞响应值,计算每个视锥通道的增益系数;本步骤的具体过程为:(5) Calculate the gain coefficient of each cone channel based on the cone cell response value of the equivalent light source and the cone cell response value of the reference light source; the specific process of this step is:

首先,基于等效光源对应的XYZ色度空间上的三刺激值,计算对于空间坐标为(i,j)图像像素点的色度因子和亮度因子;获取等效光源的适应光环境的视场角作为尺度因子,将所述色度因子(fcolor)、尺寸因子(ffov)、亮度因子(fLa)三者相乘得到人眼对于等效光源的适应程度D(i,j):First, based on the tristimulus values on the XYZ chromaticity space corresponding to the equivalent light source, the chromaticity factor and brightness factor of the image pixel with the spatial coordinate (i, j) are calculated; the field of view of the adapted light environment of the equivalent light source is obtained as the scale factor, and the chromaticity factor (f color ), size factor (f fov ), and brightness factor (f La ) are multiplied to obtain the degree of adaptation of the human eye to the equivalent light source D(i, j):

Figure SMS_45
Figure SMS_45

其中,fov指适应光环境的视场角。D(i,j)的变化范围从0(没有适应)到1(完全适应)每个视锥通道的增益系数:Where fov refers to the field of view of the adapted light environment. D(i,j) ranges from 0 (no adaptation) to 1 (full adaptation) The gain coefficient of each cone channel is:

Figure SMS_46
Figure SMS_46

Figure SMS_47
Figure SMS_47

Figure SMS_48
Figure SMS_48

其中,

Figure SMS_49
为参考光源的锥体细胞响应值,
Figure SMS_50
为等效光源的锥体细胞响应值。in,
Figure SMS_49
is the cone cell response value of the reference light source,
Figure SMS_50
is the cone cell response value of the equivalent light source.

(6)利用步骤(5)计算出的增益系数计算图片在参考光源下的对应色:(6) Use the gain coefficient calculated in step (5) to calculate the corresponding color of the image under the reference light source:

Figure SMS_51
Figure SMS_51

其中,

Figure SMS_52
为图片中坐标为(i,j)的像素点在参考光源下对应色的锥体细胞响应值。in,
Figure SMS_52
It is the cone cell response value of the corresponding color of the pixel with coordinates (i, j) in the image under the reference light source.

(7)通过锥体响应变换逆矩阵和相机特性化逆矩阵,将图片在参考光源下对应色的锥体细胞响应值重新转换到所用相机的RGB空间:(7) Through the inverse matrix of cone response transformation and the inverse matrix of camera characterization, the cone cell response value of the corresponding color of the image under the reference light source is converted back to the RGB space of the camera used:

Figure SMS_53
Figure SMS_53

其中,

Figure SMS_54
为图片中坐标为(i,j)的像素点在参考光源下对应色的相机响应值,完成了考虑光源颜色空间分布的、更符合人眼感受的多光源彩色相机白平衡校正。in,
Figure SMS_54
The camera response value of the corresponding color of the pixel with coordinates (i, j) in the image under the reference light source is used to complete the multi-light source color camera white balance correction that takes into account the color space distribution of the light source and is more in line with the human eye's perception.

本实施例中,采用二元高斯分布计算不同位置的光源对于适应状态的影响权重,通过光源空间分布的加权积分计算等效光源的三刺激值,结合等效光源的亮度和适应场大小计算人眼视觉系统对于等效光源的适应程度。本实施例创新性的提出了等效光源的概念,解决了多光源环境下色适应调整的难题,对提升白平衡算法的处理效果、拓展其应用范围具有重要意义。In this embodiment, a binary Gaussian distribution is used to calculate the influence weights of light sources at different positions on the adaptation state, the tristimulus values of the equivalent light source are calculated by weighted integration of the spatial distribution of the light source, and the degree of adaptation of the human visual system to the equivalent light source is calculated in combination with the brightness of the equivalent light source and the size of the adaptation field. This embodiment innovatively proposes the concept of an equivalent light source, solves the problem of color adaptation adjustment in a multi-light source environment, and is of great significance for improving the processing effect of the white balance algorithm and expanding its application scope.

基于与上述面向多光源环境的白平衡校正方法相同的发明构思,本申请实施例还提供了一种面向多光源环境的白平衡校正装置,包括:等效光源模块、适应程度模块、增益系数模块及校正模块;Based on the same inventive concept as the above-mentioned white balance correction method for a multi-light source environment, the embodiment of the present application further provides a white balance correction device for a multi-light source environment, including: an equivalent light source module, an adaptation degree module, a gain coefficient module and a correction module;

等效光源模块,用于计算不同位置环境光源对拍摄图像中每一像素位置的影响权重,基于所述影响权重与多光源的视锥细胞响应值,计算等效于所述多光源的等效光源视锥细胞响应值;An equivalent light source module, used to calculate the influence weight of ambient light sources at different positions on each pixel position in the captured image, and calculate the cone cell response value of the equivalent light source equivalent to the multiple light sources based on the influence weight and the cone cell response value of the multiple light sources;

适应程度模块,用于计算等效光源对于图像上每一像素位置的影响因子,基于所述影响因子计算等效光源的适应程度;An adaptability module, used to calculate an influence factor of an equivalent light source on each pixel position on an image, and calculate an adaptability degree of the equivalent light source based on the influence factor;

增益系数模块,用于基于所述适应程度、等效光源和参考光源的视锥细胞响应值,计算每一视锥通道的增益系数;A gain coefficient module, used for calculating the gain coefficient of each cone channel based on the adaptation degree, the cone cell response value of the equivalent light source and the reference light source;

校正模块,利用所述增益系数计算拍摄图像在参考光源下的对应色,实现拍摄图像的白平衡校正。The correction module calculates the corresponding color of the captured image under the reference light source using the gain coefficient to achieve white balance correction of the captured image.

本申请实施例面向多光源环境的白平衡校正装置与上述面向多光源环境的白平衡校正方法采用了相同的发明构思,能够取得相同的有益效果,在此不再赘述。The white balance correction device for a multi-light source environment in the embodiment of the present application and the white balance correction method for a multi-light source environment described above adopt the same inventive concept and can achieve the same beneficial effects, which will not be described in detail here.

基于与上述面向多光源环境的白平衡校正方法相同的发明构思,本申请实施例还提供了一种电子设备,该电子设备可以为手机、数码相机、平板电脑等,该电子设备包括存储器和处理器。Based on the same inventive concept as the above-mentioned white balance correction method for a multi-light source environment, an embodiment of the present application also provides an electronic device, which may be a mobile phone, a digital camera, a tablet computer, etc. The electronic device includes a memory and a processor.

处理器可以是通用处理器,例如中央处理器(CPU)、数字信号处理器(DigitalSignal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件,可以实现或者执行本申请实施例中公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。The processor may be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, and may implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present application may be directly embodied as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

存储器作为一种非易失性计算机可读存储介质,可用于存储非易失性软件程序、非易失性计算机可执行程序以及模块。存储器可以包括至少一种类型的存储介质,例如可以包括闪存、硬盘、多媒体卡、卡型存储器、随机访问存储器(Random Access Memory,RAM)、静态随机访问存储器(Static Random Access Memory,SRAM)、可编程只读存储器(Programmable Read Only Memory,PROM)、只读存储器(Read Only Memory,ROM)、带电可擦除可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,EEPROM)、磁性存储器、磁盘、光盘等等。存储器是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。本申请实施例中的存储器还可以是电路或者其它任意能够实现存储功能的装置,用于存储程序指令和/或数据。As a non-volatile computer-readable storage medium, the memory can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory can include at least one type of storage medium, for example, it can include flash memory, hard disk, multimedia card, card-type memory, random access memory (Random Access Memory, RAM), static random access memory (Static Random Access Memory, SRAM), programmable read-only memory (Programmable Read Only Memory, PROM), read-only memory (Read Only Memory, ROM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), magnetic memory, disk, CD, etc. The memory is any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and/or data.

本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于一计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;上述计算机存储介质可以是计算机能够存取的任何可用介质或数据存储设备,包括但不限于:移动存储设备、随机存取存储器(RAM,Random Access Memory)、磁性存储器(例如软盘、硬盘、磁带、磁光盘(MO)等)、光学存储器(例如CD、DVD、BD、HVD等)、以及半导体存储器(例如ROM、EPROM、EEPROM、非易失性存储器(NAND FLASH)、固态硬盘(SSD))等各种可以存储程序代码的介质。A person of ordinary skill in the art can understand that: all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; the above-mentioned computer storage medium can be any available medium or data storage device that can be accessed by a computer, including but not limited to: mobile storage devices, random access memory (RAM, Random Access Memory), magnetic storage (such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO)), optical storage (such as CD, DVD, BD, HVD, etc.), and semiconductor memory (such as ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), solid-state drive (SSD)) and other media that can store program codes.

或者,本申请上述集成的单元如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台电子设备执行本申请各个实施例所述方法的全部或部分。Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application can be essentially or partly reflected in the form of a software product, which is stored in a storage medium and includes a number of instructions for an electronic device to execute all or part of the methods described in each embodiment of the present application.

以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到的变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求的保护范围为准。The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A multi-light-source-oriented image white balance correction method is characterized by comprising the following specific steps:
calculating the influence weight of the environment light sources at different positions on each pixel position in the shot image, and calculating an equivalent light source cone cell response value equivalent to the multiple light sources based on the influence weight and the cone cell response value of the multiple light sources;
calculating an influence factor of the equivalent light source on each pixel position on the image, and calculating the adaptation degree of the equivalent light source based on the influence factor;
calculating a gain coefficient of each viewing cone channel based on the adaptation degree, the viewing cone cell response values of the equivalent light source and the reference light source;
and calculating the corresponding color of the shot image under the reference light source by using the gain coefficient, and converting the corresponding color into RGB (red, green and blue) output of a corrected image to realize white balance correction of the shot image.
2. The method for correcting the white balance of the image facing multiple light sources according to claim 1, wherein the weight of the influence of the light sources at different positions on each pixel position in the captured image is set based on the actual distance, horizontal and vertical Gaussian distribution functions corresponding to adjacent pixels in the image.
3. The multi-light-source-oriented image white balance correction method according to claim 2, wherein the influence weight is set to w for a certain pixel (i, j) in the captured image s (m,n,i,j):
Figure FDA0003910657190000011
Wherein d is 0 Actual distances corresponding to adjacent pixel points of the image are obtained; sigma and k are undetermined constants of Gaussian distribution curves in the horizontal direction and the vertical direction respectively, (M, N) are space coordinates of the light source, M, N respectively represent the number of pixels of the image in the horizontal direction and the vertical direction, i is more than or equal to 0 and less than or equal to M, and j is more than or equal to 0 and less than or equal to N;
obtaining response values of multi-light source pyramidal cells based on characterization matrix and pyramidal response transformation matrix of image acquisition equipment
Figure FDA0003910657190000012
Calculating an equivalent light source cone cell response value ^ based on the impact weight and the cone cell response value of the multiple light sources>
Figure FDA0003910657190000021
Comprises the following steps:
Figure FDA0003910657190000022
4. the method for correcting the white balance of the image facing multiple light sources according to claim 1, wherein the method for calculating the influence factor of the equivalent light source on each pixel position on the image comprises the following steps:
calculating the chromaticity factor and the brightness factor of the equivalent light source for each pixel point on the image, and calculating the scale factor of the equivalent light source; and taking the product of the chrominance factor, the luminance factor and the scale factor as the adaptation degree of the equivalent light source.
5. The multi-light-source-oriented image white balance correction method according to claim 4, wherein the gain coefficient of each viewing cone channel is calculated based on the adaptation degree, the cone cell response values of the equivalent light source and the reference light source as follows:
Figure FDA0003910657190000023
Figure FDA0003910657190000024
Figure FDA0003910657190000025
wherein,
Figure FDA0003910657190000026
is a pyramidal cell response value of the reference light source, <' >>
Figure FDA0003910657190000027
D (i, j) is the adaptation degree of the equivalent light source.
6. The method for correcting the white balance of the image facing multiple light sources according to claim 5, wherein the corresponding colors of the shot image under the reference light source are calculated by using the gain coefficients as follows:
obtaining a cone cell response value of the shot image based on a characterization matrix and a cone response transformation matrix of the image acquisition equipment, multiplying the gain coefficient by the cone cell response value of the shot image, and calculating the corresponding color of the shot image under a reference light source;
Figure FDA0003910657190000031
wherein,
Figure FDA0003910657190000032
for the cone cell response value of the corresponding color of the pixel point with the coordinate (i, j) in the shot image under the reference light source, the value is judged>
Figure FDA0003910657190000033
The cone cell response value of a pixel point with coordinates (i, j) in a shot image is obtained;
the RGB for converting the corresponding color into a corrected image is:
and (3) converting the response value of the cone cell of the corresponding color of the picture under the reference light source into the RGB space of the used camera again through the cone response transformation inverse matrix and the camera characterization inverse matrix:
Figure FDA0003910657190000034
wherein, A -1 The inverse matrix is characterized for the camera and,
Figure FDA0003910657190000035
the inverse matrix is transformed for the pyramidal response.
7. The multi-light-source-oriented image white balance correction method according to claim 1 or 2, wherein the reference light source is an isoenergetic white light source, the tristimulus values of the reference light source are obtained by scaling the tristimulus values of the reference light source so that the brightness of the tristimulus values is the same as that of the equivalent light source at the corresponding position, and the tristimulus values of the reference light source are converted into pyramidal cell response values by using a pyramidal response transformation matrix.
8. An image white balance correction apparatus for multiple light sources, comprising: the device comprises an equivalent light source module, an adaptation degree module, a gain coefficient module and a correction module;
the equivalent light source module is used for calculating the influence weight of the environment light sources at different positions on each pixel position in the shot image, and calculating an equivalent light source cone cell response value equivalent to the multiple light sources based on the influence weight and the cone cell response values of the multiple light sources;
the adaptive degree module is used for calculating an influence factor of the equivalent light source on each pixel position on the image and calculating the adaptive degree of the equivalent light source based on the influence factor;
the gain coefficient module is used for calculating the gain coefficient of each viewing cone channel based on the adaptive degree, the viewing cone cell response values of the equivalent light source and the reference light source;
and the correction module calculates the corresponding color of the shot image under the reference light source by using the gain coefficient to realize the white balance correction of the shot image.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the steps of the method of any of claims 1-7 are performed when the computer program is executed by the processor.
10. A computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, implement the steps of the method of any one of claims 1 to 7.
CN202211321442.7A 2022-06-30 2022-10-26 Image white balance correction method, device and equipment for multiple light sources and storage medium Pending CN115988335A (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN2022107724579 2022-06-30
CN202210772457 2022-06-30

Publications (1)

Publication Number Publication Date
CN115988335A true CN115988335A (en) 2023-04-18

Family

ID=85958351

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211321442.7A Pending CN115988335A (en) 2022-06-30 2022-10-26 Image white balance correction method, device and equipment for multiple light sources and storage medium

Country Status (1)

Country Link
CN (1) CN115988335A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118200748A (en) * 2024-05-11 2024-06-14 荣耀终端有限公司 Image processing method, electronic device, storage medium and program product

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6573932B1 (en) * 2002-03-15 2003-06-03 Eastman Kodak Company Method for automatic white balance of digital images
US20030189650A1 (en) * 2002-04-04 2003-10-09 Eastman Kodak Company Method for automatic white balance of digital images
KR20050059522A (en) * 2003-12-15 2005-06-21 엘지.필립스 엘시디 주식회사 Method and apparatus for correcting image displaying device
US20090010535A1 (en) * 2005-07-12 2009-01-08 Nikon Corporation Image Processing Device, Image Processing Program, and Image Processing Method
US20100026837A1 (en) * 2006-11-22 2010-02-04 Nikon Corporation Image processing method, image processing program, image processing device and camera
KR20110137668A (en) * 2010-06-17 2011-12-23 엘지디스플레이 주식회사 Color reproduction method and display device using same
CN107197225A (en) * 2017-06-13 2017-09-22 浙江大学 Color digital camera white balance correcting based on chromatic adaptation model
CN108540716A (en) * 2018-03-29 2018-09-14 广东欧珀移动通信有限公司 Image processing method, device, electronic device, and computer-readable storage medium
CN112866667A (en) * 2021-04-21 2021-05-28 贝壳找房(北京)科技有限公司 Image white balance processing method and device, electronic equipment and storage medium
CN113592754A (en) * 2021-07-28 2021-11-02 维沃移动通信有限公司 Image generation method and electronic equipment

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6573932B1 (en) * 2002-03-15 2003-06-03 Eastman Kodak Company Method for automatic white balance of digital images
US20030189650A1 (en) * 2002-04-04 2003-10-09 Eastman Kodak Company Method for automatic white balance of digital images
KR20050059522A (en) * 2003-12-15 2005-06-21 엘지.필립스 엘시디 주식회사 Method and apparatus for correcting image displaying device
US20090010535A1 (en) * 2005-07-12 2009-01-08 Nikon Corporation Image Processing Device, Image Processing Program, and Image Processing Method
US20100026837A1 (en) * 2006-11-22 2010-02-04 Nikon Corporation Image processing method, image processing program, image processing device and camera
KR20110137668A (en) * 2010-06-17 2011-12-23 엘지디스플레이 주식회사 Color reproduction method and display device using same
CN107197225A (en) * 2017-06-13 2017-09-22 浙江大学 Color digital camera white balance correcting based on chromatic adaptation model
CN108540716A (en) * 2018-03-29 2018-09-14 广东欧珀移动通信有限公司 Image processing method, device, electronic device, and computer-readable storage medium
CN112866667A (en) * 2021-04-21 2021-05-28 贝壳找房(北京)科技有限公司 Image white balance processing method and device, electronic equipment and storage medium
CN113592754A (en) * 2021-07-28 2021-11-02 维沃移动通信有限公司 Image generation method and electronic equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
冯新星等: "二维高斯分布光斑中心快速提取算法研究", 《光学快报》, vol. 32, no. 5, 31 May 2012 (2012-05-31), pages 75 - 78 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118200748A (en) * 2024-05-11 2024-06-14 荣耀终端有限公司 Image processing method, electronic device, storage medium and program product
CN118200748B (en) * 2024-05-11 2024-10-15 荣耀终端有限公司 Image processing method, electronic device, storage medium and program product

Similar Documents

Publication Publication Date Title
US10535125B2 (en) Dynamic global tone mapping with integrated 3D color look-up table
JP6111336B2 (en) Image processing method and apparatus
CN113573032B (en) Image processing method and projection system
CN113170028B (en) Method for generating image data for machine learning based imaging algorithms
CN106780374B (en) Fisheye image distortion correction method based on fisheye imaging model
CN113497927B (en) White balance adjustment method, device, terminal and storage medium
US9716880B2 (en) Image calibrating method for stitching images and related camera and image processing system with image calibrating function
CN112565636A (en) Image processing method, device, equipment and storage medium
US9961236B2 (en) 3D color mapping and tuning in an image processing pipeline
CN112788322B (en) Adaptive white balance processing method, device, medium, and electronic apparatus
US9635333B2 (en) White balancing device and method of driving the same
EP4195662A1 (en) Color consistency correction method and device for multiple cameras
TW201519654A (en) Automatic color correction method and color correction module thereof
CN108234971A (en) White balance parameter determines method, white balance adjustment method and device, storage medium, terminal
JP2016541185A (en) Method and apparatus for generating HDRI
WO2020093653A1 (en) Color adjustment method, color adjustment device, electronic device and computer-readable storage medium
CN103826113A (en) Color reducing method and device
US9319653B2 (en) White balance compensation method and electronic apparatus using the same
CN115988335A (en) Image white balance correction method, device and equipment for multiple light sources and storage medium
CN101159878B (en) Color matching method, and image capturing apparatus and electronic device using the same
CN106686320A (en) A Tone Mapping Method Based on Number Density Equalization
US20230342977A1 (en) Method for Determining Chromaticity Information and Related Electronic Device
CN112929625A (en) Display material rendering method and device
CN114286000B (en) Image color processing method and device and electronic equipment
CN115908161A (en) Color-adaptive driving white balance correction method and device suitable for single light source, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination