CN106878695A - White balance processing method, device and computer equipment - Google Patents

White balance processing method, device and computer equipment Download PDF

Info

Publication number
CN106878695A
CN106878695A CN201710077011.3A CN201710077011A CN106878695A CN 106878695 A CN106878695 A CN 106878695A CN 201710077011 A CN201710077011 A CN 201710077011A CN 106878695 A CN106878695 A CN 106878695A
Authority
CN
China
Prior art keywords
white balance
area
region
reference zone
red
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201710077011.3A
Other languages
Chinese (zh)
Inventor
孙剑波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201710077011.3A priority Critical patent/CN106878695A/en
Publication of CN106878695A publication Critical patent/CN106878695A/en
Pending legal-status Critical Current

Links

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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/161Detection; Localisation; Normalisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/168Feature extraction; Face representation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30196Human being; Person
    • G06T2207/30201Face

Landscapes

  • Engineering & Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Multimedia (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • General Health & Medical Sciences (AREA)
  • Theoretical Computer Science (AREA)
  • Signal Processing (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)
  • Color Image Communication Systems (AREA)

Abstract

The invention relates to a white balance processing method, a white balance processing device and computer equipment. The method comprises the following steps: carrying out face recognition on the image, and recognizing a face region and a background region except the face region; acquiring a reference area from the face area, wherein the reference area is a white area in a real object; carrying out white balance processing on the whole image according to the reference area; or, performing white balance processing on the face region according to the reference region; and carrying out white balance processing on the regions except the human face region according to the background region. According to the embodiment of the invention, the white balance processing can be carried out on the image according to the specific reference area in the face area of the image, so that the accuracy of the white balance is improved, and the user experience is improved.

Description

白平衡处理的方法、装置和计算机设备White balance processing method, device and computer equipment

技术领域technical field

本发明涉及图像处理技术,特别是涉及白平衡处理的方法、装置和计算机设备。The invention relates to image processing technology, in particular to a white balance processing method, device and computer equipment.

背景技术Background technique

色温(Color Temperature)是表示光源光色的尺度,单位为K(开尔文)。人眼在任何色温下对最亮物体都鉴别为白色。而相机在不同色温下拍出的照片表现为不同的色彩,如D65光源下的照片偏蓝,而A光下的照片偏黄。室内的光源往往比较复杂,不论是白炽灯、荧光灯色温都不是十分标准。所以在室内拍摄人像往往会导致人物的肌肤色调不正常,偏黄或者偏蓝。Color Temperature is a measure of the light color of a light source, and the unit is K (Kelvin). The human eye perceives the brightest objects as white at any color temperature. The photos taken by the camera at different color temperatures show different colors, for example, the photos under the D65 light source are bluish, while the photos under the A light are yellowish. Indoor light sources are often more complicated, and the color temperature of incandescent lamps and fluorescent lamps is not very standard. Therefore, shooting portraits indoors often leads to abnormal skin tones, yellowish or bluish.

随着图像处理技术的发展,人们对图像的要求越来越高,通常对图像进行后期优化以使图片得到更好的视觉效果。自动白平衡(Automatic White Balance,AWB)被广泛用于包含人脸的肖像图片的处理。白平衡(White Balance,WB)的本质是让白色的物体在任何颜色的光源下都显示为白色。白平衡通过色彩校正使拍摄出的图像的色彩变成人眼看到的正常色彩。从感光芯片读取出来的照片称为原始图片,对原始图片进行自动白平衡色彩校正,达到白平衡效果。With the development of image processing technology, people have higher and higher requirements for images, and usually post-optimize images to obtain better visual effects. Automatic White Balance (AWB) is widely used in the processing of portrait pictures containing human faces. The essence of White Balance (WB) is to make white objects appear white under any color light source. White balance makes the color of the captured image become the normal color seen by human eyes through color correction. The photo read from the photosensitive chip is called the original picture, and the automatic white balance color correction is performed on the original picture to achieve the white balance effect.

但是在某些场景下,自动白平衡的效果还是与人眼看到的正常色彩存在差异,会出现色彩偏移的问题,用户体验不佳。However, in some scenarios, the effect of automatic white balance is still different from the normal color seen by the human eye, and the problem of color shift will occur, and the user experience is not good.

发明内容Contents of the invention

本发明实施例提供一种白平衡处理的方法、装置和计算机设备,可以更为精准对图像进行白平衡调节,提高了用户体验度。Embodiments of the present invention provide a white balance processing method, device, and computer equipment, which can more accurately adjust the white balance of an image and improve user experience.

一种白平衡处理的方法,包括:A method for white balance processing, comprising:

对图像进行人脸识别,识别人脸区域以及除所述人脸区域之外的背景区域;Perform face recognition on the image, identify the face area and the background area except the face area;

从所述人脸区域中获取参考区域,其中,所述参考区域为实物中的白色区域;Obtaining a reference area from the face area, wherein the reference area is a white area in the real object;

根据所述参考区域对整个图像进行白平衡处理;或者,根据所述参考区域对所述人脸区域进行白平衡处理;根据所述背景区域对所述除人脸区域以外的区域进行白平衡处理。Perform white balance processing on the entire image according to the reference area; or perform white balance processing on the face area according to the reference area; perform white balance processing on the area other than the face area according to the background area .

一种白平衡处理的装置,包括:A device for white balance processing, comprising:

人脸识别模块,用于识别人脸区域以及除人脸区域之外的背景区域;The face recognition module is used to identify the face area and the background area except the face area;

获取模块,用于在所述人脸区域中获取参考区域,其中,所述参考区域为实物中的白色区域;An acquisition module, configured to acquire a reference area in the face area, wherein the reference area is a white area in the real object;

白平衡处理模块,用于根据所述参考区域对整个图像进行白平衡处理;或者,根据所述参考区域对所述人脸区域进行白平衡处理和根据所述背景区域对所述除人脸区域以外的区域进行白平衡处理。A white balance processing module, configured to perform white balance processing on the entire image according to the reference area; or, perform white balance processing on the human face area according to the reference area and perform white balance processing on the human face area according to the background area White balance processing is performed on the other areas.

一种计算机设备,包括存储器,处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现以下步骤:A computer device, comprising a memory, a processor, and a computer program stored on the memory and operable on the processor, and the processor implements the following steps when executing the program:

对图像进行人脸识别,获取人脸区域以及除人脸区域之外的背景区域;Perform face recognition on the image, and obtain the face area and the background area except the face area;

在所述人脸区域中获取参考区域,其中,实物中所述参考区域反射到人眼的光线具有一定的亮度且所述光线中的蓝、绿、红三种色光的比例相同;Acquiring a reference area in the face area, wherein the light reflected from the reference area to the human eye in the real object has a certain brightness and the proportions of blue, green, and red colors in the light are the same;

根据所述参考区域对整个图像进行白平衡处理;或者,根据所述参考区域对所述人脸区域进行白平衡处理;根据所述人脸区域确定背景区域,所述背景区域为除所述人脸区域以外的区域;根据所述背景区域对所述除人脸区域以外的区域进行白平衡处理。Perform white balance processing on the entire image according to the reference area; or, perform white balance processing on the face area according to the reference area; determine a background area based on the face area, and the background area is the person except the person Areas other than the face area; performing white balance processing on the area other than the face area according to the background area.

上述白平衡处理的方法相对于传统的自动白平衡方法,本发明实施例可以根据图像人脸区域中特定参考区域对图像进行白平衡处理,进而提高白平衡的准确度,提升用户体验。Compared with the traditional automatic white balance method, the above white balance processing method can perform white balance processing on the image according to a specific reference area in the face area of the image, thereby improving the accuracy of the white balance and improving user experience.

附图说明Description of drawings

图1为一个实施例中终端的内部结构示意图;FIG. 1 is a schematic diagram of the internal structure of a terminal in an embodiment;

图2为一个实施例中白平衡处理的方法的流程图;Fig. 2 is a flowchart of a method for white balance processing in an embodiment;

图3为另一个实施例中白平衡处理的方法的流程图;Fig. 3 is a flowchart of a method for white balance processing in another embodiment;

图4为一个实施例中在所述人脸区域中获取参考区域的流程图;Fig. 4 is a flowchart of obtaining a reference area in the face area in an embodiment;

图5为一个实施例中根据所述参考区域对图像进行白平衡处理的流程图;Fig. 5 is a flow chart of performing white balance processing on an image according to the reference area in an embodiment;

图6为一个实施例中根据所述背景区域对图像进行白平衡处理的流程图;Fig. 6 is a flow chart of performing white balance processing on an image according to the background area in an embodiment;

图7为一个实施例中白平衡处理的装置的结构框架图;FIG. 7 is a structural frame diagram of a device for white balance processing in an embodiment;

图8为一个实施例中白平衡处理的装置中获取模块的结构框架图;Fig. 8 is a structural frame diagram of an acquisition module in a device for white balance processing in an embodiment;

图9为一个实施例中白平衡处理的装置中白平衡处理模块的结构框架图;FIG. 9 is a structural frame diagram of a white balance processing module in a white balance processing device in an embodiment;

图10为一个实施例中计算机设备处理器执行计算机程序时实现的步骤的流程图。Fig. 10 is a flowchart of the steps implemented when the processor of the computer device executes the computer program in one embodiment.

具体实施方式detailed description

为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, not to limit the present invention.

可以理解,本发明所使用的术语“第一”、“第二”等可在本文中用于描述各种元件,但这些元件不受这些术语限制。这些术语仅用于将第一个元件与另一个元件区分。举例来说,在不脱离本发明的范围的情况下,可以将第一统计单元称为第二统计单元,且类似地,可将第二统计单元称为第一统计单元。第一统计单元和第二统计单元两者都是统计单元,但其不是同一统计单元。It can be understood that the terms "first", "second" and the like used in the present invention can be used to describe various elements herein, but these elements are not limited by these terms. These terms are only used to distinguish one element from another element. For example, a first statistical unit could be termed a second statistical unit, and, similarly, a second statistical unit could be termed a first statistical unit, without departing from the scope of the present invention. Both the first statistical unit and the second statistical unit are statistical units, but they are not the same statistical unit.

图1为一个实施例中终端的内部结构示意图。如图1所示,该终端包括通过系统总线连接的处理器101、非易失性存储介质102、内存储器103、网络接口104、显示屏105、摄像头106、图像传感器107。其中,终端的非易失性存储介质存储有操作系统,还包括一种白平衡处理的装置108,该白平衡处理的装置108用于实现一种白平衡处理方法。该处理器101用于提供计算和控制能力,支撑整个终端的运行。终端中的内存储器103中可储存有计算机可读指令,该计算机可读指令被所述处理器101执行时,可使得所述处理器101执行一种白平衡处理方法。网络接口104用于与服务器进行网络通信,如发送新闻数据访问请求至服务器,接收服务器返回的新闻数据等。终端的显示屏105可以是液晶显示屏或者电子墨水显示屏等。该终端可以是手机、平板电脑、数码相机等。本领域技术人员可以理解,图1中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的终端的限定,具体的终端可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Fig. 1 is a schematic diagram of the internal structure of a terminal in an embodiment. As shown in FIG. 1 , the terminal includes a processor 101 connected through a system bus, a non-volatile storage medium 102 , an internal memory 103 , a network interface 104 , a display screen 105 , a camera 106 , and an image sensor 107 . Wherein, the non-volatile storage medium of the terminal stores an operating system, and further includes a white balance processing device 108, and the white balance processing device 108 is used to implement a white balance processing method. The processor 101 is used to provide computing and control capabilities to support the operation of the entire terminal. The internal memory 103 of the terminal may store computer-readable instructions, and when the computer-readable instructions are executed by the processor 101, the processor 101 may execute a white balance processing method. The network interface 104 is used for network communication with the server, such as sending a news data access request to the server, receiving news data returned by the server, and so on. The display screen 105 of the terminal may be a liquid crystal display screen or an electronic ink display screen or the like. The terminal may be a mobile phone, a tablet computer, a digital camera, and the like. Those skilled in the art can understand that the structure shown in Figure 1 is only a block diagram of a partial structure related to the solution of this application, and does not constitute a limitation on the terminals to which the solution of this application is applied. Specific terminals may include More or fewer components are shown in the figures, or certain components are combined, or have different component arrangements.

如图2所示,在一个实施例中,提供了一种白平衡处理的方法,本实施例以该方法应用于上述图1中的终端来举例说明。该方法具体包括如下步骤:As shown in FIG. 2 , in one embodiment, a white balance processing method is provided, and this embodiment is described by taking this method applied to the terminal in FIG. 1 above as an example. The method specifically includes the following steps:

步骤202,对图像进行人脸识别,获取人脸区域以及除人脸区域之外的背景区域。Step 202, face recognition is performed on the image, and a face area and a background area other than the face area are obtained.

对待处理的图像进行区域划分,可以通过各种人脸识别算法,识别人脸区域,图像中除人脸区域以外的区域定义为背景区域。The image to be processed is divided into regions, and various face recognition algorithms can be used to identify the face region, and the region in the image other than the face region is defined as the background region.

人脸识别方法可以基于主成分分析(principal component analysis,简称PCA)的人脸识别方法,从统计的观点,寻找人脸图像分布的基本元素,即人脸图像样本集协方差矩阵的特征向量,以此近似地表征人脸图像。这些特征向量称为特征脸(Eigenface)。人脸识别方法还可以通过颜色分析进行肤色检测来定位人脸,利用面部皮肤的颜色特性建立一个新的颜色坐标系,通过从图像中分离出肤色来实现对脸部的定位。人脸识别方法还可以为变形模板类方法,用椭圆近似地表示头部轮廓,通过迭代求精。人脸识别方法还可以为采用Adaboost算法。优选的,在Adaboost算法中可以采用动态阀值,进一步加速人脸识别的速度。人脸识别算法还可以采用其他能够快速识别人脸区域的算法,本发明实施例中对人脸识别算法不作具体限定。The face recognition method can be based on the face recognition method of principal component analysis (PCA), from a statistical point of view, to find the basic elements of the face image distribution, that is, the eigenvector of the covariance matrix of the face image sample set, In this way, the face image is approximately represented. These feature vectors are called Eigenfaces. The face recognition method can also perform skin color detection through color analysis to locate the face, use the color characteristics of the facial skin to establish a new color coordinate system, and realize the positioning of the face by separating the skin color from the image. The face recognition method can also be a deformed template method, which uses an ellipse to approximate the head contour and refines it through iteration. The face recognition method may also use the Adaboost algorithm. Preferably, a dynamic threshold can be used in the Adaboost algorithm to further accelerate the speed of face recognition. The face recognition algorithm may also use other algorithms capable of quickly recognizing face regions, and the face recognition algorithm is not specifically limited in the embodiment of the present invention.

进一步地,对图像进行人脸识别,获取人脸区域以及除人脸区域之外的背景区域可以包括:对具有人脸的图像进行人脸识别,确定人脸对应的矩形框;在矩形框中提取人脸轮廓;将人脸轮廓作为所述人脸区域,图像中的其他区域作为背景区域。其中,在矩形框中提取人脸轮廓可以采用主动形状模型或者主动外观模型对人脸轮廓进行提取。Further, face recognition is performed on the image, and obtaining the face area and the background area other than the face area may include: performing face recognition on an image with a face, and determining a rectangular frame corresponding to the face; Extracting the contour of the human face; using the contour of the human face as the face area, and other areas in the image as the background area. Wherein, extracting the contour of the human face in the rectangular frame may use an active shape model or an active appearance model to extract the contour of the human face.

步骤204,在所述人脸区域中获取参考区域,其中,所述参考区域为实物中的白色区域。Step 204, acquiring a reference area in the face area, wherein the reference area is a white area in the real object.

通过人脸识别算法定位人脸区域中的参考区域。参考区域可以理解为实物中,人眼所见到的白色区域,或可以理解为眼睛所见到的真人人脸中的白色区域。因为白色是指反射到人眼中的光线由于蓝、绿、红三种色光比例相同且具有一定的亮度所形成的视觉反应,实物中的白色不含有色彩成份的亮度。参考区域可以为眼睛的眼白区域,也可以为牙齿区域。The reference area in the face area is located by the face recognition algorithm. The reference area can be understood as the white area seen by the human eyes in the real object, or can be understood as the white area in the real human face seen by the eyes. Because white refers to the visual reaction formed by the light reflected into the human eye due to the same proportion of blue, green and red colors and a certain brightness, the white in the real object does not contain the brightness of the color component. The reference area can be the white area of the eye, or the tooth area.

步骤206,根据所述参考区域对整个图像进行白平衡处理。Step 206, perform white balance processing on the entire image according to the reference area.

根据参考区域(眼白区域或牙齿区域)的红绿蓝RGB向量对整个图像进行白平衡处理。The whole image is white balanced according to the red, green and blue RGB vectors of the reference area (eye white area or tooth area).

在一个实施例中,参考图3,也可以用步骤208来代替步骤206。步骤208,根据所述参考区域对所述人脸区域进行白平衡处理;根据所述背景区域对所述除人脸区域以外的区域进行白平衡处理。也就是,根据所述参考区域的颜色向量对所述人脸区域进行白平衡处理;同时,根据所述背景区域的颜色向量对所述除人脸区域以外的区域进行白平衡处理。In one embodiment, referring to FIG. 3 , step 208 may also be used instead of step 206 . Step 208, perform white balance processing on the face area according to the reference area; perform white balance processing on the areas other than the face area according to the background area. That is, perform white balance processing on the face area according to the color vector of the reference area; meanwhile, perform white balance processing on the areas other than the face area according to the color vector of the background area.

相对于传统的根据整幅图像的颜色向量来对整幅图像进行自动白平衡处理,本发明实施例中白平衡处理的方法,通过人脸识别,识别人脸区域和除人脸区域外的背景区域,同时,还可以在人脸区域中定位出参考区域,根据特定的参考区域对整个图像进行自动白平衡处理,或者根据特定的参考区域对人脸区域进行自动白平衡处理,以及根据背景区域对整幅图像中出人脸区域外的区域进行白平衡处理,进而提高白平衡的准确度,提升用户体验。Compared with the traditional automatic white balance processing of the entire image based on the color vector of the entire image, the white balance processing method in the embodiment of the present invention recognizes the face area and the background other than the face area through face recognition At the same time, it can also locate the reference area in the face area, perform automatic white balance processing on the entire image according to a specific reference area, or perform automatic white balance processing on the face area according to a specific reference area, and perform automatic white balance processing on the face area according to a specific reference area, and perform automatic white balance processing on the face area according to a specific reference area, and perform automatic white balance processing on the face area according to a specific reference area, and perform automatic white balance processing on the face area according to a specific reference area, and perform automatic white balance processing on the face area according to a specific reference area, and perform automatic white balance processing on the face area according to a specific reference area, and perform automatic white balance processing on the face area according to a specific reference area, and perform automatic white balance processing on the face area according to a specific reference area, and perform automatic white balance processing on the face area according to a specific reference area, and perform automatic white balance processing on the face area according to a specific reference area, and perform automatic white balance processing on the face area according to a specific reference area, and perform automatic white balance processing on the face area according to a specific reference area, and according to the background area Perform white balance processing on the area outside the face area in the entire image, thereby improving the accuracy of white balance and improving user experience.

在一个实施例中,参考图4,步骤204,从所述人脸区域中获取参考区域,包括:In one embodiment, referring to FIG. 4, step 204, obtaining a reference area from the face area includes:

步骤402,在所述人脸区域定位眼睛区域。Step 402, locate the eye area in the face area.

根据人脸识别方法识别出人脸区域后,在对人脸区域内的眼睛进行识别或定位。人眼的识别有边缘特征分析法、Hough变换法和变形模板法等。人眼的识别还可以使用中值滤波和直方图均衡方法去除噪声和光照对图像的影响后,将图像做积分投影以缩小到人脸的眼部区域,在得到的眉眼区域中再做一次水平积分投影,找到两眼的垂直位置。最后利用人眼模板沿着该垂直方向进行匹配程度最高的部分即为要定位的人眼区域。本发明实施例中对人眼识别方法不作具体限定。After the face area is identified according to the face recognition method, the eyes in the face area are identified or positioned. The recognition of human eyes includes edge feature analysis method, Hough transform method and deformation template method. Human eye recognition can also use the median filter and histogram equalization method to remove the influence of noise and light on the image, and then integrally project the image to reduce it to the eye area of the face, and then do a leveling in the obtained eyebrow area Integral projections to find the vertical position of the eyes. Finally, the part with the highest degree of matching along the vertical direction using the human eye template is the human eye area to be located. In the embodiment of the present invention, no specific limitation is imposed on the human eye recognition method.

步骤404,从所述眼睛区域中提取眼白区域并定义所述眼白区域为参考区域。Step 404, extracting the white area of the eye from the eye area and defining the white area of the eye as a reference area.

根据步骤402定位或识别眼睛区域。眼睛区域包括眼白,瞳孔,部份眼睑,从眼睛区域中提取出眼白区域,并将眼白区域定义为参考区域。Eye regions are located or identified according to step 402 . The eye area includes eye white, pupil, and part of the eyelid. The eye white area is extracted from the eye area, and the eye white area is defined as a reference area.

在正常情况下,人眼的眼白是白色的。从色彩构成上来说,可以认为眼白部分红绿蓝RGB颜色分量的比值为1:1:1。将眼白区域定义为参考区域,将参考区域红绿蓝RGB颜色分量还原为正常情况下人眼眼白的颜色,进而实现对人脸区域或者整幅图进行自动白平处理。Under normal circumstances, the whites of the human eye are white. In terms of color composition, it can be considered that the ratio of the red, green and blue RGB color components of the white part of the eyes is 1:1:1. The white area of the eyes is defined as the reference area, and the red, green, and blue RGB color components of the reference area are restored to the color of the whites of the human eyes under normal circumstances, thereby realizing automatic whitening processing of the face area or the entire image.

提取眼白区域时,单独计算眼睛区域的亮度直方图,根据亮度直方图定位眼白区域。When extracting the white area of the eye, the brightness histogram of the eye area is calculated separately, and the white area of the eye is located according to the brightness histogram.

在一个实施例中,从所述眼睛区域中提取眼白区域并定义所述眼白区域为参考区域的步骤具体包括:In one embodiment, the step of extracting the eye white area from the eye area and defining the eye white area as a reference area specifically includes:

获取所述眼睛区域的各个像素点的亮度值;根据所述眼睛区域的各个像素点的亮度值获取所述眼睛区域的亮度均值;提取眼白区域,选取眼睛区域中像素点亮度大于亮度均值的区域定义为眼白区域,也就是,所述眼白区域的像素点的亮度大于亮度均值。Obtain the brightness value of each pixel in the eye region; obtain the average brightness value of the eye region according to the brightness value of each pixel point in the eye region; extract the white region of the eye, and select the region in which the pixel brightness in the eye region is greater than the average brightness value It is defined as the white area of the eye, that is, the brightness of the pixels in the white area of the eye is greater than the average brightness.

在一个实施例中,步骤204,在所述人脸区域中获取参考区域,还可以为:In one embodiment, step 204, acquiring a reference area in the face area may also be:

在所述人脸区域,定位并提取牙齿区域并定义所述牙齿区域为参考区域。根据人脸识别方法识别出人脸区域后,在对人脸区域内的牙齿进行识别或定位。In the human face area, a tooth area is located and extracted, and the tooth area is defined as a reference area. After the face area is identified according to the face recognition method, the teeth in the face area are identified or positioned.

在正常情况下,牙齿也是白色的。从色彩构成上来说,可以认为牙齿部分红绿蓝RGB颜色分量的比值为1:1:1。将牙齿区域定义为参考区域,将参考区域红绿蓝RGB颜色分量还原为正常情况下人眼眼白的颜色,进而实现对人脸区域或者整幅图进行自动白平处理。Under normal circumstances, teeth are also white. In terms of color composition, it can be considered that the ratio of the red, green and blue RGB color components of the teeth is 1:1:1. The tooth area is defined as a reference area, and the red, green, and blue RGB color components of the reference area are restored to the white color of the human eye under normal circumstances, thereby realizing automatic whitening processing of the face area or the entire image.

在一个实施例中,图像中通过人脸识别的方法,同时识别出眼白区域和牙齿区域,优先定义眼白区域为参考区域,以眼白区域为参考对整幅图像或人脸区域进行白平衡处理。在一个实施例中,还可以综合考虑眼白区域和牙齿区域红绿蓝RGB颜色向量的权重,定义眼白区域和牙齿区域为参考区域,进而对整幅图像或人脸区域进行白平衡处理。In one embodiment, the eye white area and the tooth area are recognized simultaneously in the image through the method of face recognition, and the eye white area is firstly defined as a reference area, and white balance processing is performed on the entire image or the face area with the eye white area as a reference. In one embodiment, the weights of the red, green and blue RGB color vectors of the eye white area and the tooth area can also be considered comprehensively, and the eye white area and the tooth area can be defined as reference areas, and then white balance processing can be performed on the entire image or the face area.

在一个实施例中,参考图5,步骤206,根据所述参考区域对整个图像进行白平衡处理,包括:In one embodiment, referring to FIG. 5, step 206, performing white balance processing on the entire image according to the reference area, includes:

步骤502,统计参考区域所有像素点的红绿蓝RGB颜色分量均值或最大值。Step 502, counting the average value or maximum value of the red, green and blue RGB color components of all pixels in the reference area.

提起参考区域所有像素点的颜色分量,每个像素点的颜色由红Red,绿Green,蓝Blue三个原色分量来表示。对参考区域所有像素点的红绿蓝RGB颜色分量取平均值,得到参考区域的红绿蓝RGB颜色分量均值或者,选取参考区域所有像素点的红绿蓝RGB颜色分量的最大值,得到参考区域的红绿蓝RGB颜色分量最大值(Rmax、Gmax、Bmax)。Mention the color components of all pixels in the reference area, and the color of each pixel is represented by three primary color components: Red, Green, and Blue. Take the average value of the red, green and blue RGB color components of all pixels in the reference area to obtain the average value of the red, green and blue RGB color components of the reference area Alternatively, select the maximum value of the red, green, blue RGB color components of all pixels in the reference area to obtain the maximum value of the red, green, blue RGB color components (R max , G max , B max ) in the reference area.

步骤504,根据所述红绿蓝RGB颜色分量均值或最大值计算红R通道和蓝B通道的校正调节因子。Step 504, calculating correction adjustment factors for the red R channel and the blue B channel according to the mean or maximum value of the red, green and blue RGB color components.

白平衡处理输入的数据为(红色,蓝色)的二维向量,绿色为基准色,无需参与白平衡。The input data for white balance processing is a two-dimensional vector of (red, blue), green is the reference color, and there is no need to participate in white balance.

在一个实例中,根据参考区域对应的红绿蓝RGB颜色分量均值计算红R通道和蓝B通道的校正调节因子。其中,红R通道校正调节因子KR为绿通道分量均值除以参考区域所有红R通道分量R的商值。蓝B通道校正调节因子KB为绿通道分量均值除以参考区域所有蓝B通道分量B的商值。In one example, according to the mean value of the red, green and blue RGB color components corresponding to the reference area Calculate the correction adjustment factors for the red R channel and blue B channel. Wherein, the red R channel correction adjustment factor K R is the quotient of the green channel component mean value divided by all the red R channel components R in the reference area. The blue B channel correction adjustment factor K B is the quotient of the green channel component mean value divided by all blue B channel components B in the reference area.

在一个实例中,根据参考区域对应的红绿蓝RGB颜色分量最大值(Rmax、Gmax、Bmax)计算红R通道和蓝B通道的校正调节因子。其中,红R通道校正调节因子lR为绿通道分量最大值除以所述参考区域红通道最大值的商值。蓝B通道校正调节因子lB为绿通道分量最大值除以所述参考区域蓝通道最大值的商值。In one example, the correction adjustment factors of the red R channel and the blue B channel are calculated according to the maximum values of the red, green and blue RGB color components (R max , G max , B max ) corresponding to the reference area. Wherein, the red R channel correction adjustment factor l R is the quotient of the maximum value of the green channel component divided by the maximum value of the red channel in the reference area. The blue B channel correction adjustment factor l B is the quotient of the maximum value of the green channel component divided by the maximum value of the blue channel in the reference area.

步骤506,根据所述红R通道和蓝B通道的校正调节因子对整个图像进行白平衡处理。Step 506, performing white balance processing on the entire image according to the correction adjustment factors of the red R channel and the blue B channel.

将步骤504计算的红R通道和蓝B通道的校正调节因子带入到相应的白平衡处理模型中,实现对整幅图像或人脸区域进行白平衡处理,实现快速对人脸区域进行白平衡,提高白平衡效率。Bring the correction adjustment factors of the red R channel and blue B channel calculated in step 504 into the corresponding white balance processing model to realize white balance processing on the entire image or face area, and quickly perform white balance on the face area , to improve white balance efficiency.

在其他实施例中,根据所述参考区域对整个图像进行白平衡处理时,其白平衡处理方法还可以为简单灰度世界算法(GW)和全完美反射算法(PR)正交组合算法(QCGP)、标准差加权的灰度世界算法(SDWGW)、亮度加权的灰度世界算法(LWGW)、标准差亮度灰度世界算法(SDLWGW)以及亮度加权灰度世界算法与全完美反射算法(PR)正交组合算法(QCLWG P)等等。In other embodiments, when performing white balance processing on the entire image according to the reference area, the white balance processing method can also be a simple grayscale world algorithm (GW) and a total perfect reflection algorithm (PR) quadrature combination algorithm (QCGP ), Standard Deviation Weighted Gray World Algorithm (SDWGW), Luminance Weighted Gray World Algorithm (LWGW), Standard Deviation Luminance Gray World Algorithm (SDLWGW), and Luminance Weighted Gray World Algorithm and Total Perfect Reflection Algorithm (PR) Orthogonal combination algorithm (QCLWG P) and so on.

在一个实施例中,步骤208,根据所述参考区域对所述人脸区域进行白平衡处理;根据所述背景区域对所述除人脸区域以外的区域进行白平衡处理,包括:In one embodiment, step 208, performing white balance processing on the face area according to the reference area; performing white balance processing on the area other than the face area according to the background area, including:

按照步骤502至步骤506,根据参考区域对人脸区域进行白平衡处理后,再根据背景区域对所述除人脸区域以外的区域进行白平衡处理。According to steps 502 to 506, after performing white balance processing on the face area according to the reference area, then performing white balance processing on the areas other than the face area according to the background area.

其中,根据所述背景区域对所述除人脸区域以外的区域进行白平衡处理,参考图6,包括:Wherein, according to the background area, the white balance processing is performed on the area other than the face area, referring to FIG. 6, including:

步骤602,统计背景区域所有像素点的红绿蓝RGB颜色分量均值或最大值。Step 602, counting the average value or maximum value of the red, green and blue RGB color components of all pixels in the background area.

提起背景区域所有像素点的颜色分量,每个像素点的颜色由红Red,绿Green,蓝Blue三个原色分量来表示。对背景区域所有像素点的红绿蓝RGB颜色分量取平均值,得到参考区域的红绿蓝RGB颜色分量均值或者,选取背景区域所有像素点的红绿蓝RGB颜色分量的最大值,得到参考区域的红绿蓝RGB颜色分量最大值(Rmax、Gmax、Bmax)。The color components of all pixels in the background area are mentioned, and the color of each pixel is represented by three primary color components of red, green, and blue. Take the average value of the red, green and blue RGB color components of all pixels in the background area to obtain the average value of the red, green and blue RGB color components of the reference area Alternatively, select the maximum value of the red, green, blue RGB color components of all pixels in the background area to obtain the maximum value of the red, green, blue RGB color components (R max , G max , B max ) in the reference area.

步骤604,根据所述红绿蓝RGB颜色分量均值或最大值计算红R通道和蓝B通道的校正调节因子。Step 604, calculating correction adjustment factors for the red R channel and the blue B channel according to the mean or maximum value of the red, green and blue RGB color components.

白平衡处理输入的数据为(红色,蓝色)的二维向量,绿色为基准色,无需参与白平衡。The input data for white balance processing is a two-dimensional vector of (red, blue), green is the reference color, and there is no need to participate in white balance.

在一个实例中,根据参考区域对应的红绿蓝RGB颜色分量均值计算红R通道和蓝B通道的校正调节因子。其中,红R通道校正调节因子KR为绿通道分量均值除以参考区域所有红R通道分量R的商值。蓝B通道校正调节因子KB为绿通道分量均值除以参考区域所有蓝B通道分量B的商值。In one example, according to the mean value of the red, green and blue RGB color components corresponding to the reference area Calculate the correction adjustment factors for the red R channel and blue B channel. Wherein, the red R channel correction adjustment factor K R is the quotient of the green channel component mean value divided by all the red R channel components R in the reference area. The blue B channel correction adjustment factor K B is the quotient of the green channel component mean value divided by all blue B channel components B in the reference area.

在一个实例中,根据参考区域对应的红绿蓝RGB颜色分量最大值(Rmax、Gmax、Bmax)计算红R通道和蓝B通道的校正调节因子。其中,红R通道校正调节因子lR为绿通道分量最大值除以所述参考区域红通道最大值的商值。蓝B通道校正调节因子lB为绿通道分量最大值除以所述参考区域蓝通道最大值的商值。In one example, the correction adjustment factors of the red R channel and the blue B channel are calculated according to the maximum values of the red, green and blue RGB color components (R max , G max , B max ) corresponding to the reference area. Wherein, the red R channel correction adjustment factor l R is the quotient of the maximum value of the green channel component divided by the maximum value of the red channel in the reference area. The blue B channel correction adjustment factor l B is the quotient of the maximum value of the green channel component divided by the maximum value of the blue channel in the reference area.

步骤606,根据所述红R通道和蓝B通道的校正调节因子对背景区域图像进行白平衡处理。Step 606, performing white balance processing on the background area image according to the correction adjustment factors of the red R channel and the blue B channel.

将步骤604计算的背景区域对应的红R通道和蓝B通道的校正调节因子带入到相应的白平衡处理模型中,实现对背景区域进行白平衡处理,实现快速对图像中除人脸区域外的头发、环境进行白平衡,提高白平衡的准确度,缩小了图像与真实场景的差异,能够更准确的进行白平衡处理,提升用户体验。The correction adjustment factors of the red R channel and blue B channel corresponding to the background area calculated in step 604 are brought into the corresponding white balance processing model to realize white balance processing on the background area, and realize rapid adjustment of the image except for the face area. The hair and environment can be white balanced to improve the accuracy of the white balance, reduce the difference between the image and the real scene, and be able to perform white balance processing more accurately and improve the user experience.

图7为一个实施例中白平衡处理的装置的结构框图。如图8所示,一种白平衡处理的装置,包括:Fig. 7 is a structural block diagram of a device for white balance processing in an embodiment. As shown in Figure 8, a device for white balance processing includes:

人脸识别模块710,用于识别人脸区域以及除人脸区域之外的背景区域;A face recognition module 710, configured to identify a face area and a background area other than the face area;

获取模块720,用于在所述人脸区域中获取参考区域,其中,所述参考区域为实物中的白色区域;An acquisition module 720, configured to acquire a reference area in the face area, wherein the reference area is a white area in the real object;

白平衡处理模块730,用于根据所述参考区域对整个图像进行白平衡处理;或者,根据所述参考区域对所述人脸区域进行白平衡处理和根据所述背景区域对所述除人脸区域以外的区域进行白平衡处理。The white balance processing module 730 is configured to perform white balance processing on the entire image according to the reference area; or, perform white balance processing on the face area according to the reference area and perform the face removal process on the face area according to the background area. Areas outside the area are white-balanced.

上述白平衡处理的装置,在对图像进行白平衡处理时,可以对图像中的人脸进行识别,识别人脸区域以及除人脸区域之外的背景区域。在所述人脸区域中获取参考区域,根据所述参考区域对整个图像进行白平衡处理。或者,根据所述参考区域对所述人脸区域进行白平衡处理;根据所述背景区域对所述除人脸区域以外的区域进行白平衡处理。本发明实施例根据图像人脸区域中特定参考区域对图像进行白平衡处理,进而提高白平衡的准确度,提升用户体验。The above-mentioned white balance processing device can recognize the face in the image when performing white balance processing on the image, and recognize the face area and the background area other than the face area. Obtain a reference area in the face area, and perform white balance processing on the entire image according to the reference area. Or, perform white balance processing on the face area according to the reference area; perform white balance processing on the areas other than the face area according to the background area. The embodiment of the present invention performs white balance processing on the image according to a specific reference area in the face area of the image, thereby improving the accuracy of the white balance and improving user experience.

在一个实施例中,人脸识别模块710能够对待处理的图像进行区域划分,可以通过各种人脸识别算法,识别人脸区域,图像中除人脸区域以外的区域定义为背景区域。人脸识别模块710可以基于主成分分析(principal component analysis,简称PCA)的人脸识别方法,从统计的观点,寻找人脸图像分布的基本元素,即人脸图像样本集协方差矩阵的特征向量,以此近似地表征人脸图像。人脸识别模块710还可以通过颜色分析进行肤色检测来定位人脸,利用面部皮肤的颜色特性建立一个新的颜色坐标系,通过从图像中分离出肤色来实现对脸部的定位。人脸识别模块710还可以为变形模板类方法,用椭圆近似地表示头部轮廓,通过迭代求精。人脸识别模块710还可以采用其他能够快速识别人脸区域的算法,本发明实施例中对人脸识别算法不作具体限定。In one embodiment, the face recognition module 710 can divide the image to be processed into regions. Various face recognition algorithms can be used to identify the face region, and the region in the image other than the face region is defined as the background region. The face recognition module 710 can be based on the face recognition method of principal component analysis (PCA), from a statistical point of view, to find the basic elements of the face image distribution, that is, the eigenvectors of the covariance matrix of the face image sample set , which approximates the face image. The face recognition module 710 can also perform skin color detection through color analysis to locate the face, use the color characteristics of the facial skin to establish a new color coordinate system, and realize the positioning of the face by separating the skin color from the image. The face recognition module 710 can also be a deformed template method, which uses an ellipse to approximate the head contour, and refines it through iteration. The face recognition module 710 may also use other algorithms capable of quickly recognizing face regions, and the face recognition algorithm is not specifically limited in this embodiment of the present invention.

在一个实施例中,获取模块720能够从人脸识别模块710中获取参考区域。参考区域可以为眼睛的眼白区域,也可以为牙齿区域。参考区域可以理解为实物中人眼所见到的白色区域,或可以理解为眼睛所见到的真人人脸中的白色区域。因为白色是指反射到人眼中的光线由于蓝、绿、红三种色光比例相同且具有一定的亮度所形成的视觉反应,实物中的白色不含有色彩成份的亮度。In one embodiment, the obtaining module 720 can obtain the reference area from the face recognition module 710 . The reference area can be the white area of the eye, or the tooth area. The reference area can be understood as the white area seen by the human eyes in the real object, or can be understood as the white area in the real human face seen by the eyes. Because white refers to the visual reaction formed by the light reflected into the human eye due to the same proportion of blue, green and red colors and a certain brightness, the white in the real object does not contain the brightness of the color component.

在一个实施例中,参考图8,所述获取模块720包括定位单元721和提取单元723。其中,定位单元721,用于定位人脸区域内的眼睛区域或牙齿区域。提取单元723,用于提取所述眼睛区域内的眼白区域或用于提取所述牙齿区域。In one embodiment, referring to FIG. 8 , the acquiring module 720 includes a positioning unit 721 and an extracting unit 723 . Wherein, the positioning unit 721 is configured to locate the eye area or the tooth area in the human face area. The extracting unit 723 is used for extracting the eye white area in the eye area or for extracting the tooth area.

通过定位单元721和提取单元723,可以从人脸区域中识别眼睛区域或牙齿区域,再通过提取单元723可以从眼睛区域或牙齿区域提取参考区域,其中,参考区域可以为眼白区域,也可以为牙齿区域。Through the positioning unit 721 and the extraction unit 723, the eye area or the tooth area can be identified from the human face area, and then the reference area can be extracted from the eye area or the tooth area through the extraction unit 723, wherein the reference area can be the white area of the eye or the tooth area.

在一个实施例中,获取模块720还包括计算单元725和选取单元727。其中,计算单元725,用于计算所述眼睛区域的各个像素点的亮度值获取所述眼睛区域的亮度均值。选取单元727,用于选取眼睛区域亮度大于所述亮度均值的像素点,选取的像素点的集合为眼白区域。In one embodiment, the acquisition module 720 further includes a calculation unit 725 and an selection unit 727 . Wherein, the calculation unit 725 is configured to calculate the luminance value of each pixel in the eye area to obtain an average luminance value of the eye area. The selection unit 727 is configured to select pixels whose brightness in the eye area is greater than the average brightness value, and the set of selected pixels is the white area of the eye.

在提取眼白的过程中,通过计算单元725计算眼睛区域的亮度直方图。根据亮度直方图,获取眼睛区域的亮度均值。通过选取单元727,选取眼睛区域亮度大于所述亮度均值的像素点,选取的像素点的集合为眼白区域。During the process of extracting the white of the eye, the calculation unit 725 calculates the brightness histogram of the eye area. According to the brightness histogram, obtain the average brightness value of the eye area. The selection unit 727 selects pixels whose brightness in the eye region is greater than the average brightness value, and the set of selected pixels is the eye white region.

在一个实施例中,参考图9,所述白平衡处理模块730包括第一统计单元731、第一增益校正因子获取单元732和第一校正单元733。其中,第一统计单元731,用于统计参考区域所有像素点的红绿蓝RGB颜色分量均值或最大值。第一增益校正因子获取单元732,用于根据所述参考区域红绿蓝RGB颜色分量均值或最大值计算红R通道和蓝B通道的校正调节因子。第一校正单元733,用于根据所述参考区域红R通道和蓝B通道的校正调节因子对整个图像进行白平衡处理。第一校正单元733根据第一增益校正因子获取单元732,获取的参考区域对应的红R通道和蓝B通道的校正调节因子,实现对整幅图像或人脸区域进行白平衡处理,实现快速对人脸区域进行白平衡,提高白平衡效率。In one embodiment, referring to FIG. 9 , the white balance processing module 730 includes a first statistical unit 731 , a first gain correction factor acquisition unit 732 and a first correction unit 733 . Among them, the first statistics unit 731 is used to calculate the average value or maximum value of the red, green and blue RGB color components of all pixels in the reference area. The first gain correction factor acquisition unit 732 is configured to calculate the correction adjustment factors of the red R channel and the blue B channel according to the mean or maximum value of the red, green and blue RGB color components in the reference area. The first correction unit 733 is configured to perform white balance processing on the entire image according to the correction adjustment factors of the red R channel and the blue B channel of the reference area. The first correction unit 733 implements white balance processing on the entire image or face area according to the correction adjustment factors of the red R channel and blue B channel corresponding to the reference area obtained by the first gain correction factor acquisition unit 732, and realizes fast correction Perform white balance on the face area to improve white balance efficiency.

在一个实施例中,所述白平衡处理模块730还包括第二统计单元736、第二增益校正因子获取单元737和第二校正单元738。其中,第二统计单元736,用于统计背景区域所有像素点的红绿蓝RGB颜色分量均值或最大值。第二增益校正因子获取单元737,用于根据所述背景区域对应的红绿蓝RGB颜色分量均值或最大值计算红R通道和蓝B通道的校正调节因子。第二校正单元738,用于根据所述背景区域对应的红R通道和蓝B通道的校正调节因子对背景区域图像进行白平衡处理。第二校正单元738根据第二增益校正因子获取单元737获取的背景区域红R通道和蓝B通道的校正调节因子,对背景区域进行白平衡处理,实现快速对图像中除人脸区域外的头发、环境进行白平衡,提高白平衡的准确度,缩小了图像与真实场景的差异,能够更准确的进行白平衡处理,提升用户体验。In one embodiment, the white balance processing module 730 further includes a second statistical unit 736 , a second gain correction factor acquisition unit 737 and a second correction unit 738 . Wherein, the second statistics unit 736 is used to calculate the mean value or maximum value of the red, green and blue RGB color components of all pixels in the background area. The second gain correction factor acquisition unit 737 is configured to calculate the correction adjustment factors of the red R channel and the blue B channel according to the mean value or maximum value of the red, green and blue RGB color components corresponding to the background area. The second correction unit 738 is configured to perform white balance processing on the background region image according to the correction adjustment factors of the red R channel and the blue B channel corresponding to the background region. The second correction unit 738 performs white balance processing on the background area according to the correction adjustment factors of the red R channel and the blue B channel of the background area acquired by the second gain correction factor acquisition unit 737, so as to quickly correct the hair in the image except for the face area. , The environment performs white balance, improves the accuracy of white balance, reduces the difference between the image and the real scene, can perform white balance processing more accurately, and improves user experience.

上述白平衡处理的装置中各个模块的划分仅用于举例说明,在其他实施例中,可将白平衡处理的装置按照需要划分为不同的模块,以完成上述白平衡处理的装置的全部或部分功能。The division of each module in the above-mentioned white balance processing device is only for illustration. In other embodiments, the white balance processing device can be divided into different modules according to needs, so as to complete all or part of the above-mentioned white balance processing device Function.

图10为一个实施例中计算机设备处理器执行计算机程序时实现的步骤的流程图。如图10所示,一种计算机设备,包括存储器,处理器及存储在存储器上并可在处理器上运行的计算机程序(指令),处理器执行程序时实现以下步骤:Fig. 10 is a flowchart of the steps implemented when the processor of the computer device executes the computer program in one embodiment. As shown in Figure 10, a kind of computer equipment comprises memory, processor and the computer program (instruction) that is stored on memory and can run on processor, and processor realizes following steps when executing program:

步骤1002,对图像进行人脸识别,获取人脸区域以及除人脸区域之外的背景区域。Step 1002, face recognition is performed on the image, and a face area and a background area other than the face area are obtained.

对待处理的图像进行区域划分,可以通过各种人脸识别算法,识别人脸区域,图像中除人脸区域以外的区域定义为背景区域。The image to be processed is divided into regions, and various face recognition algorithms can be used to identify the face region, and the region in the image other than the face region is defined as the background region.

人脸识别方法可以基于主成分分析(principal component analysis,简称PCA)的人脸识别方法,从统计的观点,寻找人脸图像分布的基本元素,即人脸图像样本集协方差矩阵的特征向量,以此近似地表征人脸图像。这些特征向量称为特征脸(Eigenface)。人脸识别方法还可以通过颜色分析进行肤色检测来定位人脸,利用面部皮肤的颜色特性建立一个新的颜色坐标系,通过从图像中分离出肤色来实现对脸部的定位。人脸识别方法还可以为变形模板类方法,用椭圆近似地表示头部轮廓,通过迭代求精。人脸识别方法还可以为采用Adaboost算法。优选的,在Adaboost算法中可以采用动态阀值,进一步加速人脸识别的速度。人脸识别算法还可以采用其他能够快速识别人脸区域的算法,本发明实施例中对人脸识别算法不作具体限定。The face recognition method can be based on the face recognition method of principal component analysis (PCA), from a statistical point of view, to find the basic elements of the face image distribution, that is, the eigenvector of the covariance matrix of the face image sample set, In this way, the face image is approximately represented. These feature vectors are called Eigenfaces. The face recognition method can also perform skin color detection through color analysis to locate the face, use the color characteristics of the facial skin to establish a new color coordinate system, and realize the positioning of the face by separating the skin color from the image. The face recognition method can also be a deformed template method, which uses an ellipse to approximate the head contour and refines it through iteration. The face recognition method may also use the Adaboost algorithm. Preferably, a dynamic threshold can be used in the Adaboost algorithm to further accelerate the speed of face recognition. The face recognition algorithm may also use other algorithms capable of quickly recognizing face regions, and the face recognition algorithm is not specifically limited in the embodiment of the present invention.

进一步地,对图像进行人脸识别,获取人脸区域以及除人脸区域之外的背景区域可以包括:对具有人脸的图像进行人脸识别,确定人脸对应的矩形框;在矩形框中提取人脸轮廓;将人脸轮廓作为所述人脸区域,图像中的其他区域作为背景区域。其中,在矩形框中提取人脸轮廓可以采用主动形状模型或者主动外观模型对人脸轮廓进行提取。Further, face recognition is performed on the image, and obtaining the face area and the background area other than the face area may include: performing face recognition on an image with a face, and determining a rectangular frame corresponding to the face; Extracting the contour of the human face; using the contour of the human face as the face area, and other areas in the image as the background area. Wherein, extracting the contour of the human face in the rectangular frame may use an active shape model or an active appearance model to extract the contour of the human face.

步骤1004,在所述人脸区域中获取参考区域,其中,实物中的所述参考区域反射到人眼的光线具有一定的亮度且所述光线中的蓝、绿、红三种色光的比例相同。Step 1004, obtain a reference area in the face area, wherein the light reflected from the reference area in the real object to the human eye has a certain brightness and the proportions of blue, green, and red colors in the light are the same .

通过人脸识别算法定位人脸区域中的参考区域。参考区域可以为眼睛的眼白区域,也可以为牙齿区域。参考区域可以理解为实物中人眼所见到的白色区域,或可以理解为眼睛所见到的真人人脸中的白色区域。因为白色是指反射到人眼中的光线由于蓝、绿、红三种色光比例相同且具有一定的亮度所形成的视觉反应,实物中的白色不含有色彩成份的亮度。The reference area in the face area is located by the face recognition algorithm. The reference area can be the white area of the eye, or the tooth area. The reference area can be understood as the white area seen by the human eyes in the real object, or can be understood as the white area in the real human face seen by the eyes. Because white refers to the visual reaction formed by the light reflected into the human eye due to the same proportion of blue, green and red colors and a certain brightness, the white in the real object does not contain the brightness of the color component.

步骤1006,根据所述参考区域对整个图像进行白平衡处理。或根据所述参考区域对所述人脸区域进行白平衡处理;根据所述背景区域对所述除人脸区域以外的区域进行白平衡处理。Step 1006, perform white balance processing on the entire image according to the reference area. Or perform white balance processing on the face area according to the reference area; perform white balance processing on the areas other than the face area according to the background area.

根据参考区域(眼白区域或牙齿区域)的红绿蓝RGB向量对整个图像进行白平衡处理。或者,根据所述参考区域的颜色向量对所述人脸区域进行白平衡处理;同时,根据所述背景区域的颜色向量对所述除人脸区域以外的区域进行白平衡处理。The whole image is white balanced according to the red, green and blue RGB vectors of the reference area (eye white area or tooth area). Or, perform white balance processing on the face area according to the color vector of the reference area; meanwhile, perform white balance processing on the areas other than the face area according to the color vector of the background area.

上述计算机设备中处理器在执行程序时,通过人脸识别,识别人脸区域和除人脸区域外的背景区域,同时,还可以在人脸区域中定位出参考区域,根据特定的参考区域对整个图像进行自动白平衡处理,或者根据特定的参考区域对人脸区域进行自动白平衡处理,以及根据背景区域对整幅图像中出人脸区域外的区域进行白平衡处理,进而提高白平衡的准确度,提升用户体验。When the processor in the above-mentioned computer device executes the program, it recognizes the face area and the background area other than the face area through face recognition, and at the same time, it can also locate the reference area in the face area, according to the specific reference area. Perform automatic white balance processing on the entire image, or perform automatic white balance processing on the face area according to a specific reference area, and perform white balance processing on the area outside the face area in the entire image according to the background area, thereby improving the accuracy of the white balance. Accuracy, improve user experience.

本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一非易失性计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be realized through computer programs to instruct related hardware, and the programs can be stored in a non-volatile computer-readable storage medium When the program is executed, it may include the processes of the embodiments of the above-mentioned methods. Wherein, the storage medium may be a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM) and the like.

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

