CN109462745B - White balance processing method and mobile terminal - Google Patents

White balance processing method and mobile terminal Download PDF

Info

Publication number
CN109462745B
CN109462745B CN201811643403.2A CN201811643403A CN109462745B CN 109462745 B CN109462745 B CN 109462745B CN 201811643403 A CN201811643403 A CN 201811643403A CN 109462745 B CN109462745 B CN 109462745B
Authority
CN
China
Prior art keywords
picture
white balance
pixel
balance gain
coefficient
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811643403.2A
Other languages
Chinese (zh)
Other versions
CN109462745A (en
Inventor
游宏豪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Vivo Mobile Communication Co Ltd
Original Assignee
Vivo Mobile Communication Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Vivo Mobile Communication Co Ltd filed Critical Vivo Mobile Communication Co Ltd
Priority to CN201811643403.2A priority Critical patent/CN109462745B/en
Publication of CN109462745A publication Critical patent/CN109462745A/en
Application granted granted Critical
Publication of CN109462745B publication Critical patent/CN109462745B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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

Landscapes

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

Abstract

The embodiment of the invention provides a white balance processing method and a mobile terminal, wherein the method comprises the following steps: acquiring picture pixel-by-pixel information of a target image, shooting physical parameters and a first white balance gain coefficient of n frames before the target image; determining a second white balance gain coefficient and an updating reference coefficient based on the picture pixel-by-pixel information and the shooting physical parameter; under the condition that the second white balance gain coefficient needs to be updated, updating the second white balance gain coefficient by adopting the updating reference coefficient; performing white balance processing on the target image by adopting the updated second white balance gain coefficient; wherein the target image is a current frame image; n is a positive integer greater than or equal to 1. By applying the embodiment of the invention, the picture jitter caused by overlarge white balance coefficient change of the target image can be avoided, and the picture quality is stabilized.

Description

一种白平衡处理方法及移动终端A kind of white balance processing method and mobile terminal

技术领域technical field

本发明实施例涉及通信技术领域,尤其涉及一种白平衡处理方法及移动终端。Embodiments of the present invention relate to the field of communications technologies, and in particular, to a white balance processing method and a mobile terminal.

背景技术Background technique

随着信息技术的发展,移动终端所具有的功能越来越多,例如摄像功能。目前,利用摄像头的自拍技术,在现有移动终端上虽然已经普遍且成熟,但随着摄像头配置的不断升级,ISP(Image Signal Processing,图像信号处理)技术迅猛发展,移动终端所拍摄的图像的画面品质也被不断的提出更高要求。With the development of information technology, mobile terminals have more and more functions, such as camera functions. At present, although the Selfie technology using the camera has become common and mature in the existing mobile terminals, with the continuous upgrading of the camera configuration, the ISP (Image Signal Processing, image signal processing) technology has developed rapidly, and the image captured by the mobile terminal has become The picture quality is also constantly put forward higher requirements.

物体在不同光源照射下呈现的颜色是不同的,这是由光源的不同色温决定的,它使得物体的反射光谱与真实色彩有一定的偏差。比如,在室内钨丝灯光的低色温的照射下,白色物体看起来会带有橘黄色色调,在这种光照条件下拍摄出来的景物就会偏黄,如果是在蔚蓝天空的高色温的照射下,则会带有蓝色色调。为了能够让照相机等具有成像功能的移动终端可以具有类似于人眼的视觉调节能力,在不同的光照情况下,使所获取的图像颜色保持一致,对所获得图像所做的处理就叫做白平衡。The color of the object under different light sources is different, which is determined by the different color temperature of the light source, which makes the reflection spectrum of the object have a certain deviation from the real color. For example, under the low color temperature of indoor tungsten lighting, white objects will look orange-yellow, and the scene captured in this lighting condition will be yellowish, if it is illuminated by the high color temperature of the blue sky down, it will have a blue tint. In order to enable mobile terminals with imaging functions such as cameras to have visual adjustment capabilities similar to the human eye, in different lighting conditions, the color of the obtained image can be kept consistent, and the processing of the obtained image is called white balance. .

当前基于画面颜色分量的AWB(Automatic white balance,自动白平衡)技术已经能很稳定的还原拍摄场景的色彩。但是,基于画面颜色分量的AWB技术存在不足之处。例如,当移动终端的摄像头发生位移导致画面改变,然而环境色温其实没有改变的情况下,AWB算法可能从画面的改变出发计算出与位移前不同的环境色温,导致AWB结果不准,从而导致图像的画面质量稳定性下降。The current AWB (Automatic white balance, automatic white balance) technology based on picture color components has been able to stably restore the color of the shooting scene. However, the AWB technology based on picture color components has shortcomings. For example, when the camera of the mobile terminal is displaced and the picture changes, but the ambient color temperature does not actually change, the AWB algorithm may calculate a different ambient color temperature from the one before the displacement based on the change of the picture, resulting in inaccurate AWB results, resulting in images The picture quality and stability of the degraded.

发明内容SUMMARY OF THE INVENTION

本发明实施例提供一种白平衡处理方法及移动终端,以解决白平衡计算结果不准,导致图像画面质量不稳定的问题。Embodiments of the present invention provide a white balance processing method and a mobile terminal, so as to solve the problem of inaccurate white balance calculation results, resulting in unstable image quality.

为了解决上述技术问题,本发明是这样实现的:In order to solve the above-mentioned technical problems, the present invention is achieved in this way:

第一方面,提供了一种白平衡处理方法,应用于移动终端,所述方法包括:In a first aspect, a white balance processing method is provided, applied to a mobile terminal, and the method includes:

获取目标图像的画面逐像素点信息、拍摄物理参数和所述目标图像前n帧的第一白平衡增益系数;Obtain the picture-by-pixel information of the target image, the shooting physical parameters and the first white balance gain coefficient of the first n frames of the target image;

基于所述画面逐像素点信息和所述拍摄物理参数,确定第二白平衡增益系数和更新参考系数;determining a second white balance gain coefficient and an update reference coefficient based on the pixel-by-pixel information of the picture and the shooting physical parameters;

在需要更新所述第二白平衡增益系数的情况下,采用所述更新参考系数,更新所述第二白平衡增益系数;When the second white balance gain coefficient needs to be updated, the update reference coefficient is used to update the second white balance gain coefficient;

采用更新后的所述第二白平衡增益系数,对所述目标图像进行白平衡处理;Using the updated second white balance gain coefficient to perform white balance processing on the target image;

其中,所述目标图像为当前帧图像;n为大于或等于1的正整数。Wherein, the target image is the current frame image; n is a positive integer greater than or equal to 1.

第二方面,本发明实施例提供了一种白平衡处理方法,应用于移动终端,所述方法包括:In a second aspect, an embodiment of the present invention provides a white balance processing method, which is applied to a mobile terminal, and the method includes:

获取目标图像的第一画面逐像素点信息、所述目标图像前n帧的第二画面逐像素点信息以及前n帧的第一白平衡增益系数;所述n为大于或等于1的正整数;Obtain the pixel-by-pixel information of the first picture of the target image, the pixel-by-pixel information of the second picture of the first n frames of the target image, and the first white balance gain coefficient of the first n frames; the n is a positive integer greater than or equal to 1 ;

基于所述第一画面逐像素点信息和所述第二画面逐像素点信息,确定第二白平衡增益系数和确定更新参考系数;determining a second white balance gain coefficient and determining an update reference coefficient based on the pixel-by-pixel information of the first picture and the pixel-by-pixel information of the second picture;

在需要更新所述第二白平衡增益系数的情况下,采用所述更新参考系数,更新所述第二白平衡增益系数;When the second white balance gain coefficient needs to be updated, the update reference coefficient is used to update the second white balance gain coefficient;

采用更新后的所述第二白平衡增益系数,对所述目标图像进行白平衡处理;Using the updated second white balance gain coefficient to perform white balance processing on the target image;

其中,所述目标图像为当前帧图像。Wherein, the target image is the current frame image.

第三方面,本发明实施例提供了一种移动终端,所述移动终端包括:In a third aspect, an embodiment of the present invention provides a mobile terminal, where the mobile terminal includes:

第一数据获取模块,用于获取目标图像的画面逐像素点信息、拍摄物理参数和所述目标图像前n帧的第一白平衡增益系数;a first data acquisition module, used for acquiring the picture-by-pixel information of the target image, the physical parameters of shooting, and the first white balance gain coefficient of the first n frames of the target image;

第一数据确定模块,用于基于所述画面逐像素点信息和所述拍摄物理参数,确定第二白平衡增益系数和更新参考系数;a first data determination module, configured to determine a second white balance gain coefficient and an update reference coefficient based on the picture-by-pixel information and the shooting physical parameters;

第一更新模块,用于在需要更新所述第二白平衡增益系数的情况下,采用所述更新参考系数,更新所述第二白平衡增益系数;a first update module, configured to use the update reference coefficient to update the second white balance gain coefficient when the second white balance gain coefficient needs to be updated;

第一白平衡处理模块,用于采用更新后的所述第二白平衡增益系数,对所述目标图像进行白平衡处理;a first white balance processing module, configured to perform white balance processing on the target image by using the updated second white balance gain coefficient;

其中,所述目标图像为当前帧图像;n为大于或等于1的正整数。Wherein, the target image is the current frame image; n is a positive integer greater than or equal to 1.

第四方面,本发明实施例提供了一种移动终端,所述移动终端包括:In a fourth aspect, an embodiment of the present invention provides a mobile terminal, where the mobile terminal includes:

第二数据获取模块,用于获取目标图像的第一画面逐像素点信息、所述目标图像前n帧的第二画面逐像素点信息以及前n帧的第一白平衡增益系数;所述n为大于或等于1的正整数;The second data acquisition module is used to acquire the pixel-by-pixel information of the first picture of the target image, the pixel-by-pixel information of the second picture of the first n frames of the target image, and the first white balance gain coefficient of the first n frames; the n is a positive integer greater than or equal to 1;

第二数据确定模块,用于基于所述第一画面逐像素点信息和所述第二画面逐像素点信息,确定第二白平衡增益系数和确定更新参考系数;a second data determination module, configured to determine a second white balance gain coefficient and determine an update reference coefficient based on the pixel-by-pixel information of the first picture and the pixel-by-pixel information of the second picture;

第二更新模块,用于在需要更新所述第二白平衡增益系数的情况下,采用所述更新参考系数,更新所述第二白平衡增益系数;a second update module, configured to use the update reference coefficient to update the second white balance gain coefficient when the second white balance gain coefficient needs to be updated;

第二白平衡处理模块,用于采用更新后的所述第二白平衡增益系数,对所述目标图像进行白平衡处理;A second white balance processing module, configured to use the updated second white balance gain coefficient to perform white balance processing on the target image;

其中,所述目标图像为当前帧图像。Wherein, the target image is the current frame image.

第五方面,本发明实施例提供了一种移动终端,包括处理器、存储器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述计算机程序被所述处理器执行时实现如上述白平衡处理方法的步骤。In a fifth aspect, an embodiment of the present invention provides a mobile terminal, including a processor, a memory, and a computer program stored on the memory and executable on the processor, where the computer program is executed by the processor When implementing the steps of the above-mentioned white balance processing method.

第六方面,本发明实施例提供了一种计算机可读存储介质,所述计算机可读存储介质上存储计算机程序,所述计算机程序被处理器执行时实现如上述白平衡处理方法的步骤。In a sixth aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the above white balance processing method are implemented.

本发明实施例在拍摄目标图像时,根据目标图像的拍摄物理参数确定更新参考系数,根据目标图的画面逐像素点信息计算其第二白平衡增益系数,当需要对于第二白平衡增益系数进行更新时,采用更新参考系数更新第二白平衡增益系数,并最终采用更新后的第二白平衡增益系数对目标图像进行白平衡处理,本发明实施例通过设置更新参考系数,使得用于处理目标图像白平衡的白平衡增益系数处于一个较为稳定的状态,因此应用本发明实施例,能够在移动终端的镜头发生位移导致画面改变而环境色温没有改变的情况下得到稳定的白平衡增益系数,避免目标图像的白平衡系数变化过大导致画面抖动,稳定画面质量。In this embodiment of the present invention, when shooting a target image, the update reference coefficient is determined according to the shooting physical parameters of the target image, and the second white balance gain coefficient is calculated according to the pixel-by-pixel information of the target image. When updating, the update reference coefficient is used to update the second white balance gain coefficient, and finally the updated second white balance gain coefficient is used to perform white balance processing on the target image. The white balance gain coefficient of the image white balance is in a relatively stable state. Therefore, by applying the embodiments of the present invention, a stable white balance gain coefficient can be obtained under the condition that the lens of the mobile terminal is displaced, causing the screen to change but the ambient color temperature does not change. The large change of the white balance coefficient of the target image causes the picture to shake and stabilize the picture quality.

附图说明Description of drawings

图1是本发明实施例的一种白平衡处理方法实施例的步骤流程图;FIG. 1 is a flowchart of steps in an embodiment of a white balance processing method according to an embodiment of the present invention;

图2是本发明实施例的一种加速度的示意图;2 is a schematic diagram of an acceleration according to an embodiment of the present invention;

图3是本发明实施例的一种旋转角度的示意图;3 is a schematic diagram of a rotation angle according to an embodiment of the present invention;

图4是本发明实施例的一种白平衡处理方法另一实施例的步骤流程图;4 is a flowchart of steps of another embodiment of a white balance processing method according to an embodiment of the present invention;

图5是本发明实施例的一种移动终端实施例的结构框图;5 is a structural block diagram of an embodiment of a mobile terminal according to an embodiment of the present invention;

图6是本发明实施例的一种移动终端另一实施例的结构框图;6 is a structural block diagram of another embodiment of a mobile terminal according to an embodiment of the present invention;

图7是本发明实施例的一种移动终端的硬件结构示意图。FIG. 7 is a schematic diagram of a hardware structure of a mobile terminal according to an embodiment of the present invention.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

参照图1,示出了本发明实施例的一种白平衡处理方法实施例的步骤流程图,该白平衡处理方法应用于移动终端,具体可以包括如下步骤:Referring to FIG. 1, there is shown a flowchart of steps of an embodiment of a white balance processing method according to an embodiment of the present invention. The white balance processing method is applied to a mobile terminal, and may specifically include the following steps:

步骤101,获取目标图像的画面逐像素点信息、拍摄物理参数和所述目标图像前n帧的第一白平衡增益系数。Step 101: Acquire picture-by-pixel information of the target image, shooting physical parameters, and first white balance gain coefficients of the first n frames of the target image.

在具体实现中,本发明实施例可以应用在移动终端中,例如,手机、平板电脑、个人数字助理、穿戴设备(如手环、眼镜、手表等)等等。目标图像为移动终端当前所拍摄的当前帧图像(当前帧)。In specific implementation, the embodiments of the present invention may be applied to mobile terminals, for example, mobile phones, tablet computers, personal digital assistants, wearable devices (such as bracelets, glasses, watches, etc.) and the like. The target image is the current frame image (current frame) currently captured by the mobile terminal.

画面逐像素点信息为当前帧的画面上所有像素点的像素点信息。其中,画面逐像素点信息可以是间隔m(0-i)个像素点进行取值,视条件和需求来确定m的值,m和i为正整数。The pixel-by-pixel information of the picture is the pixel information of all the pixels on the picture of the current frame. Wherein, the pixel-by-pixel information of the picture may be valued at an interval of m(0-i) pixels, and the value of m is determined according to conditions and requirements, and m and i are positive integers.

拍摄物理参数为拍摄当前帧时的相关物理参数,包括但不限于加速度、旋转角度和对焦距离等。其中,加速度可以通过加速度传感器采集,加速度传感器能够采集移动终端x、y、z轴上的加速度Ax、Ay、Az。参照图2,x、y轴位于移动终端的屏幕所在的平面,z轴垂直于移动终端的屏幕。旋转角度可以通过陀螺仪采集,陀螺仪能够采集移动终端在三维空间上的旋转角度Axz、Axy、Ayz,具体可以参照图3。对焦距离也称为物距H,是指拍摄物体到移动终端镜头的透镜光心的距离。The shooting physical parameters are the relevant physical parameters when shooting the current frame, including but not limited to acceleration, rotation angle, and focus distance. The acceleration can be collected by an acceleration sensor, and the acceleration sensor can collect the accelerations A x , A y , and A z on the x, y, and z axes of the mobile terminal. Referring to FIG. 2 , the x and y axes are located on the plane where the screen of the mobile terminal is located, and the z axis is perpendicular to the screen of the mobile terminal. The rotation angle can be collected by a gyroscope, and the gyroscope can collect the rotation angles A xz , A xy , and A yz of the mobile terminal in the three-dimensional space. For details, please refer to FIG. 3 . The focusing distance, also called the object distance H, refers to the distance from the object to be photographed to the optical center of the lens of the mobile terminal lens.

n为大于或等于1的正整数,在本发明实施例中,还会获取在目标图像之前的前n帧的第一白平衡增益系数,即AWB Gain,当然,在实际应用中可以仅获取前1帧的AWB Gain。n is a positive integer greater than or equal to 1. In this embodiment of the present invention, the first white balance gain coefficient of the first n frames before the target image, that is, the AWB Gain, is also obtained. Of course, in practical applications, only the first white balance gain coefficient can be obtained AWB Gain for 1 frame.

步骤102,基于所述画面逐像素点信息和所述拍摄物理参数,确定第二白平衡增益系数和更新参考系数。Step 102: Determine a second white balance gain coefficient and an update reference coefficient based on the picture pixel-by-pixel information and the shooting physical parameters.

在本发明实施例中,将基于画面逐像素点信息来确定第二白平衡增益系数,以及,基于拍摄物理参数来确定更新参考系数。In this embodiment of the present invention, the second white balance gain coefficient will be determined based on the pixel-by-pixel information of the picture, and the update reference coefficient will be determined based on the shooting physical parameters.

在本发明的一种优选实施例中,所述步骤102可以包括如下子步骤:In a preferred embodiment of the present invention, the step 102 may include the following sub-steps:

子步骤S11,采用所述拍摄物理参数,确定画面连续变化量。In sub-step S11, the shooting physical parameters are used to determine the continuous change amount of the picture.

本发明实施例可以根据采集的拍摄物理参数计算画面连续变化量,画面连续变化量可以反映画面的变化情况。在一种实施方式中,所述子步骤S11可以包括如下子步骤:The embodiment of the present invention can calculate the continuous change of the picture according to the collected shooting physical parameters, and the continuous change of the picture can reflect the change of the picture. In one embodiment, the sub-step S11 may include the following sub-steps:

采用所述加速度,计算画面平移量;Using the acceleration, calculate the screen translation amount;

采用所述旋转角度,计算画面偏移量;Using the rotation angle, calculate the screen offset;

采用所述平移量和所述偏移量,计算画面连续变化量。Using the translation amount and the offset amount, the continuous change amount of the picture is calculated.

在具体实现中,画面平移量跟移动终端镜头的在三维空间的加速度相关,画面偏移量则跟移动终端镜头的在三维空间的旋转角度有关,根据画面平移量和画面偏移量可以进一步计算出画面连续变化量。In the specific implementation, the screen translation is related to the acceleration of the mobile terminal lens in three-dimensional space, and the screen offset is related to the rotation angle of the mobile terminal lens in three-dimensional space, which can be further calculated according to the screen translation and screen offset. Displays the continuous change of the screen.

在本发明的一种优选实施方式中,所述采用所述加速度计算,画面平移量可以包括如下步骤:In a preferred embodiment of the present invention, using the acceleration calculation, the screen translation amount may include the following steps:

在所述对焦距离大于或等于预设距离的情况下,将所述平移量设置为预设数值;In the case that the focusing distance is greater than or equal to a preset distance, set the translation amount to a preset value;

在所述对焦距离小于预设距离的情况下,采用所述加速度,计算画面平移量。When the focus distance is less than the preset distance, the acceleration is used to calculate the screen translation amount.

若考虑对焦距离H,当H大于一定距离阈值时,认为移动终端的平移对画面平移量没有影响,则可以将画面平移量T设置为预设数值,例如T=0;当H小于一定距离阈值时,

Figure BDA0001931496860000061
其中,Ax、Ay、Az为各方向的加速度,Wx、Wy、Wz为各方向权重。If considering the focusing distance H, when H is greater than a certain distance threshold, it is considered that the translation of the mobile terminal has no effect on the screen translation amount, and the screen translation amount T can be set to a preset value, such as T=0; when H is less than a certain distance threshold value hour,
Figure BDA0001931496860000061
Among them, A x , A y , and A z are accelerations in each direction, and W x , W y , and W z are weights in each direction.

在本发明的另一种优选实施方式中,所述加速度包括垂直于所述移动终端的z轴加速度,以及平行于所述移动终端的x轴加速度和y轴加速度,所述采用所述加速度,计算画面平移量可以包括如下子步骤:In another preferred embodiment of the present invention, the acceleration includes a z-axis acceleration perpendicular to the mobile terminal, and an x-axis acceleration and a y-axis acceleration parallel to the mobile terminal, and using the acceleration, Calculating the screen shift amount may include the following sub-steps:

在所述对焦距离大于或等于预设距离的情况下,采用所述x轴加速度和所述y轴加速度,计算画面平移量;When the focusing distance is greater than or equal to a preset distance, the x-axis acceleration and the y-axis acceleration are used to calculate the screen translation amount;

在所述对焦距离小于预设距离的情况下,采用所述x轴加速度、所述y轴加速度和所述z轴加速度,计算画面平移量。When the focus distance is less than the preset distance, the screen translation amount is calculated by using the x-axis acceleration, the y-axis acceleration, and the z-axis acceleration.

若考虑对焦距离H,当H大于一定距离阈值时,镜头在z轴方向的移动基本不影响画面的变化,所以z轴方向的移动可以不考虑,则

Figure BDA0001931496860000062
当H小于一定距离阈值时,其中,Ax、Ay、Az为各方向的加速度,Wx、Wy、Wz为各方向权重。If the focusing distance H is considered, when H is greater than a certain distance threshold, the movement of the lens in the z-axis direction basically does not affect the change of the picture, so the movement in the z-axis direction can be ignored, then
Figure BDA0001931496860000062
When H is less than a certain distance threshold, Among them, A x , A y , and A z are accelerations in each direction, and W x , W y , and W z are weights in each direction.

在本发明的一种优选实施方式中,所述采用所述旋转角度计算画面偏移量可以包括如下子步骤:In a preferred embodiment of the present invention, the calculation of the screen offset using the rotation angle may include the following sub-steps:

采用所述旋转角度,计算画面偏移量。Using the rotation angle, the screen offset is calculated.

若不考虑对焦距离H,则可以直接采用旋转角度计算偏移量R,

Figure BDA0001931496860000064
其中,Axz、Axy、Ayz为三维空间各方向上旋转角度,Wxy、Wxz、Wyz为各方向权重。If the focus distance H is not considered, the offset R can be calculated directly by the rotation angle,
Figure BDA0001931496860000064
Among them, A xz , A xy , and A yz are rotation angles in each direction of the three-dimensional space, and W xy , W xz , and W yz are the weights of each direction.

在本发明的另一种优选实施方式中,所述采用所述旋转角度,计算画面偏移量可以包括如下子步骤:In another preferred embodiment of the present invention, using the rotation angle to calculate the screen offset may include the following sub-steps:

在所述对焦距离大于或等于预设距离的情况下,采用所述旋转角度,计算画面偏移量;When the focus distance is greater than or equal to the preset distance, the rotation angle is used to calculate the screen offset;

在所述对焦距离小于预设距离的情况下,将所述画面偏移量设置为预设数值。In the case that the focus distance is less than a preset distance, the screen offset is set to a preset value.

若考虑对焦距离H,当H小于一定距离阈值时,可以认为移动终端目前在微距下运动,画面实际偏移不大,此时以将偏移量R设置为预设数值,例如R=0;当H大于一定等于距离阈值时,

Figure BDA0001931496860000071
其中,Axz、Axy、Ayz为三维空间各方向上旋转角度,Wxy、Wxz、Wyz为各方向权重。If the focusing distance H is considered, when H is less than a certain distance threshold, it can be considered that the mobile terminal is currently moving at a macro distance, and the actual screen shift is not large. In this case, the offset R is set to a preset value, for example, R=0 ; When H is greater than a certain distance threshold,
Figure BDA0001931496860000071
Among them, A xz , A xy , and A yz are rotation angles in each direction of the three-dimensional space, and W xy , W xz , and W yz are the weights of each direction.

本发明实施例在计算得到T和R后,就可以根据这两个数据计算画面变化量C,C=Wr*R+Wt*T,其中,Wr为偏移量R的权重,Wt为平移量T的权重。In this embodiment of the present invention, after T and R are calculated, the screen change amount C can be calculated according to the two data, C=W r *R+W t *T, where W r is the weight of the offset R, and W t is the weight of the translation amount T.

进一步地,根据T和R加权计算得到的画面变化量C后,记录连续几帧的C后可以得到画面连续变化量Cn,即Cn=∑Ci。Further, after the picture change amount C obtained by the weighted calculation of T and R, the picture continuous change amount Cn can be obtained after recording C of several consecutive frames, that is, Cn=ΣCi.

子步骤S12,采用所述画面逐像素点信息,计算所述目标图像的第二白平衡增益系数。Sub-step S12, calculating the second white balance gain coefficient of the target image by using the pixel-by-pixel information of the picture.

在本发明实施例,可以根据当前帧的画面逐像素点信息来计算当前帧的白平衡增益值(AWB Gain)。In this embodiment of the present invention, the white balance gain value (AWB Gain) of the current frame may be calculated according to the pixel-by-pixel information of the current frame.

在本发明的一种优选实施例中,所述子步骤S12可以包括如下子步骤:In a preferred embodiment of the present invention, the sub-step S12 may include the following sub-steps:

将所述当前帧分割为至少一个画面块;dividing the current frame into at least one picture block;

从所述画面逐像素点信息中提取出画面统计信息;所述画面统计信息包括各个画面块的R分量均值、G分量均值和B分量均值;The picture statistical information is extracted from the picture pixel-by-pixel information; the picture statistical information includes the mean value of the R component, the mean value of the G component and the mean value of the B component of each picture block;

计算所述G分量均值与所述R分量均值的比值作为第一系数;Calculate the ratio of the mean value of the G component to the mean value of the R component as the first coefficient;

计算所述G分量均值与所述B分量均值的比值作为第二系数;Calculate the ratio of the mean value of the G component to the mean value of the B component as a second coefficient;

将所述第一系数和所述第二系数作为所述当前帧的第二白平衡增益系数。The first coefficient and the second coefficient are used as the second white balance gain coefficient of the current frame.

在本发明实施例中,会针对当前帧分割为多个画面块,例如可以将当前帧分为M*N块,M和N为正整数,然后统计每一画面块的R分量均值、G分量均值和B分量均值,得到该画面块的画面统计信息。In this embodiment of the present invention, the current frame is divided into multiple picture blocks, for example, the current frame can be divided into M*N blocks, where M and N are positive integers, and then the average value of the R component and the G component of each picture block are counted The mean value and the B component mean value are obtained to obtain the picture statistics of the picture block.

在实际应用中,计算AWB Gain,一般基于灰度世界理论,灰度世界理论为:任何一幅图像,当有足够的色彩变化时,其R、G、B分量均值会趋于平衡(即RGB三个数值相等,也就是说应当是黑白灰类型的颜色),按照灰度世界理论,那么当前帧的画面统计信息中R/G、B/G求平均的结果应该都会是1,如果结果不是1则是环境光源色温的影响,所以针对环境光源色温的影响只需要对画面R、B通道乘以G/R、G/B即可还原画面的色彩。也即是说,本发明实施例将于G分量均值与R分量均值的比值作为第一系数(G/R)、G分量均值与B分量均值的比值作为第二系数(G/B),第一系数和第二系数即为当前帧的AWB Gain。In practical applications, the calculation of AWB Gain is generally based on the gray-scale world theory. The gray-scale world theory is: for any image, when there are enough color changes, the average value of its R, G, and B components will tend to balance (ie, RGB). The three values are equal, that is to say, it should be black, white and gray. According to the grayscale world theory, the average result of R/G and B/G in the picture statistics of the current frame should be 1. If the result is not 1 is the influence of the color temperature of the ambient light source, so for the influence of the color temperature of the ambient light source, it is only necessary to multiply the R and B channels of the picture by G/R and G/B to restore the color of the picture. That is to say, in the embodiment of the present invention, the ratio of the average value of the G component to the average value of the R component is used as the first coefficient (G/R), the ratio of the average value of the G component to the average value of the B component is used as the second coefficient (G/B), and the The first coefficient and the second coefficient are the AWB Gain of the current frame.

在本发明的一种优选实施例中,在所述从所述画面逐像素点信息中提取出画面统计信息之后,还可以包括如下步骤:In a preferred embodiment of the present invention, after the picture statistical information is extracted from the picture pixel-by-pixel information, the following steps may be further included:

从所述当前帧的画面块中筛选出先验白画面块;Screen out a priori white picture blocks from the picture blocks of the current frame;

获取所述先验白画面块的R分量均值、G分量均值和B分量均值。Obtain the mean value of the R component, the mean value of the G component and the mean value of the B component of the prior white picture block.

然而,灰度世界理论并不是任何时候都成立,比如环境中有比较大的色块的时候,所以本发明实施例可以在当前帧的先验白画面块(先验白区)基础上实现灰度世界理论,先验白区为采用在不同色温光源下刻画白色物体在R/G、B/G坐标空间的落点并以落点为基础刻画一个区域,在确定当前帧的先验白区后,就可以基于先验白区中R分量均值、G分量均值和B分量均值按照灰度世界理论计算AWB Gain。However, the grayscale world theory is not always established, such as when there are relatively large color blocks in the environment, so the embodiment of the present invention can realize grayscale on the basis of the prior white image block (prior white area) of the current frame According to the world theory, the transcendental white area is to describe the drop point of a white object in the R/G and B/G coordinate spaces under different color temperature light sources, and to describe an area based on the drop point. After determining the transcendental white area of the current frame Then, the AWB Gain can be calculated according to the gray-scale world theory based on the mean value of the R component, the mean value of the G component, and the mean value of the B component in the prior white area.

子步骤S13,根据所述画面连续变化量,确定更新参考系数。In sub-step S13, the reference coefficient for updating is determined according to the continuous change of the picture.

在具体实现中,画面连续变化量能够反映画面的变化情况,因此本发明实施例可以根据画面连续变化量确定出一个更新参考系数,用于调整当前帧白平衡增益系数的变化幅度。In specific implementation, the continuous change of the picture can reflect the change of the picture. Therefore, in this embodiment of the present invention, an update reference coefficient can be determined according to the continuous change of the picture, which is used to adjust the change range of the white balance gain coefficient of the current frame.

在本发明的一种优选实施例中,所述子步骤S13可以包括如下子步骤:In a preferred embodiment of the present invention, the sub-step S13 may include the following sub-steps:

在所述画面连续变化量大于或等于预设阈值的情况下,将所述更新参考系数设置为第一预设更新参考系数;In the case that the amount of continuous picture change is greater than or equal to a preset threshold, setting the update reference coefficient as a first preset update reference coefficient;

在所述画面连续变化量小于预设阈值的情况下,将所述更新参考系数设置为第二预设更新参考系数;所述第二预设更新参考系数大于所述第一预设更新参考系数。In the case that the amount of continuous picture change is smaller than a preset threshold, the update reference coefficient is set as a second preset update reference coefficient; the second preset update reference coefficient is greater than the first preset update reference coefficient .

若Cn大于一定阈值时,则认为画面变化量较大,此时AWB Gain大概率是场景物体颜色变化导致的AWB波动,此时设置一个较小的更新参考系数去更新AWB Gain。反之则设置一个比较大的更新参考系数去更新AWB Gain。If Cn is greater than a certain threshold, it is considered that the amount of screen change is large. At this time, the AWB Gain is likely to be the AWB fluctuation caused by the color change of the scene object. At this time, a smaller update reference coefficient is set to update the AWB Gain. Otherwise, set a larger update reference coefficient to update AWB Gain.

如果移动终端摄像头处在一个稳定的色温下,不断移动画面可能使得计算得到的AWB Gain在真实值附近波动,而侦测到画面变化量来得到更新参考系数,并通过更新参考系数对于当前帧的AWB Gain进行调整从而将这种波动抑制住;而如果真实色温如果发生变化,在画面变化量不大的情况下可以迅速切换到正确的AWB Gain,而画面变化量大的情况下也可以逐渐切换到准确的AWB Gain。If the camera of the mobile terminal is at a stable color temperature, constantly moving the picture may cause the calculated AWB Gain to fluctuate around the real value, and the update reference coefficient is obtained by detecting the change of the picture, and by updating the reference coefficient for the current frame. AWB Gain is adjusted to suppress this fluctuation; and if the real color temperature changes, it can be quickly switched to the correct AWB Gain when the amount of picture change is small, and can also be gradually switched when the amount of picture change is large. to the exact AWB Gain.

步骤103,在需要更新所述第二白平衡增益系数的情况下,采用所述更新参考系数,更新所述第二白平衡增益系数。Step 103 , when the second white balance gain coefficient needs to be updated, the update reference coefficient is used to update the second white balance gain coefficient.

在具体实施过程中,可以根据第一白平衡增益系数和第二白平衡增益系数确定是否需要更新第二白平衡增益系数,即当前帧的AWB Gain。具体来说,可以通过如下方式确定是否需要更新所述第二白平衡增益系数:In a specific implementation process, whether it is necessary to update the second white balance gain coefficient, that is, the AWB Gain of the current frame, may be determined according to the first white balance gain coefficient and the second white balance gain coefficient. Specifically, whether the second white balance gain coefficient needs to be updated may be determined in the following manner:

计算所述第一白平衡增益系数和所述第二白平衡增益系数之间的差值;calculating the difference between the first white balance gain coefficient and the second white balance gain coefficient;

在所述第一白平衡增益系数和所述第二白平衡增益系数之间的差值大于或等于预设差值的情况下,确定需要更新所述第二白平衡增益系数;In the case where the difference between the first white balance gain coefficient and the second white balance gain coefficient is greater than or equal to a preset difference, determine that the second white balance gain coefficient needs to be updated;

在所述第一白平衡增益系数和所述第二白平衡增益系数之间的差值小于预设差值的情况下,确定无需更新所述第二白平衡增益系数。In the case that the difference between the first white balance gain coefficient and the second white balance gain coefficient is smaller than a preset difference value, it is determined that the second white balance gain coefficient does not need to be updated.

若当前帧的AWB Gain与上一帧或前第n帧的AWB Gain之间的差值大于一定差值,则需要更新当前帧的AWB Gain。If the difference between the AWB Gain of the current frame and the AWB Gain of the previous frame or the previous nth frame is greater than a certain difference, the AWB Gain of the current frame needs to be updated.

若当前帧的AWB Gain与上一帧或前第n帧的AWB Gain之间的差值小于一定差值,则无需对于当前帧的AWB Gain进行更新。If the difference between the AWB Gain of the current frame and the AWB Gain of the previous frame or the previous nth frame is less than a certain difference, it is not necessary to update the AWB Gain of the current frame.

步骤104,采用更新后的所述第二白平衡增益系数,对所述目标图像进行白平衡处理;其中,所述目标图像为当前帧图像。Step 104 , using the updated second white balance gain coefficient to perform white balance processing on the target image, wherein the target image is the current frame image.

当确定需要更新当前帧的AWB Gain时,则结合更新参考系数和当前帧的AWB Gain计算出一个新的当前帧的AWB Gain,并采用当前帧的AWB Gain对于当前帧进行白平衡处理。其中,每隔一帧或多帧重新计算得到的AWB Gain靠近更新参考系数(step)。When it is determined that the AWB Gain of the current frame needs to be updated, a new AWB Gain of the current frame is calculated by combining the update reference coefficient and the AWB Gain of the current frame, and the AWB Gain of the current frame is used to perform white balance processing on the current frame. Wherein, the AWB Gain recalculated every other frame or multiple frames is close to the update reference coefficient (step).

在本发明的一种优选实施例中,所述方法还可以包括如下步骤:In a preferred embodiment of the present invention, the method may further include the following steps:

在无需更新所述第二白平衡增益系数的情况下,采用所述第二白平衡增益系数,对所述目标图像进行白平衡处理。When the second white balance gain coefficient does not need to be updated, the second white balance gain coefficient is used to perform white balance processing on the target image.

当确定无需更新当前帧的AWB Gain时,则直接采用当前帧的AWB Gain对于当前帧进行白平衡处理即可。When it is determined that the AWB Gain of the current frame does not need to be updated, the AWB Gain of the current frame may be directly used to perform white balance processing on the current frame.

本发明实施例在拍摄目标图像时,根据目标图像的拍摄物理参数确定更新参考系数,根据目标图的画面逐像素点信息计算其第二白平衡增益系数,当需要对于第二白平衡增益系数进行更新时,采用更新参考系数更新第二白平衡增益系数,并最终采用更新后的第二白平衡增益系数对目标图像进行白平衡处理,本发明实施例通过设置更新参考系数,使得用于处理目标图像白平衡的白平衡增益系数处于一个较为稳定的状态,因此应用本发明实施例,能够在移动终端的镜头发生位移导致画面改变而环境色温没有改变的情况下得到稳定的白平衡增益系数,避免目标图像的白平衡系数变化过大导致画面抖动,稳定画面质量。In this embodiment of the present invention, when shooting a target image, the update reference coefficient is determined according to the shooting physical parameters of the target image, and the second white balance gain coefficient is calculated according to the pixel-by-pixel information of the target image. When updating, the update reference coefficient is used to update the second white balance gain coefficient, and finally the updated second white balance gain coefficient is used to perform white balance processing on the target image. The white balance gain coefficient of the image white balance is in a relatively stable state. Therefore, by applying the embodiments of the present invention, a stable white balance gain coefficient can be obtained under the condition that the lens of the mobile terminal is displaced, causing the screen to change but the ambient color temperature does not change. The large change of the white balance coefficient of the target image causes the picture to shake and stabilize the picture quality.

参照图4,示出了本发明实施例的一种白平衡处理方法另一实施例的步骤流程图,该白平衡处理方法应用于移动终端,具体可以包括如下步骤:Referring to FIG. 4 , a flowchart of steps of another embodiment of a white balance processing method according to an embodiment of the present invention is shown. The white balance processing method is applied to a mobile terminal, and may specifically include the following steps:

步骤201,获取目标图像的第一画面逐像素点信息、所述目标图像前n帧的第二画面逐像素点信息以及前n帧的第一白平衡增益系数。Step 201: Acquire the pixel-by-pixel information of the first picture of the target image, the pixel-by-pixel information of the second picture of the first n frames of the target image, and the first white balance gain coefficient of the first n frames.

n为大于或等于1的正整数。在本发明实施例中,在移动终端拍摄当前帧(目标图像)时将获取当前帧的第一画面逐像素点信息,以及前n帧分别对应的第二画面逐像素点信息,此外,还包括前n帧分别对应的第一白平衡增益系数。需要注意的是,本发明实施例获取可以获取前n帧的第二画面逐像素点信息和第一白平衡增益系数,也可以获取前n帧中某一帧的第二画面逐像素点信息和第一白平衡增益系数,可根据实际需要获取相应数据,本发明实施例对此并不加以限制。n is a positive integer greater than or equal to 1. In this embodiment of the present invention, when the mobile terminal captures the current frame (target image), the pixel-by-pixel information of the first picture of the current frame and the pixel-by-pixel information of the second picture corresponding to the previous n frames are obtained. The first white balance gain coefficients corresponding to the first n frames respectively. It should be noted that, in this embodiment of the present invention, the pixel-by-pixel information and the first white balance gain coefficient of the second picture of the first n frames can be obtained, and the pixel-by-pixel information and the first white balance gain coefficient of the second picture of a certain frame of the first n frames can also be obtained. For the first white balance gain coefficient, corresponding data may be obtained according to actual needs, which is not limited in this embodiment of the present invention.

步骤202,基于所述第一画面逐像素点信息和所述第二画面逐像素点信息,确定第二白平衡增益系数和确定更新参考系数。Step 202: Determine a second white balance gain coefficient and determine an update reference coefficient based on the pixel-by-pixel information of the first picture and the pixel-by-pixel information of the second picture.

在本发明实施例中,将基于第一画面逐像素点信息来确定第二白平衡增益系数,以及,基于第一画面逐像素点信息和第二画面逐像素点信息来确定更新参考系数。In this embodiment of the present invention, the second white balance gain coefficient is determined based on the pixel-by-pixel information of the first picture, and the update reference coefficient is determined based on the pixel-by-pixel information of the first picture and the pixel-by-pixel information of the second picture.

在本发明的一种优选实施例中,所述步骤202可以包括如下子步骤:In a preferred embodiment of the present invention, the step 202 may include the following sub-steps:

子步骤S21,将所述目标图像分割为至少一个第一画面块,以及,将所述前n帧分割为至少一个第二画面块。Sub-step S21, dividing the target image into at least one first picture block, and dividing the first n frames into at least one second picture block.

在具体实施过程中,可以将整个当前帧和前n帧的画面分割为W*H个区域(画面块),其中W、H为正整数,取值根据条件或者需求确定。In the specific implementation process, the entire current frame and the picture of the previous n frames can be divided into W*H regions (picture blocks), where W and H are positive integers, and the values are determined according to conditions or requirements.

子步骤S22根据各个所述第一画面块的第一画面逐像素点信息和各个所述第二画面块的第二画面逐像素点信息,从所述第一画面块中筛选出运动画面块。Sub-step S22 selects a moving picture block from the first picture blocks according to the pixel-by-pixel information of the first picture of each of the first picture blocks and the pixel-by-pixel information of the second picture of each of the second picture blocks.

在本发明实施例中,可以根据当前帧的画面块和前n帧的画面块分别对应的画面逐像素点信息,从当前帧的第一画面块中筛选出运动画面块。其中运动画面块为画面变化较大的当前帧画面区域。In this embodiment of the present invention, a moving picture block may be screened out from the first picture block of the current frame according to the picture-by-pixel information corresponding to the picture block of the current frame and the picture blocks of the previous n frames respectively. The moving picture block is the picture area of the current frame where the picture changes greatly.

在本发明的一种优选实施例中,所述第一画面逐像素点信息和所述第二画面逐像素点信息具有各个像素点的像素点信息,所述子步骤S22可以包括如下子步骤:In a preferred embodiment of the present invention, the pixel-by-pixel information of the first picture and the pixel-by-pixel information of the second picture have pixel information of each pixel, and the sub-step S22 may include the following sub-steps:

将同一位置的所述第一画面块的像素点信息与所述第二画面块的像素点信息进行差分处理,得到差分量;performing differential processing on the pixel point information of the first picture block and the pixel point information of the second picture block at the same position to obtain a difference component;

在所述差分量超过第一预设阈值的情况下,将所述第一画面块中对应的像素点作为运动像素点;In the case that the difference component exceeds the first preset threshold, the corresponding pixel in the first picture block is used as a motion pixel;

分别统计每个所述第一画面块中运动像素点的数量;separately count the number of motion pixels in each of the first picture blocks;

在所述运动像素点的数量超过第二预设阈值的情况下,将所述第一画面块作为运动画面块。When the number of the motion pixels exceeds a second preset threshold, the first picture block is regarded as a motion picture block.

当前帧和前n帧均被分割为多个画面块,本发明实施例还将分别统计当前帧和前n帧每一画面块的R分量均值、G分量均值和B分量均值,得到画面统计信息。Both the current frame and the previous n frames are divided into a plurality of picture blocks. In this embodiment of the present invention, the average value of the R component, the average value of the G component, and the average value of the B component of each picture block of the current frame and the previous n frames will be counted respectively to obtain the picture statistical information. .

在一种实施方式中,对每个画面块采用帧差法判断是否是运动画面块,具体地,针对同一位置处当前帧和前n帧的各个画面块的画面统计信息进行差分处理得到各个像素点之间的差分量,并且阈值化来提取出当前帧中的运动画面块,即当画面块中的像素点之间差分量超过一定运动阈值时认为是运动像素点,并且当画面块内运动像素点的数量大于一定数量阈值时认为是运动画面块;反之,若不满足上述条件则不是运动画面块。In one embodiment, the frame difference method is used for each picture block to determine whether it is a moving picture block. Specifically, each pixel is obtained by performing differential processing on the picture statistics information of each picture block of the current frame and the previous n frames at the same position. The difference component between the points, and thresholding to extract the moving picture block in the current frame, that is, when the difference component between the pixels in the picture block exceeds a certain motion threshold, it is considered to be a moving pixel, and when the motion in the picture block When the number of pixels is greater than a certain threshold, it is considered as a moving picture block; otherwise, if the above conditions are not met, it is not a moving picture block.

在本发明的另一种优选实施例中,所述第一画面逐像素点信息和所述第二画面逐像素点信息具有各个像素点的像素点信息,所述子步骤S22可以包括如下子步骤:In another preferred embodiment of the present invention, the pixel-by-pixel information of the first picture and the pixel-by-pixel information of the second picture have pixel information of each pixel, and the sub-step S22 may include the following sub-steps :

统计同一位置的所述第二画面块的像素点信息,计算平均像素点信息;Counting the pixel point information of the second picture block at the same position, and calculating the average pixel point information;

将同一位置的第一画面块的像素点信息与所述平均像素点信息进行差分处理,得到差分量;performing differential processing between the pixel point information of the first picture block at the same position and the average pixel point information to obtain a difference component;

在所述差分量超过第三预设阈值的情况下,将所述第一画面块中对应的像素点作为运动像素点;In the case that the difference component exceeds a third preset threshold, the corresponding pixel in the first picture block is used as a motion pixel;

分别统计每个所述第一画面块中运动像素点的数量;separately count the number of motion pixels in each of the first picture blocks;

在所述运动像素点的数量超过第四预设阈值的情况下,将所述第一画面块作为运动画面块。In the case that the number of the motion pixels exceeds a fourth preset threshold, the first picture block is regarded as a motion picture block.

在另一种实施方式中,对每个画面块采用背景减除法判断是否是运动画面块,具体地,针对同一位置处根据前n帧的各个画面块的画面统计信息得出平均像素点信息m(前n帧相同位置像素点取平均),利用当前帧的画面块的画面统计信息减去m得到各个像素点之间的差分量,当该差分量大于一定运动阈值时则认为是运动像素点,然后统计每个画面块中运动像素点的数量n,若n大于一定数量阈值则认为是运动画面块并计入运动画面块的数量;反之,若不满足上述条件则不是运动画面块。In another embodiment, the background subtraction method is used for each picture block to determine whether it is a moving picture block. Specifically, for the same position, the average pixel point information m is obtained according to the picture statistical information of each picture block of the previous n frames. (The pixels at the same position in the previous n frames are averaged), and the difference between each pixel is obtained by subtracting m from the picture statistics of the picture block of the current frame. When the difference is greater than a certain motion threshold, it is considered to be a motion pixel. , and then count the number n of motion pixels in each picture block. If n is greater than a certain threshold, it is considered a motion picture block and counted in the number of motion picture blocks; otherwise, if the above conditions are not met, it is not a motion picture block.

子步骤S23,统计所述目标图像中所述运动画面块的数量。Sub-step S23, count the number of the moving picture blocks in the target image.

在从当前帧中筛选出运动画面块后,统计运动画面块的数量。After the moving picture blocks are filtered out from the current frame, the number of moving picture blocks is counted.

子步骤S24,采用所述第一画面逐像素点信息,计算所述目标图像的第二白平衡增益系数。Sub-step S24, using the pixel-by-pixel information of the first picture to calculate the second white balance gain coefficient of the target image.

在本发明实施例,可以根据当前帧的画面逐像素点信息来计算当前帧的白平衡增益值(AWB Gain)。In this embodiment of the present invention, the white balance gain value (AWB Gain) of the current frame may be calculated according to the pixel-by-pixel information of the current frame.

在本发明的一种优选实施例中,所述子步骤S24可以包括如下子步骤:In a preferred embodiment of the present invention, the sub-step S24 may include the following sub-steps:

从所述第一画面逐像素点信息中提取出画面统计信息;所述画面统计信息包括各个第一画面块的R分量均值、G分量均值和B分量均值;The picture statistics information is extracted from the pixel-by-pixel point information of the first picture; the picture statistics information includes the mean value of the R component, the mean value of the G component and the mean value of the B component of each first picture block;

计算所述G分量均值与所述R分量均值的比值作为第一系数;Calculate the ratio of the mean value of the G component to the mean value of the R component as the first coefficient;

计算所述G分量均值与所述B分量均值的比值作为第二系数;Calculate the ratio of the mean value of the G component to the mean value of the B component as a second coefficient;

将所述第一系数和所述第二系数作为所述当前帧的第二白平衡增益系数。The first coefficient and the second coefficient are used as the second white balance gain coefficient of the current frame.

在本发明实施例中,会针对当前帧分割为多个画面块,例如可以将当前帧分为M*N块,M和N为正整数,然后统计每一画面块的R分量均值、G分量均值和B分量均值。In this embodiment of the present invention, the current frame is divided into multiple picture blocks, for example, the current frame can be divided into M*N blocks, where M and N are positive integers, and then the average value of the R component and the G component of each picture block are counted mean and B component mean.

在实际应用中,计算AWB Gain,一般基于灰度世界理论,灰度世界理论为:任何一幅图像,当有足够的色彩变化时,其R、G、B分量均值会趋于平衡(即RGB三个数值相等,也就是说应当是黑白灰类型的颜色),按照灰度世界理论,那么当前帧的画面统计信息中R/G、B/G求平均的结果应该都会是1,如果结果不是1则是环境光源色温的影响,所以针对环境光源色温的影响只需要对画面R、B通道乘以G/R、G/B即可还原画面的色彩。也即是说,本发明实施例将于G分量均值与R分量均值的比值作为第一系数(G/R)、G分量均值与B分量均值的比值作为第二系数(G/B),第一系数和第二系数即为当前帧的AWB Gain。In practical applications, the calculation of AWB Gain is generally based on the gray-scale world theory. The gray-scale world theory is: for any image, when there are enough color changes, the average value of its R, G, and B components will tend to balance (ie, RGB). The three values are equal, that is to say, it should be black, white and gray. According to the grayscale world theory, the average result of R/G and B/G in the picture statistics of the current frame should be 1. If the result is not 1 is the influence of the color temperature of the ambient light source, so for the influence of the color temperature of the ambient light source, it is only necessary to multiply the R and B channels of the picture by G/R and G/B to restore the color of the picture. That is to say, in the embodiment of the present invention, the ratio of the average value of the G component to the average value of the R component is used as the first coefficient (G/R), the ratio of the average value of the G component to the average value of the B component is used as the second coefficient (G/B), and the The first coefficient and the second coefficient are the AWB Gain of the current frame.

在本发明的一种优选实施例中,在所述从所述第一画面逐像素点信息中提取出画面统计信息之后,还包括:In a preferred embodiment of the present invention, after the picture statistical information is extracted from the pixel-by-pixel information of the first picture, the method further includes:

从所述当前帧的第一画面块中筛选出先验白画面块;Screen out a priori white picture block from the first picture block of the current frame;

获取所述先验白画面块的R分量均值、G分量均值和B分量均值。Obtain the mean value of the R component, the mean value of the G component and the mean value of the B component of the prior white picture block.

然而,灰度世界理论并不是任何时候都成立,比如环境中有比较大的色块的时候,所以本发明实施例可以在当前帧的先验白画面块(先验白区)基础上实现灰度世界理论,先验白区为采用在不同色温光源下刻画白色物体在R/G、B/G坐标空间的落点并以落点为基础刻画一个区域,在确定当前帧的先验白区后,就可以基于先验白区中R分量均值、G分量均值和B分量均值按照灰度世界理论计算AWB Gain。However, the grayscale world theory is not always established, such as when there are relatively large color blocks in the environment, so the embodiment of the present invention can realize grayscale on the basis of the prior white image block (prior white area) of the current frame According to the world theory, the transcendental white area is to describe the drop point of a white object in the R/G and B/G coordinate spaces under different color temperature light sources, and to describe an area based on the drop point. After determining the transcendental white area of the current frame Then, the AWB Gain can be calculated according to the gray-scale world theory based on the mean value of the R component, the mean value of the G component, and the mean value of the B component in the prior white area.

子步骤S25,根据所述数量,确定更新参考系数。Sub-step S25, according to the quantity, determine the update reference coefficient.

在具体实现中,运动画面块的数量(C)可以反映画面的变化情况,运动画面块越多,说明画面变化量较大,运动画面块越少,说明画面变化量较小,因此本发明实施例将根据运动画面块的数量确定出一个更新参考系数,用于调整当前帧白平衡增益系数的变化幅度。In specific implementation, the number of moving picture blocks (C) can reflect the change of the picture. The more moving picture blocks, the larger the amount of picture change, the less the number of moving picture blocks, the smaller the amount of picture change, so the present invention implements For example, an update reference coefficient is determined according to the number of moving picture blocks, which is used to adjust the variation range of the white balance gain coefficient of the current frame.

在本发明的一种优选实施例中,所述子步骤S25可以包括如下子步骤:In a preferred embodiment of the present invention, the sub-step S25 may include the following sub-steps:

在所述数量大于或等于第五预设阈值的情况下,将所述更新参考系数设置为第一预设更新参考系数;in the case that the number is greater than or equal to a fifth preset threshold, setting the update reference coefficient as a first preset update reference coefficient;

在所述数量小于第六预设阈值的情况下,将所述更新参考系数设置为第二预设更新参考系数;In the case that the number is less than a sixth preset threshold, setting the update reference coefficient as a second preset update reference coefficient;

其中,所述第二预设更新参考系数大于所述第一预设更新参考系数。若C大于一定阈值时,则认为画面变化量太大,此时AWB Gain大概率是场景物体颜色变化导致的AWB波动,此时设置一个较小的更新参考系数去更新AWB Gain。反之则设置一个比较大的更新参考系数去更新AWB Gain。Wherein, the second preset update reference coefficient is greater than the first preset update reference coefficient. If C is greater than a certain threshold, it is considered that the amount of screen change is too large. At this time, the AWB Gain is likely to be the AWB fluctuation caused by the color change of the scene object. At this time, a smaller update reference coefficient is set to update the AWB Gain. Otherwise, set a larger update reference coefficient to update AWB Gain.

如果移动终端摄像头处在一个稳定的色温下,不断移动画面可能使得计算得到的AWB色温在真实值附近波动,而侦测到运动画面块的数量可以确定画面变化量,然后基于画面变化量来得到更新参考系数,再通过更新参考系数对于当前帧的AWB Gain进行调整从而将这种波动抑制住;而如果真实色温如果发生变化,在画面变化量不大的情况下可以迅速切换到正确的AWB Gain,而画面变化量大的情况下也可以逐渐切换到准确的AWB Gain。If the camera of the mobile terminal is at a stable color temperature, constantly moving the picture may cause the calculated AWB color temperature to fluctuate around the real value, and the number of detected moving picture blocks can determine the amount of picture change, and then get based on the amount of picture change. Update the reference coefficient, and then adjust the AWB Gain of the current frame by updating the reference coefficient to suppress this fluctuation; and if the real color temperature changes, you can quickly switch to the correct AWB Gain when the amount of change in the picture is not large. , and in the case of large screen changes, you can gradually switch to the accurate AWB Gain.

步骤203,在需要更新所述第二白平衡增益系数的情况下,采用所述更新参考系数,更新所述第二白平衡增益系数。Step 203 , when the second white balance gain coefficient needs to be updated, the second white balance gain coefficient is updated by using the update reference coefficient.

在具体实施过程中,可以根据第一白平衡增益系数和第二白平衡增益系数确定是否需要更新第二白平衡增益系数,即当前帧的AWB Gain。In a specific implementation process, whether it is necessary to update the second white balance gain coefficient, that is, the AWB Gain of the current frame, may be determined according to the first white balance gain coefficient and the second white balance gain coefficient.

在本发明的一种优选实施例中,所述步骤207可以包括如下子步骤:In a preferred embodiment of the present invention, the step 207 may include the following sub-steps:

计算所述第一白平衡增益系数和所述第二白平衡增益系数之间的差值;calculating the difference between the first white balance gain coefficient and the second white balance gain coefficient;

在所述第一白平衡增益系数和所述第二白平衡增益系数之间的差值大于或等于预设差值的情况下,确定需要更新所述第二白平衡增益系数;In the case where the difference between the first white balance gain coefficient and the second white balance gain coefficient is greater than or equal to a preset difference, determine that the second white balance gain coefficient needs to be updated;

在所述第一白平衡增益系数和所述第二白平衡增益系数之间的差值小于预设差值的情况下,确定无需更新所述第二白平衡增益系数。In the case that the difference between the first white balance gain coefficient and the second white balance gain coefficient is smaller than a preset difference value, it is determined that the second white balance gain coefficient does not need to be updated.

若当前帧的AWB Gain与上一帧或前第n帧的AWB Gain之间的差值大于一定差值,则需要更新当前帧的AWB Gain。If the difference between the AWB Gain of the current frame and the AWB Gain of the previous frame or the previous nth frame is greater than a certain difference, the AWB Gain of the current frame needs to be updated.

若当前帧的AWB Gain与上一帧或前第n帧的AWB Gain之间的差值小于一定差值,则无需对于当前帧的AWB Gain进行更新。If the difference between the AWB Gain of the current frame and the AWB Gain of the previous frame or the previous nth frame is less than a certain difference, it is not necessary to update the AWB Gain of the current frame.

步骤204,采用更新后的所述第二白平衡增益系数,对所述目标图像进行白平衡处理。Step 204, using the updated second white balance gain coefficient to perform white balance processing on the target image.

当确定需要更新当前帧的AWB Gain时,则结合更新参考系数和当前帧的AWB Gain计算出一个新的当前帧的AWB Gain,并采用当前帧的AWB Gain对于当前帧进行白平衡处理。其中,每隔一帧或多帧重新计算得到的AWB Gain靠近更新参考系数(step)。When it is determined that the AWB Gain of the current frame needs to be updated, a new AWB Gain of the current frame is calculated by combining the update reference coefficient and the AWB Gain of the current frame, and the AWB Gain of the current frame is used to perform white balance processing on the current frame. Wherein, the AWB Gain recalculated every other frame or multiple frames is close to the update reference coefficient (step).

在本发明的一种优选实施例中,所述方法还可以包括如下步骤:In a preferred embodiment of the present invention, the method may further include the following steps:

在无需更新所述第二白平衡增益系数的情况下,采用所述第二白平衡增益系数,对所述目标图像进行白平衡处理。When the second white balance gain coefficient does not need to be updated, the second white balance gain coefficient is used to perform white balance processing on the target image.

当确定无需更新当前帧的AWB Gain时,则直接采用当前帧的AWB Gain对于当前帧进行白平衡处理即可。When it is determined that the AWB Gain of the current frame does not need to be updated, the AWB Gain of the current frame may be directly used to perform white balance processing on the current frame.

本发明实施是通过识别当前帧和前n帧的画面之间的变化来确定画面变化量,与前一实施例相比,并不需要获取到当前帧的物理拍摄参数,并且得到的画面变化量准确性更高,更有利于稳定AWB Gain。The implementation of the present invention is to determine the picture change amount by identifying the picture change between the current frame and the previous n frames. Compared with the previous embodiment, it is not necessary to obtain the physical shooting parameters of the current frame, and the obtained picture change amount The accuracy is higher and it is more beneficial to stabilize the AWB Gain.

需要说明的是,对于方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明实施例并不受所描述的动作顺序的限制,因为依据本发明实施例,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作并不一定是本发明实施例所必须的。It should be noted that, for the sake of simple description, the method embodiments are described as a series of action combinations, but those skilled in the art should know that the embodiments of the present invention are not limited by the described action sequences, because According to embodiments of the present invention, certain steps may be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

参照图5,示出了本发明实施例的一种移动终端实施例的结构框图,在移动终端300具体可以包括如下模块:Referring to FIG. 5 , a structural block diagram of an embodiment of a mobile terminal according to an embodiment of the present invention is shown, and the mobile terminal 300 may specifically include the following modules:

第一数据获取模块301,用于获取目标图像的画面逐像素点信息、拍摄物理参数和所述目标图像前n帧的第一白平衡增益系数;The first data acquisition module 301 is used to acquire the picture-by-pixel information of the target image, the physical parameters of shooting and the first white balance gain coefficient of the first n frames of the target image;

第一数据确定模块302,用于基于所述画面逐像素点信息和所述拍摄物理参数,确定第二白平衡增益系数和更新参考系数;a first data determination module 302, configured to determine a second white balance gain coefficient and an update reference coefficient based on the pixel-by-pixel information of the picture and the shooting physical parameters;

第一更新模块303,用于在需要更新所述第二白平衡增益系数的情况下,采用所述更新参考系数,更新所述第二白平衡增益系数;a first update module 303, configured to update the second white balance gain coefficient by using the update reference coefficient when the second white balance gain coefficient needs to be updated;

第一白平衡处理模块304,用于采用更新后的所述第二白平衡增益系数,对所述目标图像进行白平衡处理;a first white balance processing module 304, configured to perform white balance processing on the target image by using the updated second white balance gain coefficient;

其中,所述目标图像为当前帧图像;n为大于或等于1的正整数。Wherein, the target image is the current frame image; n is a positive integer greater than or equal to 1.

在本发明的一种优选实施例中,所述第一数据确定模块302可以包括:In a preferred embodiment of the present invention, the first data determination module 302 may include:

采用所述拍摄物理参数,确定画面连续变化量;Using the shooting physical parameters to determine the continuous change amount of the picture;

采用所述画面逐像素点信息,计算所述目标图像的第二白平衡增益系数;Calculate the second white balance gain coefficient of the target image by using the pixel-by-pixel information of the picture;

根据所述画面连续变化量,确定更新参考系数。According to the continuous change amount of the picture, the update reference coefficient is determined.

在本发明的一种优选实施例中,所述拍摄物理参数包括加速度、旋转角度;所述采用所述拍摄物理参数,确定画面连续变化量,包括:In a preferred embodiment of the present invention, the shooting physical parameters include acceleration and rotation angle; and determining the continuous change amount of the picture by using the shooting physical parameters includes:

采用所述加速度,计算画面平移量;Using the acceleration, calculate the screen translation amount;

采用所述旋转角度,计算画面偏移量;Using the rotation angle, calculate the screen offset;

采用所述平移量和所述偏移量,计算画面连续变化量。Using the translation amount and the offset amount, the continuous change amount of the picture is calculated.

在本发明的一种优选实施例中,所述拍摄物理参数还包括对焦距离;In a preferred embodiment of the present invention, the shooting physical parameter further includes a focus distance;

所述采用所述加速度,计算画面平移量,包括:The using the acceleration to calculate the screen translation includes:

在所述对焦距离大于或等于预设距离的情况下,将所述平移量设置为预设数值;In the case that the focusing distance is greater than or equal to a preset distance, set the translation amount to a preset value;

在所述对焦距离小于预设距离的情况下,采用所述加速度,计算画面平移量。When the focus distance is less than the preset distance, the acceleration is used to calculate the screen translation amount.

在本发明的一种优选实施例中,所述拍摄物理参数还包括对焦距离;所述加速度包括垂直于所述移动终端的z轴加速度和平行于所述移动终端的x轴加速度和y轴加速度;In a preferred embodiment of the present invention, the shooting physical parameter further includes a focus distance; the acceleration includes a z-axis acceleration perpendicular to the mobile terminal and an x-axis acceleration and a y-axis acceleration parallel to the mobile terminal ;

所述采用所述加速度,计算画面平移量,包括:The using the acceleration to calculate the screen translation includes:

在所述对焦距离大于或等于预设距离的情况下,采用所述x轴加速度和所述y轴加速度,计算画面平移量;When the focusing distance is greater than or equal to a preset distance, the x-axis acceleration and the y-axis acceleration are used to calculate the screen translation amount;

在所述对焦距离小于预设距离的情况下,采用所述x轴加速度、所述y轴加速度和所述z轴加速度,计算画面平移量。When the focus distance is less than the preset distance, the screen translation amount is calculated by using the x-axis acceleration, the y-axis acceleration, and the z-axis acceleration.

在本发明的一种优选实施例中,所述采用所述旋转角度,计算画面偏移量,包括:In a preferred embodiment of the present invention, calculating the screen offset by using the rotation angle includes:

采用所述旋转角度,计算画面偏移量。Using the rotation angle, the screen offset is calculated.

在本发明的一种优选实施例中,所述拍摄物理参数还包括对焦距离;In a preferred embodiment of the present invention, the shooting physical parameter further includes a focus distance;

所述采用所述旋转角度,计算画面偏移量,包括:The using the rotation angle to calculate the screen offset includes:

在所述对焦距离大于或等于预设距离的情况下,采用所述旋转角度,计算画面偏移量;When the focus distance is greater than or equal to the preset distance, the rotation angle is used to calculate the screen offset;

在所述对焦距离小于预设距离的情况下,将所述画面偏移量设置为预设数值。In the case that the focus distance is less than a preset distance, the screen offset is set to a preset value.

在本发明的一种优选实施例中,所述移动终端还包括:In a preferred embodiment of the present invention, the mobile terminal further includes:

计算所述第一白平衡增益系数和所述第二白平衡增益系数之间的差值;calculating the difference between the first white balance gain coefficient and the second white balance gain coefficient;

在所述第一白平衡增益系数和所述第二白平衡增益系数之间的差值大于或等于预设差值的情况下,确定需要更新所述第二白平衡增益系数;In the case where the difference between the first white balance gain coefficient and the second white balance gain coefficient is greater than or equal to a preset difference, determine that the second white balance gain coefficient needs to be updated;

在所述第一白平衡增益系数和所述第二白平衡增益系数之间的差值小于预设差值的情况下,确定无需更新所述第二白平衡增益系数。In the case that the difference between the first white balance gain coefficient and the second white balance gain coefficient is smaller than a preset difference value, it is determined that the second white balance gain coefficient does not need to be updated.

在本发明的一种优选实施例中,所述移动终端还包括:In a preferred embodiment of the present invention, the mobile terminal further includes:

在无需更新所述第二白平衡增益系数的情况下,采用所述第二白平衡增益系数,对所述目标图像进行白平衡处理。When the second white balance gain coefficient does not need to be updated, the second white balance gain coefficient is used to perform white balance processing on the target image.

在本发明的一种优选实施例中,所述根据所述画面连续变化量,确定更新参考系数,包括:In a preferred embodiment of the present invention, the determining the update reference coefficient according to the continuous change of the picture includes:

在所述画面连续变化量大于或等于预设阈值的情况下,将所述更新参考系数设置为第一预设更新参考系数;In the case that the amount of continuous picture change is greater than or equal to a preset threshold, setting the update reference coefficient as a first preset update reference coefficient;

在所述画面连续变化量小于预设阈值的情况下,将所述更新参考系数设置为第二预设更新参考系数;In the case that the amount of continuous picture change is less than a preset threshold, setting the update reference coefficient as a second preset update reference coefficient;

其中,所述第二预设更新参考系数大于所述第一预设更新参考系数。Wherein, the second preset update reference coefficient is greater than the first preset update reference coefficient.

参照图6,示出了本发明实施例的一种移动终端另一实施例的结构框图,该移动终端400具体可以包括如下模块:Referring to FIG. 6 , a structural block diagram of another embodiment of a mobile terminal according to an embodiment of the present invention is shown. The mobile terminal 400 may specifically include the following modules:

第二数据获取模块401,用于获取目标图像的第一画面逐像素点信息、所述目标图像前n帧的第二画面逐像素点信息以及前n帧的第一白平衡增益系数;所述n为大于或等于1的正整数;The second data acquisition module 401 is configured to acquire the pixel-by-pixel information of the first picture of the target image, the pixel-by-pixel information of the second picture of the first n frames of the target image, and the first white balance gain coefficient of the first n frames; the n is a positive integer greater than or equal to 1;

第二数据确定模块402,用于基于所述第一画面逐像素点信息和所述第二画面逐像素点信息,确定第二白平衡增益系数和确定更新参考系数;A second data determination module 402, configured to determine a second white balance gain coefficient and determine an update reference coefficient based on the pixel-by-pixel information of the first picture and the pixel-by-pixel information of the second picture;

第二更新模块403,用于在需要更新所述第二白平衡增益系数的情况下,采用所述更新参考系数,更新所述第二白平衡增益系数;A second update module 403, configured to use the update reference coefficient to update the second white balance gain coefficient when the second white balance gain coefficient needs to be updated;

第二白平衡处理模块404,用于采用更新后的所述第二白平衡增益系数,对所述目标图像进行白平衡处理;其中,所述目标图像为当前帧图像。The second white balance processing module 404 is configured to use the updated second white balance gain coefficient to perform white balance processing on the target image, wherein the target image is the current frame image.

在本发明的一种优选实施例中,所述第二数据确定模块402包括:In a preferred embodiment of the present invention, the second data determination module 402 includes:

将所述目标图像分割为至少一个第一画面块,以及,将所述前n帧分割为至少一个第二画面块;dividing the target image into at least one first picture block, and dividing the first n frames into at least one second picture block;

根据每个所述第一画面块的第一画面逐像素点信息和每个所述第二画面块的第二画面逐像素点信息,从所述第一画面块中,筛选出运动画面块;According to the pixel-by-pixel information of the first picture of each of the first picture blocks and the pixel-by-pixel information of the second picture of each of the second picture blocks, from the first picture blocks, screen out the moving picture blocks;

统计所述目标图像中所述运动画面块的数量;Counting the number of the moving picture blocks in the target image;

采用所述第一画面逐像素点信息,计算所述目标图像的第二白平衡增益系数;Calculate the second white balance gain coefficient of the target image by using the pixel-by-pixel information of the first picture;

根据所述数量,确定更新参考系数。Based on the number, an update reference coefficient is determined.

在本发明的一种优选实施例中,所述第一画面逐像素点信息和所述第二画面逐像素点信息具有每个像素点的像素点信息;In a preferred embodiment of the present invention, the pixel-by-pixel information of the first picture and the pixel-by-pixel information of the second picture have pixel information of each pixel;

所述根据每个所述第一画面块的第一画面逐像素点信息和每个所述第二画面块的第二画面逐像素点信息,从所述第一画面块中,筛选出运动画面块,包括:The moving picture is filtered out from the first picture block according to the pixel-by-pixel information of the first picture of each of the first picture blocks and the pixel-by-pixel information of the second picture of each of the second picture blocks blocks, including:

将同一位置的所述第一画面块的像素点信息与所述第二画面块的像素点信息进行差分处理,得到差分量;performing differential processing on the pixel point information of the first picture block and the pixel point information of the second picture block at the same position to obtain a difference component;

在所述差分量超过第一预设阈值的情况下,将所述第一画面块中对应的像素点作为运动像素点;In the case that the difference component exceeds the first preset threshold, the corresponding pixel in the first picture block is used as a motion pixel;

分别统计每个所述第一画面块中运动像素点的数量;separately count the number of motion pixels in each of the first picture blocks;

在所述运动像素点的数量超过第二预设阈值的情况下,将所述第一画面块作为运动画面块。When the number of the motion pixels exceeds a second preset threshold, the first picture block is regarded as a motion picture block.

在本发明的一种优选实施例中,所述第一画面逐像素点信息和所述第二画面逐像素点信息具有每个像素点的像素点信息;In a preferred embodiment of the present invention, the pixel-by-pixel information of the first picture and the pixel-by-pixel information of the second picture have pixel information of each pixel;

所述根据每个所述第一画面块的第一画面逐像素点信息和每个所述第二画面块的第二画面逐像素点信息,从所述第一画面块中,筛选出运动画面块,包括:The moving picture is filtered out from the first picture block according to the pixel-by-pixel information of the first picture of each of the first picture blocks and the pixel-by-pixel information of the second picture of each of the second picture blocks blocks, including:

统计同一位置的所述第二画面块的像素点信息,计算平均像素点信息;Counting the pixel point information of the second picture block at the same position, and calculating the average pixel point information;

将同一位置的第一画面块的像素点信息与所述平均像素点信息进行差分处理,得到差分量;performing differential processing between the pixel point information of the first picture block at the same position and the average pixel point information to obtain a difference component;

在所述差分量超过第三预设阈值的情况下,将所述第一画面块中对应的像素点作为运动像素点;In the case that the difference component exceeds a third preset threshold, the corresponding pixel in the first picture block is used as a motion pixel;

分别统计每个所述第一画面块中运动像素点的数量;separately count the number of motion pixels in each of the first picture blocks;

在所述运动像素点的数量超过第四预设阈值的情况下,将所述第一画面块作为运动画面块。In the case that the number of the motion pixels exceeds a fourth preset threshold, the first picture block is regarded as a motion picture block.

在本发明的一种优选实施例中,所述移动终端还包括:In a preferred embodiment of the present invention, the mobile terminal further includes:

计算所述第一白平衡增益系数和所述第二白平衡增益系数之间的差值;calculating the difference between the first white balance gain coefficient and the second white balance gain coefficient;

在所述第一白平衡增益系数和所述第二白平衡增益系数之间的差值大于或等于预设差值的情况下,确定需要更新所述第二白平衡增益系数;In the case where the difference between the first white balance gain coefficient and the second white balance gain coefficient is greater than or equal to a preset difference, determine that the second white balance gain coefficient needs to be updated;

在所述第一白平衡增益系数和所述第二白平衡增益系数之间的差值小于预设差值的情况下,确定需更新所述第二白平衡增益系数。When the difference between the first white balance gain coefficient and the second white balance gain coefficient is smaller than a preset difference, it is determined that the second white balance gain coefficient needs to be updated.

在本发明的一种优选实施例中,所述移动终端还包括:In a preferred embodiment of the present invention, the mobile terminal further includes:

在无需更新所述第二白平衡增益系数的情况下,采用所述第二白平衡增益系数对所述目标图像进行白平衡处理。Under the condition that the second white balance gain coefficient does not need to be updated, white balance processing is performed on the target image by using the second white balance gain coefficient.

在本发明的一种优选实施例中,所述根据所述数量,确定更新参考系数,包括:In a preferred embodiment of the present invention, the determining and updating the reference coefficient according to the quantity includes:

在所述数量大于或等于第五预设阈值的情况下,将所述更新参考系数设置为第一预设更新参考系数;in the case that the number is greater than or equal to a fifth preset threshold, setting the update reference coefficient as a first preset update reference coefficient;

在所述数量小于第六预设阈值的情况下,将所述更新参考系数设置为第二预设更新参考系数;In the case that the number is less than a sixth preset threshold, setting the update reference coefficient as a second preset update reference coefficient;

其中,所述第二预设更新参考系数大于所述第一预设更新参考系数。Wherein, the second preset update reference coefficient is greater than the first preset update reference coefficient.

对于装置实施例而言,由于其与方法实施例基本相似,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。As for the apparatus embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and reference may be made to the partial description of the method embodiment for related parts.

图7为实现本发明各个实施例的一种移动终端的硬件结构示意图,该移动终端70包括但不限于:射频单元71、网络模块72、音频输出单元73、输入单元74、传感器75、显示单元76、用户输入单元77、接口单元78、存储器79、处理器710、以及电源711等部件。本领域技术人员可以理解,图7中示出的移动终端结构并不构成对移动终端的限定,移动终端可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。在本发明实施例中,移动终端包括但不限于手机、平板电脑、笔记本电脑、掌上电脑、车载终端、可穿戴设备、以及计步器等。7 is a schematic diagram of the hardware structure of a mobile terminal for implementing various embodiments of the present invention. The mobile terminal 70 includes but is not limited to: a radio frequency unit 71, a network module 72, an audio output unit 73, an input unit 74, a sensor 75, and a display unit 76. User input unit 77, interface unit 78, memory 79, processor 710, power supply 711 and other components. Those skilled in the art can understand that the structure of the mobile terminal shown in FIG. 7 does not constitute a limitation on the mobile terminal, and the mobile terminal may include more or less components than the one shown, or combine some components, or different components layout. In this embodiment of the present invention, the mobile terminal includes, but is not limited to, a mobile phone, a tablet computer, a notebook computer, a palmtop computer, a vehicle-mounted terminal, a wearable device, a pedometer, and the like.

其中,处理器710,用于获取目标图像的画面逐像素点信息、拍摄物理参数和所述目标图像前n帧的第一白平衡增益系数;基于所述画面逐像素点信息和所述拍摄物理参数,确定第二白平衡增益系数和更新参考系数;在需要更新所述第二白平衡增益系数的情况下,采用所述更新参考系数,更新所述第二白平衡增益系数;采用更新后的所述第二白平衡增益系数,对所述目标图像进行白平衡处理;其中,所述目标图像为当前帧图像;n为大于或等于1的正整数。The processor 710 is configured to obtain the picture-by-pixel information of the target image, the shooting physical parameters, and the first white balance gain coefficient of the first n frames of the target image; based on the picture-by-pixel information and the shooting physical parameters parameters, determine the second white balance gain coefficient and update the reference coefficient; when the second white balance gain coefficient needs to be updated, use the update reference coefficient to update the second white balance gain coefficient; use the updated The second white balance gain coefficient performs white balance processing on the target image; wherein, the target image is the current frame image; n is a positive integer greater than or equal to 1.

处理器710,还用于获取目标图像的第一画面逐像素点信息、所述目标图像前n帧的第二画面逐像素点信息以及前n帧的第一白平衡增益系数;基于所述第一画面逐像素点信息和所述第二画面逐像素点信息,确定第二白平衡增益系数和确定更新参考系数;在需要更新所述第二白平衡增益系数的情况下,采用所述更新参考系数,更新所述第二白平衡增益系数;采用更新后的所述第二白平衡增益系数,对所述目标图像进行白平衡处理;其中,所述目标图像为当前帧图像;n为大于或等于1的正整数。The processor 710 is further configured to obtain the pixel-by-pixel information of the first picture of the target image, the pixel-by-pixel information of the second picture of the first n frames of the target image, and the first white balance gain coefficient of the first n frames; The pixel-by-pixel information of a picture and the pixel-by-pixel information of the second picture, determine the second white balance gain coefficient and determine the update reference coefficient; when the second white balance gain coefficient needs to be updated, use the update reference coefficient, update the second white balance gain coefficient; use the updated second white balance gain coefficient to perform white balance processing on the target image; wherein, the target image is the current frame image; n is greater than or A positive integer equal to 1.

本发明实施例在拍摄目标图像时,根据目标图像的拍摄物理参数确定更新参考系数,根据目标图的画面逐像素点信息计算其第二白平衡增益系数,当需要对于第二白平衡增益系数进行更新时,采用更新参考系数更新第二白平衡增益系数,并最终采用更新后的第二白平衡增益系数对目标图像进行白平衡处理,本发明实施例通过设置更新参考系数,使得用于处理目标图像白平衡的白平衡增益系数处于一个较为稳定的状态,因此应用本发明实施例,能够在移动终端的镜头发生位移导致画面改变而环境色温没有改变的情况下得到稳定的白平衡增益系数,避免目标图像的白平衡系数变化过大导致画面抖动,稳定画面质量。In this embodiment of the present invention, when shooting a target image, the update reference coefficient is determined according to the shooting physical parameters of the target image, and the second white balance gain coefficient is calculated according to the pixel-by-pixel information of the target image. When updating, the update reference coefficient is used to update the second white balance gain coefficient, and finally the updated second white balance gain coefficient is used to perform white balance processing on the target image. The white balance gain coefficient of the image white balance is in a relatively stable state. Therefore, by applying the embodiments of the present invention, a stable white balance gain coefficient can be obtained under the condition that the lens of the mobile terminal is displaced, causing the screen to change but the ambient color temperature does not change. The large change of the white balance coefficient of the target image causes the picture to shake and stabilize the picture quality.

应理解的是,本发明实施例中,射频单元71可用于收发信息或通话过程中,信号的接收和发送,具体的,将来自基站的下行数据接收后,给处理器710处理;另外,将上行的数据发送给基站。通常,射频单元71包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器、双工器等。此外,射频单元71还可以通过无线通信系统与网络和其他设备通信。It should be understood that, in this embodiment of the present invention, the radio frequency unit 71 can be used for receiving and sending signals during sending and receiving of information or during a call. Specifically, after receiving the downlink data from the base station, it is processed by the processor 710; The uplink data is sent to the base station. Typically, the radio frequency unit 71 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, and the like. In addition, the radio frequency unit 71 can also communicate with the network and other devices through a wireless communication system.

移动终端通过网络模块72为用户提供了无线的宽带互联网访问,如帮助用户收发电子邮件、浏览网页和访问流式媒体等。The mobile terminal provides the user with wireless broadband Internet access through the network module 72, such as helping the user to send and receive emails, browse web pages, and access streaming media.

音频输出单元73可以将射频单元71或网络模块72接收的或者在存储器79中存储的音频数据转换成音频信号并且输出为声音。而且,音频输出单元73还可以提供与移动终端70执行的特定功能相关的音频输出(例如,呼叫信号接收声音、消息接收声音等等)。音频输出单元73包括扬声器、蜂鸣器以及受话器等。The audio output unit 73 may convert audio data received by the radio frequency unit 71 or the network module 72 or stored in the memory 79 into audio signals and output as sound. Also, the audio output unit 73 may also provide audio output related to a specific function performed by the mobile terminal 70 (eg, call signal reception sound, message reception sound, etc.). The audio output unit 73 includes a speaker, a buzzer, a receiver, and the like.

输入单元74用于接收音频或视频信号。输入单元74可以包括图形处理器(Graphics Processing Unit,GPU)741和麦克风742,图形处理器741对在视频捕获模式或图像捕获模式中由图像捕获装置(如摄像头)获得的静态图片或视频的图像数据进行处理。处理后的图像帧可以显示在显示单元76上。经图形处理器741处理后的图像帧可以存储在存储器79(或其它存储介质)中或者经由射频单元71或网络模块72进行发送。麦克风742可以接收声音,并且能够将这样的声音处理为音频数据。处理后的音频数据可以在电话通话模式的情况下转换为可经由射频单元71发送到移动通信基站的格式输出。The input unit 74 is used to receive audio or video signals. The input unit 74 may include a graphics processor (Graphics Processing Unit, GPU) 741 and a microphone 742, and the graphics processor 741 captures still pictures or video images obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode data is processed. The processed image frames may be displayed on the display unit 76 . The image frames processed by the graphics processor 741 may be stored in the memory 79 (or other storage medium) or transmitted via the radio frequency unit 71 or the network module 72 . The microphone 742 can receive sound and can process such sound into audio data. The processed audio data can be converted into a format that can be transmitted to a mobile communication base station via the radio frequency unit 71 for output in the case of a telephone call mode.

移动终端70还包括至少一种传感器75,比如光传感器、运动传感器以及其他传感器。具体地,光传感器包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板761的亮度,接近传感器可在移动终端70移动到耳边时,关闭显示面板761和/或背光。作为运动传感器的一种,加速计传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别移动终端姿态(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;传感器75还可以包括指纹传感器、压力传感器、虹膜传感器、分子传感器、陀螺仪、气压计、湿度计、温度计、红外线传感器等,在此不再赘述。The mobile terminal 70 also includes at least one type of sensor 75, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 761 according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 761 and the display panel 761 when the mobile terminal 70 is moved to the ear. / or backlight. As a kind of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (usually three axes), and can detect the magnitude and direction of gravity when stationary, and can be used to identify the posture of mobile terminals (such as horizontal and vertical screen switching, related games , magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.; the sensor 75 may also include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, Infrared sensors, etc., are not repeated here.

显示单元76用于显示由用户输入的信息或提供给用户的信息。显示单元76可包括显示面板761,可以采用液晶显示器(Liquid Crystal Display,LCD)、有机发光二极管(Organic Light-Emitting Diode,OLED)等形式来配置显示面板761。The display unit 76 is used to display information input by the user or information provided to the user. The display unit 76 may include a display panel 761, and the display panel 761 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like.

用户输入单元77可用于接收输入的数字或字符信息,以及产生与移动终端的用户设置以及功能控制有关的键信号输入。具体地,用户输入单元77包括触控面板771以及其他输入设备772。触控面板771,也称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触控面板771上或在触控面板771附近的操作)。触控面板771可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器710,接收处理器710发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触控面板771。除了触控面板771,用户输入单元77还可以包括其他输入设备772。具体地,其他输入设备772可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆,在此不再赘述。The user input unit 77 may be used to receive input numerical or character information, and generate key signal input related to user settings and function control of the mobile terminal. Specifically, the user input unit 77 includes a touch panel 771 and other input devices 772 . The touch panel 771, also referred to as a touch screen, can collect touch operations by the user on or near it (such as the user's finger, stylus, etc., any suitable object or accessory on or near the touch panel 771). operate). The touch panel 771 may include two parts, a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the touch controller. To the processor 710, the command sent by the processor 710 is received and executed. In addition, the touch panel 771 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch panel 771 , the user input unit 77 may also include other input devices 772 . Specifically, other input devices 772 may include, but are not limited to, physical keyboards, function keys (such as volume control keys, switch keys, etc.), trackballs, mice, and joysticks, which are not described herein again.

进一步的,触控面板771可覆盖在显示面板761上,当触控面板771检测到在其上或附近的触摸操作后,传送给处理器710以确定触摸事件的类型,随后处理器710根据触摸事件的类型在显示面板761上提供相应的视觉输出。虽然在图7中,触控面板771与显示面板761是作为两个独立的部件来实现移动终端的输入和输出功能,但是在某些实施例中,可以将触控面板771与显示面板761集成而实现移动终端的输入和输出功能,具体此处不做限定。Further, the touch panel 771 can be covered on the display panel 761. When the touch panel 771 detects a touch operation on or near it, it transmits it to the processor 710 to determine the type of the touch event, and then the processor 710 determines the type of the touch event according to the touch The type of event provides corresponding visual output on display panel 761 . Although in FIG. 7 , the touch panel 771 and the display panel 761 are used as two independent components to realize the input and output functions of the mobile terminal, but in some embodiments, the touch panel 771 and the display panel 761 may be integrated The input and output functions of the mobile terminal are implemented, which is not specifically limited here.

接口单元78为外部装置与移动终端70连接的接口。例如,外部装置可以包括有线或无线头戴式耳机端口、外部电源(或电池充电器)端口、有线或无线数据端口、存储卡端口、用于连接具有识别模块的装置的端口、音频输入/输出(I/O)端口、视频I/O端口、耳机端口等等。接口单元78可以用于接收来自外部装置的输入(例如,数据信息、电力等等)并且将接收到的输入传输到移动终端70内的一个或多个元件或者可以用于在移动终端70和外部装置之间传输数据。The interface unit 78 is an interface for connecting an external device to the mobile terminal 70 . For example, external devices may include wired or wireless headset ports, external power (or battery charger) ports, wired or wireless data ports, memory card ports, ports for connecting devices with identification modules, audio input/output (I/O) ports, video I/O ports, headphone ports, and more. The interface unit 78 may be used to receive input (eg, data information, power, etc.) from external devices and transmit the received input to one or more elements within the mobile terminal 70 or may be used to communicate between the mobile terminal 70 and the external Transfer data between devices.

存储器79可用于存储软件程序以及各种数据。存储器79可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据手机的使用所创建的数据(比如音频数据、电话本等)等。此外,存储器79可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The memory 79 may be used to store software programs as well as various data. The memory 79 may mainly include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program (such as a sound playback function, an image playback function, etc.) required for at least one function, and the like; Data created by the use of the mobile phone (such as audio data, phone book, etc.), etc. Additionally, memory 79 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.

处理器710是移动终端的控制中心,利用各种接口和线路连接整个移动终端的各个部分,通过运行或执行存储在存储器79内的软件程序和/或模块,以及调用存储在存储器79内的数据,执行移动终端的各种功能和处理数据,从而对移动终端进行整体监控。处理器710可包括一个或多个处理单元;优选的,处理器710可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器710中。The processor 710 is the control center of the mobile terminal, using various interfaces and lines to connect various parts of the entire mobile terminal, by running or executing the software programs and/or modules stored in the memory 79, and calling the data stored in the memory 79. , perform various functions of the mobile terminal and process data, so as to monitor the mobile terminal as a whole. The processor 710 may include one or more processing units; preferably, the processor 710 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, etc., and the modem The processor mainly handles wireless communication. It can be understood that, the above-mentioned modulation and demodulation processor may not be integrated into the processor 710.

移动终端70还可以包括给各个部件供电的电源711(比如电池),优选的,电源711可以通过电源管理系统与处理器710逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。The mobile terminal 70 may also include a power source 711 (such as a battery) for supplying power to various components. Preferably, the power source 711 may be logically connected to the processor 710 through a power management system, so as to manage charging, discharging, and power consumption management through the power management system. and other functions.

另外,移动终端70包括一些未示出的功能模块,在此不再赘述。In addition, the mobile terminal 70 includes some unshown functional modules, which will not be repeated here.

优选的,本发明实施例还提供一种移动终端,包括处理器710,存储器79,存储在存储器79上并可在所述处理器710上运行的计算机程序,该计算机程序被处理器710执行时实现上述白平衡处理方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。Preferably, an embodiment of the present invention further provides a mobile terminal, including a processor 710 , a memory 79 , a computer program stored in the memory 79 and running on the processor 710 , when the computer program is executed by the processor 710 Each process of the above embodiments of the white balance processing method is implemented, and the same technical effect can be achieved. To avoid repetition, details are not described here.

本发明实施例还提供一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,该计算机程序被处理器执行时实现上述白平衡处理方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。其中,所述的计算机可读存储介质,如只读存储器(Read-Only Memory,简称ROM)、随机存取存储器(Random Access Memory,简称RAM)、磁碟或者光盘等。Embodiments of the present invention further provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, each process of the above-mentioned white balance processing method embodiment can be achieved, and can achieve the same The technical effect, in order to avoid repetition, will not be repeated here. The computer-readable storage medium is, for example, a read-only memory (Read-Only Memory, ROM for short), a random access memory (Random Access Memory, RAM for short), a magnetic disk, or an optical disk.

需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。It should be noted that, herein, the terms "comprising", "comprising" or any other variation thereof are intended to encompass non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements, It also includes other elements not expressly listed or inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element.

通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本发明各个实施例所述的方法。From the description of the above embodiments, those skilled in the art can clearly understand that the method of the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is better implementation. Based on this understanding, the technical solutions of the present invention can be embodied in the form of software products in essence or the parts that make contributions to the prior art, and the computer software products are stored in a storage medium (such as ROM/RAM, magnetic disk, CD), including several instructions to make a terminal (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the methods described in the various embodiments of the present invention.

上面结合附图对本发明的实施例进行了描述,但是本发明并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本发明的启示下,在不脱离本发明宗旨和权利要求所保护的范围情况下,还可做出很多形式,均属于本发明的保护之内。The embodiments of the present invention have been described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific embodiments, which are merely illustrative rather than restrictive. Under the inspiration of the present invention, without departing from the spirit of the present invention and the scope protected by the claims, many forms can be made, which all belong to the protection of the present invention.

Claims (19)

1. A white balance processing method is applied to a mobile terminal, and is characterized by comprising the following steps:
acquiring picture pixel-by-pixel information of a target image, shooting physical parameters and a first white balance gain coefficient of n frames before the target image;
determining a second white balance gain coefficient based on the picture pixel-by-pixel information; determining an update reference coefficient based on the shooting physical parameters;
under the condition that the second white balance gain coefficient needs to be updated, updating the second white balance gain coefficient by adopting the updating reference coefficient;
performing white balance processing on the target image by adopting the updated second white balance gain coefficient;
wherein the target image is a current frame image; n is a positive integer greater than or equal to 1.
2. The method of claim 1, wherein determining a second white balance gain coefficient and updating a reference coefficient based on the picture pixel-by-pixel information and the shooting physical parameter comprises:
determining continuous variable quantity of the picture by adopting the shooting physical parameters;
calculating a second white balance gain coefficient of the target image by adopting the picture pixel-by-pixel information;
and determining an updating reference coefficient according to the continuous variation of the picture.
3. The method according to claim 2, wherein the shooting physical parameters include acceleration, rotation angle;
the determining the continuous variation of the picture by using the shooting physical parameters comprises:
calculating the translation amount of the picture by adopting the acceleration;
calculating the frame offset by adopting the rotation angle;
and calculating the continuous variable quantity of the picture by adopting the translation quantity and the offset quantity.
4. The method of claim 3, wherein the shooting physical parameters further include a focus distance;
the calculating the picture translation amount by adopting the acceleration comprises the following steps:
setting the translation amount as a preset numerical value under the condition that the focusing distance is greater than or equal to a preset distance;
and under the condition that the focusing distance is smaller than a preset distance, calculating the picture translation amount by adopting the acceleration.
5. The method of claim 3, wherein the shooting physical parameters further include a focus distance; the acceleration comprises a z-axis acceleration perpendicular to the mobile terminal and an x-axis acceleration and a y-axis acceleration parallel to the mobile terminal;
the calculating the picture translation amount by adopting the acceleration comprises the following steps:
under the condition that the focusing distance is larger than or equal to a preset distance, calculating the image translation amount by adopting the x-axis acceleration and the y-axis acceleration;
and under the condition that the focusing distance is smaller than a preset distance, calculating the picture translation amount by adopting the x-axis acceleration, the y-axis acceleration and the z-axis acceleration.
6. The method according to claim 3, wherein said calculating a picture shift amount using said rotation angle comprises:
and calculating the picture offset by adopting the rotation angle.
7. The method of claim 3, wherein the shooting physical parameters further include a focus distance;
the calculating the picture offset by adopting the rotation angle comprises the following steps:
under the condition that the focusing distance is larger than or equal to a preset distance, calculating the image offset by adopting the rotation angle;
and setting the picture offset as a preset numerical value under the condition that the focusing distance is smaller than a preset distance.
8. The method of claim 1, wherein determining a second white balance gain factor based on the picture pixel-by-pixel information; after determining the updated reference coefficient based on the shooting physical parameters, the method further includes:
calculating a difference between the first white balance gain factor and the second white balance gain factor;
determining that the second white balance gain coefficient needs to be updated in the case that the difference between the first white balance gain coefficient and the second white balance gain coefficient is greater than or equal to a preset difference;
determining that the second white balance gain factor does not need to be updated in a case where a difference between the first white balance gain factor and the second white balance gain factor is smaller than a preset difference.
9. The method according to claim 1 or 8, wherein said determining a second white balance gain factor based on said picture pixel-by-pixel information; after determining the updated reference coefficient based on the shooting physical parameters, the method further includes:
and under the condition that the second white balance gain coefficient is not required to be updated, carrying out white balance processing on the target image by adopting the second white balance gain coefficient.
10. The method according to claim 2, wherein the determining an updated reference coefficient according to the picture continuous variation comprises:
setting the updating reference coefficient as a first preset updating reference coefficient under the condition that the continuous variation of the picture is greater than or equal to a preset threshold value;
setting the updating reference coefficient as a second preset updating reference coefficient under the condition that the continuous variation of the picture is smaller than a preset threshold value;
wherein the second preset updating reference coefficient is larger than the first preset updating reference coefficient.
11. A white balance processing method is applied to a mobile terminal, and is characterized by comprising the following steps:
acquiring first picture pixel-by-pixel information of a target image, second picture pixel-by-pixel information of the first n frames of the target image and a first white balance gain coefficient of the first n frames;
determining a second white balance gain coefficient based on the first picture pixel-by-pixel information; determining an updating reference coefficient based on the first picture pixel-by-pixel information and the second picture pixel-by-pixel information;
under the condition that the second white balance gain coefficient needs to be updated, updating the second white balance gain coefficient by adopting the updating reference coefficient;
performing white balance processing on the target image by adopting the updated second white balance gain coefficient;
wherein the target image is a current frame image; n is a positive integer greater than or equal to 1.
12. The method of claim 11, wherein determining a second white balance gain factor based on the first picture pixel-by-pixel information; determining an update reference coefficient based on the first picture pixel-by-pixel information and the second picture pixel-by-pixel information, including:
dividing the target image into at least one first picture block, and dividing the first n frames into at least one second picture block;
screening out the moving picture blocks from the first picture blocks according to the first picture pixel-by-pixel information of each first picture block and the second picture pixel-by-pixel information of each second picture block;
counting the number of the motion picture surface blocks in the target image;
calculating a second white balance gain coefficient of the target image by adopting the pixel point-by-pixel point information of the first picture;
and determining an updated reference coefficient according to the number.
13. The method according to claim 12, wherein the first picture pixel-by-pixel information and the second picture pixel-by-pixel information have pixel information of each pixel;
the screening out the moving picture blocks from the first picture blocks according to the first picture pixel-by-pixel information of each first picture block and the second picture pixel-by-pixel information of each second picture block comprises the following steps:
carrying out difference processing on the pixel point information of the first picture block and the pixel point information of the second picture block at the same position to obtain a difference component;
taking a corresponding pixel point in the first picture block as a moving pixel point under the condition that the difference component exceeds a first preset threshold value;
respectively counting the number of the motion pixel points in each first picture block;
and under the condition that the number of the motion pixel points exceeds a second preset threshold value, taking the first picture block as a motion picture block.
14. The method according to claim 12, wherein the first picture pixel-by-pixel information and the second picture pixel-by-pixel information have pixel information of each pixel;
the screening out the moving picture blocks from the first picture blocks according to the first picture pixel-by-pixel information of each first picture block and the second picture pixel-by-pixel information of each second picture block comprises the following steps:
counting pixel point information of the second picture block at the same position, and calculating average pixel point information;
carrying out difference processing on the pixel point information of the first picture block at the same position and the average pixel point information to obtain a difference component;
taking a corresponding pixel point in the first picture block as a moving pixel point under the condition that the difference component exceeds a third preset threshold value;
respectively counting the number of the motion pixel points in each first picture block;
and under the condition that the number of the motion pixel points exceeds a fourth preset threshold value, taking the first picture block as a motion picture block.
15. The method of claim 12, wherein determining a second white balance gain factor based on said first picture pixel-by-pixel information; after determining the updated reference coefficient based on the first picture pixel-by-pixel information and the second picture pixel-by-pixel information, the method further includes:
calculating a difference between the first white balance gain factor and the second white balance gain factor;
determining that the second white balance gain coefficient needs to be updated in the case that the difference between the first white balance gain coefficient and the second white balance gain coefficient is greater than or equal to a preset difference;
determining that the second white balance gain factor does not need to be updated in a case where a difference between the first white balance gain factor and the second white balance gain factor is smaller than a preset difference.
16. The method according to claim 11 or 15, wherein a second white balance gain factor is determined based on the first picture pixel-by-pixel information; after determining the updated reference coefficient based on the first picture pixel-by-pixel information and the second picture pixel-by-pixel information, the method further includes:
and under the condition that the second white balance gain coefficient is not required to be updated, performing white balance processing on the target image by adopting the second white balance gain coefficient.
17. The method of claim 12, wherein determining the updated reference coefficients based on the number comprises:
setting the update reference coefficient to a first preset update reference coefficient if the number is greater than or equal to a fifth preset threshold;
setting the update reference coefficient to a second preset update reference coefficient when the number is smaller than a sixth preset threshold;
wherein the second preset updating reference coefficient is larger than the first preset updating reference coefficient.
18. A mobile terminal, characterized in that the mobile terminal comprises:
the first data acquisition module is used for acquiring picture pixel-by-pixel information of a target image, shooting physical parameters and a first white balance gain coefficient of n frames before the target image;
the first data determining module is used for determining a second white balance gain coefficient based on the picture pixel-by-pixel information; determining an update reference coefficient based on the shooting physical parameters;
a first updating module, configured to update the second white balance gain coefficient by using the update reference coefficient when the second white balance gain coefficient needs to be updated;
the first white balance processing module is used for carrying out white balance processing on the target image by adopting the updated second white balance gain coefficient;
wherein the target image is a current frame image; n is a positive integer greater than or equal to 1.
19. A mobile terminal, characterized in that the mobile terminal comprises:
the second data acquisition module is used for acquiring pixel point-by-pixel point information of a first picture of a target image, pixel point-by-pixel point information of a second picture of the previous n frames of the target image and a first white balance gain coefficient of the previous n frames; n is a positive integer greater than or equal to 1;
the second data determination module is used for determining a second white balance gain coefficient based on the pixel point-by-pixel point information of the first picture; determining an updating reference coefficient based on the first picture pixel-by-pixel information and the second picture pixel-by-pixel information;
a second updating module, configured to update the second white balance gain coefficient by using the updated reference coefficient when the second white balance gain coefficient needs to be updated;
the second white balance processing module is used for carrying out white balance processing on the target image by adopting the updated second white balance gain coefficient;
and the target image is a current frame image.
CN201811643403.2A 2018-12-29 2018-12-29 White balance processing method and mobile terminal Active CN109462745B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811643403.2A CN109462745B (en) 2018-12-29 2018-12-29 White balance processing method and mobile terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811643403.2A CN109462745B (en) 2018-12-29 2018-12-29 White balance processing method and mobile terminal

Publications (2)

Publication Number Publication Date
CN109462745A CN109462745A (en) 2019-03-12
CN109462745B true CN109462745B (en) 2020-01-21

Family

ID=65615729

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811643403.2A Active CN109462745B (en) 2018-12-29 2018-12-29 White balance processing method and mobile terminal

Country Status (1)

Country Link
CN (1) CN109462745B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110611803A (en) * 2019-09-03 2019-12-24 珠海格力电器股份有限公司 Color temperature estimation method and device and computer readable medium
WO2022126379A1 (en) * 2020-12-15 2022-06-23 深圳市大疆创新科技有限公司 Method and device for image processing, and image capturing device
CN112802052A (en) * 2021-01-19 2021-05-14 北京小米移动软件有限公司 Image recognition method and device, electronic equipment and storage medium
CN113038094B (en) * 2021-03-29 2022-11-18 维沃移动通信(深圳)有限公司 Image acquisition method and device
CN113596426B (en) * 2021-08-17 2023-04-07 浙江大华技术股份有限公司 Method and device for determining white balance value of image, storage medium and electronic device
CN119697511B (en) * 2025-02-21 2025-05-13 浙江大华技术股份有限公司 White balance adjustment method, device and storage medium based on motion judgment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103929631A (en) * 2013-01-15 2014-07-16 瑞昱半导体股份有限公司 Method and device for adjusting white balance using scene detection
CN106331661A (en) * 2015-06-25 2017-01-11 西安中兴新软件有限责任公司 White balance processing method and device
CN107959839A (en) * 2017-11-27 2018-04-24 努比亚技术有限公司 A kind of method of blank level adjustment, terminal and computer-readable recording medium
WO2018075133A1 (en) * 2016-10-21 2018-04-26 Qualcomm Incorporated Mesh-based auto white balancing

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103929631A (en) * 2013-01-15 2014-07-16 瑞昱半导体股份有限公司 Method and device for adjusting white balance using scene detection
CN106331661A (en) * 2015-06-25 2017-01-11 西安中兴新软件有限责任公司 White balance processing method and device
WO2018075133A1 (en) * 2016-10-21 2018-04-26 Qualcomm Incorporated Mesh-based auto white balancing
CN107959839A (en) * 2017-11-27 2018-04-24 努比亚技术有限公司 A kind of method of blank level adjustment, terminal and computer-readable recording medium

Also Published As

Publication number Publication date
CN109462745A (en) 2019-03-12

Similar Documents

Publication Publication Date Title
CN109462745B (en) White balance processing method and mobile terminal
CN108182043B (en) Information display method and mobile terminal
CN107592468B (en) A kind of shooting parameter adjustment method and mobile terminal
CN107566730B (en) A panoramic image shooting method and mobile terminal
CN107846583B (en) A kind of image shadow compensation method and mobile terminal
WO2017071219A1 (en) Method for detecting skin region and device for detecting skin region
CN107580184A (en) A shooting method and mobile terminal
CN108234894B (en) Exposure adjusting method and terminal equipment
CN108494974A (en) Adjusting method, mobile terminal and the storage medium of display brightness
CN109474784B (en) A preview image processing method and terminal device
CN109104578B (en) An image processing method and mobile terminal
CN108040240B (en) Method, device and mobile terminal for white balance adjustment
CN110868544B (en) Shooting method and electronic equipment
CN107864336B (en) Image processing method and mobile terminal
CN108257104B (en) An image processing method and mobile terminal
CN110213484B (en) A photographing method, terminal device and computer-readable storage medium
WO2021190387A1 (en) Detection result output method, electronic device, and medium
CN111028192B (en) Image synthesis method and electronic equipment
CN108320263A (en) A kind of method, device and mobile terminal of image procossing
CN107888833A (en) A kind of image capturing method and mobile terminal
CN109819166B (en) Image processing method and electronic equipment
CN111601031A (en) Shooting parameter adjusting method and device
CN109727212B (en) An image processing method and mobile terminal
CN111131722A (en) Image processing method, electronic device and medium
CN108616687B (en) A photographing method, device and mobile terminal

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
GR01 Patent grant
GR01 Patent grant