Claims (13)

1. a kind of method that white balance is processed, it is characterised in that including:
Recognition of face is carried out to image, human face region and the background area in addition to the human face region is recognized;
Reference zone is obtained from the human face region, wherein, the reference zone is the white portion in material object;
White balance treatment is carried out to whole image according to the reference zone;Or, according to the reference zone to the face Region carries out white balance treatment;White balance treatment is carried out to the region in addition to human face region according to the background area.
2. the method that white balance according to claim 1 is processed, it is characterised in that described to be obtained from the human face region Reference zone, including:
Eye areas are positioned in the human face region;
White of the eye region is extracted from the eye areas and the white of the eye region is defined for reference zone.
3. the method that white balance according to claim 2 is processed, it is characterised in that extract the white of the eye from the eye areas Region simultaneously defines the white of the eye region for reference zone, including:
Obtain the brightness value of each pixel of the eye areas;
The brightness value of each pixel according to the eye areas obtains the luminance mean value of the eye areas;
White of the eye region is extracted, the brightness of the pixel in the white of the eye region is more than the luminance mean value.
4. the method that white balance according to claim 1 is processed, it is characterised in that according to the reference zone to whole figure As carrying out white balance treatment, including:
Count the RGB RGB color component average or maximum of the reference zone all pixels point;
Correction according to the reference zone RGB RGB color component average or the red R passages of maximum value calculation and blue channel B is adjusted The section factor;
Correction regulatory factor according to the red R passages of the reference zone and blue channel B carries out white balance treatment to whole image.
5. the method that white balance according to claim 4 is processed, it is characterised in that the red R passages of calculating and blue channel B Correction regulatory factor, including:
The green channel components average is respectively divided by all red R channel components of the reference zone, blue channel B component to deserved To red R passages, the correction regulatory factor of blue channel B;Or
The green channel components maximum is respectively divided by the red passage maximum of the reference zone, blue channel maximum to deserved To red R passages, the correction regulatory factor of blue channel B.
6. the method for white balance according to claim 1 treatment, it is characterised in that it is described according to the background area to removing Region beyond human face region carries out white balance treatment, including:
Count the RGB RGB color component average or maximum of the background area all pixels point;
Correction according to the background area RGB RGB color component average or the red R passages of maximum value calculation and blue channel B is adjusted The section factor;
The correction regulatory factor of red R passages and blue channel B is carried out at white balance to background area image according to background area Reason.
7. the method that white balance according to claim 1 is processed, it is characterised in that described to be obtained in the human face region Reference zone, including:
In the human face region, position and extract tooth regions and define the tooth regions for reference zone.
8. the device that a kind of white balance is processed, it is characterised in that including:
Face recognition module, for recognizing human face region and the background area in addition to human face region;
Acquisition module, for obtaining reference zone in the human face region, wherein, the reference zone is the white in material object Region;
White balance processing module, for carrying out white balance treatment to whole image according to the reference zone;Or, according to described Reference zone the human face region is carried out white balance treatment and according to the background area to described in addition to human face region Region carries out white balance treatment.
9. the device that white balance according to claim 8 is processed, it is characterised in that the acquisition module includes:
Positioning unit, for eye areas or tooth regions in locating human face region;
Extraction unit, for extracting the white of the eye region in the eye areas or for extracting the tooth regions.
10. the device that white balance according to claim 8 is processed, it is characterised in that the acquisition module also includes:
Computing unit, the brightness of the brightness value acquisition eye areas of each pixel for calculating the eye areas is equal Value;
Unit is chosen, for choosing pixel of the eye areas brightness more than the luminance mean value, the set of the pixel of selection It is white of the eye region.
The device of 11. white balance treatment according to claim 9, it is characterised in that the processing module includes:
First statistic unit, for the RGB RGB color component average or maximum of statistical-reference region all pixels point;
First gain correction factor acquiring unit, for the RGB RGB color component average according to the reference zone or most Big value calculates the correction regulatory factor of red R passages and blue channel B;
First correction unit, for according to the correction regulatory factor of the red R passages of the reference zone and blue channel B to whole image Carry out white balance treatment.
The device of 12. white balance treatment according to claim 8, it is characterised in that the processing module also includes:
Second statistic unit, RGB RGB color component average or maximum for counting background area all pixels point;
Second gain correction factor acquiring unit, for according to the background area RGB RGB color component average or maximum Value calculates the correction regulatory factor of red R passages and blue channel B;
Second correction unit, for according to the correction regulatory factor of the red R passages in the background area and blue channel B to background area Image carries out white balance treatment.
A kind of 13. computer equipments, including memory, processor and the meter that store on a memory and can run on a processor Calculation machine program, following steps are realized during the computing device described program:
Recognition of face is carried out to image, human face region and the background area in addition to human face region is obtained;
Reference zone is obtained in the human face region, wherein, the light that reference zone described in material object reflexes to human eye has The ratio of blue, green, the red three kinds of coloured light in certain brightness and the light is identical;
White balance treatment is carried out to whole image according to the reference zone;Or, according to the reference zone to the face Region carries out white balance treatment;Background area is determined according to the human face region, the background area is except the human face region Region in addition;White balance treatment is carried out to the region in addition to human face region according to the background area.
CN201710077011.3A 2017-02-13 2017-02-13 White balance processing method, device and computer equipment Pending CN106878695A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710077011.3A CN106878695A (en) 2017-02-13 2017-02-13 White balance processing method, device and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710077011.3A CN106878695A (en) 2017-02-13 2017-02-13 White balance processing method, device and computer equipment

Publications (1)

Publication Number Publication Date
CN106878695A true CN106878695A (en) 2017-06-20

Family

ID=59166111

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710077011.3A Pending CN106878695A (en) 2017-02-13 2017-02-13 White balance processing method, device and computer equipment

Country Status (1)

Country Link
CN (1) CN106878695A (en)

Cited By (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107277481A (en) * 2017-07-14 2017-10-20 维沃移动通信有限公司 A kind of image processing method and mobile terminal
CN107483906A (en) * 2017-07-25 2017-12-15 广东欧珀移动通信有限公司 White balancing treatment method, device and the terminal device of image
CN107635124A (en) * 2017-10-31 2018-01-26 广东欧珀移动通信有限公司 White balancing treatment method, device and the equipment of face shooting
CN107690065A (en) * 2017-07-31 2018-02-13 努比亚技术有限公司 A kind of white balance correcting, device and computer-readable recording medium
CN107730446A (en) * 2017-10-31 2018-02-23 广东欧珀移动通信有限公司 Image processing method, device, computer equipment and computer-readable recording medium
CN107995418A (en) * 2017-11-21 2018-05-04 维沃移动通信有限公司 A kind of image pickup method, device and mobile terminal
CN108024107A (en) * 2017-12-06 2018-05-11 广东欧珀移动通信有限公司 Image processing method, device, electronic equipment and computer-readable recording medium
CN108182667A (en) * 2017-12-29 2018-06-19 努比亚技术有限公司 A kind of image optimization method, terminal and computer readable storage medium
CN108376404A (en) * 2018-02-11 2018-08-07 广东欧珀移动通信有限公司 Image processing method and device, electronic equipment, storage medium
CN108960382A (en) * 2018-05-07 2018-12-07 广东数相智能科技有限公司 A kind of colour barcode and its color calibration method
CN109495731A (en) * 2017-09-13 2019-03-19 三星电子株式会社 Auto white balance method is used for by what image-signal processor executed
CN109561291A (en) * 2018-10-23 2019-04-02 Oppo广东移动通信有限公司 Color temperature compensating method, device, storage medium and mobile terminal
CN109753899A (en) * 2018-12-21 2019-05-14 普联技术有限公司 A kind of face identification method, system and equipment
CN110570476A (en) * 2018-06-06 2019-12-13 英属开曼群岛商玩美股份有限公司 System, method and storage medium for execution on computing device
CN111754906A (en) * 2020-06-30 2020-10-09 上海天马微电子有限公司 Method for detecting brightness uniformity of curved surface display screen
CN114143526A (en) * 2021-11-19 2022-03-04 昆山丘钛光电科技有限公司 Image processing method and device, terminal equipment and readable storage medium
CN115118947A (en) * 2021-03-23 2022-09-27 北京小米移动软件有限公司 Image processing method and device, electronic equipment and storage medium
CN116915964A (en) * 2023-09-13 2023-10-20 北京智芯微电子科技有限公司 Grayscale world white balance correction method, device, equipment, chip and storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1885952A (en) * 2005-06-20 2006-12-27 佳能株式会社 Image sensing apparatus and image processing method
JP2008182369A (en) * 2007-01-23 2008-08-07 Funai Electric Co Ltd Imaging device
JP2008182368A (en) * 2007-01-23 2008-08-07 Funai Electric Co Ltd Imaging device
CN101272505A (en) * 2007-03-19 2008-09-24 株式会社理光 Pick-up device and pick-up method
CN101527860A (en) * 2008-03-04 2009-09-09 佳能株式会社 White balance control apparatus, control method therefor, and image sensing apparatus
CN101753815A (en) * 2008-12-03 2010-06-23 索尼株式会社 Imaging apparatus
CN103686114A (en) * 2012-09-10 2014-03-26 索尼公司 Image processing apparatus, method, and program
CN105187810A (en) * 2014-11-11 2015-12-23 怀效宁 Automatic white balance method based on face color features and electronic media device
CN105282530A (en) * 2014-05-28 2016-01-27 深圳中兴力维技术有限公司 Method and device for implementing automatic white balance based on background modeling
CN106331661A (en) * 2015-06-25 2017-01-11 西安中兴新软件有限责任公司 White balance processing method and device

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1885952A (en) * 2005-06-20 2006-12-27 佳能株式会社 Image sensing apparatus and image processing method
JP2008182369A (en) * 2007-01-23 2008-08-07 Funai Electric Co Ltd Imaging device
JP2008182368A (en) * 2007-01-23 2008-08-07 Funai Electric Co Ltd Imaging device
CN101272505A (en) * 2007-03-19 2008-09-24 株式会社理光 Pick-up device and pick-up method
CN101527860A (en) * 2008-03-04 2009-09-09 佳能株式会社 White balance control apparatus, control method therefor, and image sensing apparatus
CN101753815A (en) * 2008-12-03 2010-06-23 索尼株式会社 Imaging apparatus
CN103686114A (en) * 2012-09-10 2014-03-26 索尼公司 Image processing apparatus, method, and program
CN105282530A (en) * 2014-05-28 2016-01-27 深圳中兴力维技术有限公司 Method and device for implementing automatic white balance based on background modeling
CN105187810A (en) * 2014-11-11 2015-12-23 怀效宁 Automatic white balance method based on face color features and electronic media device
CN106331661A (en) * 2015-06-25 2017-01-11 西安中兴新软件有限责任公司 White balance processing method and device

Cited By (27)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107277481A (en) * 2017-07-14 2017-10-20 维沃移动通信有限公司 A kind of image processing method and mobile terminal
CN107483906B (en) * 2017-07-25 2019-03-19 Oppo广东移动通信有限公司 White balancing treatment method, device and the terminal device of image
CN107483906A (en) * 2017-07-25 2017-12-15 广东欧珀移动通信有限公司 White balancing treatment method, device and the terminal device of image
US11277595B2 (en) 2017-07-25 2022-03-15 Guangdong Oppo Mobile Telecommunications Corp., Ltd. White balance method for image and terminal device
CN107690065A (en) * 2017-07-31 2018-02-13 努比亚技术有限公司 A kind of white balance correcting, device and computer-readable recording medium
CN109495731B (en) * 2017-09-13 2022-06-17 三星电子株式会社 Method for automatic white balance executed by image signal processor
US11503262B2 (en) 2017-09-13 2022-11-15 Samsung Electronics Co., Ltd. Image processing method and device for auto white balance
CN109495731A (en) * 2017-09-13 2019-03-19 三星电子株式会社 Auto white balance method is used for by what image-signal processor executed
CN107730446A (en) * 2017-10-31 2018-02-23 广东欧珀移动通信有限公司 Image processing method, device, computer equipment and computer-readable recording medium
CN107635124A (en) * 2017-10-31 2018-01-26 广东欧珀移动通信有限公司 White balancing treatment method, device and the equipment of face shooting
CN107730446B (en) * 2017-10-31 2022-02-18 Oppo广东移动通信有限公司 Image processing method, image processing device, computer equipment and computer readable storage medium
CN107995418A (en) * 2017-11-21 2018-05-04 维沃移动通信有限公司 A kind of image pickup method, device and mobile terminal
CN108024107A (en) * 2017-12-06 2018-05-11 广东欧珀移动通信有限公司 Image processing method, device, electronic equipment and computer-readable recording medium
CN108182667A (en) * 2017-12-29 2018-06-19 努比亚技术有限公司 A kind of image optimization method, terminal and computer readable storage medium
CN108182667B (en) * 2017-12-29 2020-07-17 珠海大横琴科技发展有限公司 Image optimization method, terminal and computer readable storage medium
CN108376404A (en) * 2018-02-11 2018-08-07 广东欧珀移动通信有限公司 Image processing method and device, electronic equipment, storage medium
CN108960382A (en) * 2018-05-07 2018-12-07 广东数相智能科技有限公司 A kind of colour barcode and its color calibration method
CN110570476A (en) * 2018-06-06 2019-12-13 英属开曼群岛商玩美股份有限公司 System, method and storage medium for execution on computing device
CN109561291A (en) * 2018-10-23 2019-04-02 Oppo广东移动通信有限公司 Color temperature compensating method, device, storage medium and mobile terminal
CN109753899A (en) * 2018-12-21 2019-05-14 普联技术有限公司 A kind of face identification method, system and equipment
CN111754906A (en) * 2020-06-30 2020-10-09 上海天马微电子有限公司 Method for detecting brightness uniformity of curved surface display screen
CN111754906B (en) * 2020-06-30 2022-09-27 上海天马微电子有限公司 Method for detecting brightness uniformity of curved surface display screen
CN115118947A (en) * 2021-03-23 2022-09-27 北京小米移动软件有限公司 Image processing method and device, electronic equipment and storage medium
CN115118947B (en) * 2021-03-23 2023-11-24 北京小米移动软件有限公司 Image processing method and device, electronic equipment and storage medium
CN114143526A (en) * 2021-11-19 2022-03-04 昆山丘钛光电科技有限公司 Image processing method and device, terminal equipment and readable storage medium
CN116915964A (en) * 2023-09-13 2023-10-20 北京智芯微电子科技有限公司 Grayscale world white balance correction method, device, equipment, chip and storage medium
CN116915964B (en) * 2023-09-13 2024-01-23 北京智芯微电子科技有限公司 Gray world white balance correction method, device, equipment, chip and storage medium

Similar Documents

Publication Publication Date Title
CN106878695A (en) White balance processing method, device and computer equipment
US10304166B2 (en) Eye beautification under inaccurate localization
US11989859B2 (en) Image generation device, image generation method, and storage medium storing program
USRE47960E1 (en) Methods and devices of illuminant estimation referencing facial color features for automatic white balance
US11082677B2 (en) White balance processing method and apparatus
WO2022161009A1 (en) Image processing method and apparatus, and storage medium and terminal
US10674069B2 (en) Method and apparatus for blurring preview picture and storage medium
WO2018082389A1 (en) Skin colour detection method and apparatus, and terminal
CN106326823B (en) Method and system for obtaining head portrait in picture
CN108810406B (en) Portrait light effect processing method, device, terminal and computer readable storage medium
CN108431751B (en) background removal
WO2023273111A1 (en) Image processing method and apparatus, and computer device and storage medium
US11315360B2 (en) Live facial recognition system and method
WO2021016896A1 (en) Image processing method, system and device, and movable platform and storage medium
CN106210522B (en) A kind of image processing method, device, mobile terminal and readable storage medium storing program for executing
WO2023273247A1 (en) Face image processing method and device, computer readable storage medium, terminal
WO2022135574A1 (en) Skin color detection method and apparatus, and mobile terminal and storage medium
WO2023273246A1 (en) Facial image processing method and apparatus, and computer-readable storage medium and terminal
WO2022135579A1 (en) Skin color detection method and device, mobile terminal, and storage medium
CN104994362A (en) Method and device for white balance processing
WO2022111269A1 (en) Method and device for enhancing video details, mobile terminal, and storage medium
CN115937919A (en) Method, device and equipment for identifying makeup color and storage medium
US8538142B2 (en) Face-detection processing methods, image processing devices, and articles of manufacture
KR102334030B1 (en) Method for dyeing hair by using computer device
WO2017101570A1 (en) Photo processing method and processing system

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20170620

RJ01 Rejection of invention patent application after publication