Nothing Special   »   [go: up one dir, main page]

CN111797797A - Face image processing method based on grid deformation optimization, terminal and storage medium - Google Patents

Face image processing method based on grid deformation optimization, terminal and storage medium Download PDF

Info

Publication number
CN111797797A
CN111797797A CN202010668700.3A CN202010668700A CN111797797A CN 111797797 A CN111797797 A CN 111797797A CN 202010668700 A CN202010668700 A CN 202010668700A CN 111797797 A CN111797797 A CN 111797797A
Authority
CN
China
Prior art keywords
face image
feature
grid
optimization
lattice
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.)
Granted
Application number
CN202010668700.3A
Other languages
Chinese (zh)
Other versions
CN111797797B (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.)
Shenzhen University
Original Assignee
Shenzhen University
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 Shenzhen University filed Critical Shenzhen University
Priority to CN202010668700.3A priority Critical patent/CN111797797B/en
Publication of CN111797797A publication Critical patent/CN111797797A/en
Application granted granted Critical
Publication of CN111797797B publication Critical patent/CN111797797B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02TCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
    • Y02T10/00Road transport of goods or passengers
    • Y02T10/10Internal combustion engine [ICE] based vehicles
    • Y02T10/40Engine management systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Processing Or Creating Images (AREA)
  • Image Analysis (AREA)

Abstract

本发明公开了基于网格形变优化的人脸图像处理方法、终端及存储介质,所述方法包括:获取姿态脸图像,获取所述姿态脸图像的第一特征点阵以及所述姿态脸图像对应的预测正脸图像的第二特征点阵,其中,所述第一特征点阵包括各个第一特征点,所述第二特征点阵包括各个第二特征点;分别构建所述姿态脸图像对应的第一网格网络以及所述预测正脸图像对应的第二网格网络;根据所述第二网格网络以及所述第二特征点阵对所述各个第一特征点的位置以及所述第一网格网络进行优化,将所述姿态脸图像处理为正脸图像。本发明实现了将姿态脸图像转化为正脸图像,能够使得人脸识别技术能够识别姿态脸图像,提升人脸识别系统的性能。

Figure 202010668700

The invention discloses a face image processing method, terminal and storage medium based on grid deformation optimization. The method includes: acquiring a posture face image, acquiring a first feature lattice of the posture face image and corresponding The second feature lattice of the predicted frontal face image of the The first grid network and the second grid network corresponding to the predicted frontal image; according to the second grid network and the second feature lattice, the positions of the first feature points and the The first mesh network is optimized to process the pose face image into a frontal face image. The present invention realizes that the gesture face image is converted into a front face image, which enables the face recognition technology to recognize the gesture face image and improves the performance of the face recognition system.

Figure 202010668700

Description

基于网格形变优化的人脸图像处理方法、终端及存储介质Face image processing method, terminal and storage medium based on mesh deformation optimization

技术领域technical field

本发明涉及终端技术领域,特别涉及基于网格形变优化的人脸图像处理方法、终端及存储介质。The present invention relates to the technical field of terminals, in particular to a face image processing method, terminal and storage medium based on grid deformation optimization.

背景技术Background technique

人脸识别技术在各个领域应用广泛,而目前的人脸识别技术中往往局限于正脸(面向正前方的人脸)识别,使得人脸识别系统的识别效率较低。Face recognition technology is widely used in various fields, but the current face recognition technology is often limited to the recognition of frontal faces (faces facing straight ahead), which makes the recognition efficiency of the face recognition system low.

因此,现有技术还有待改进和提高。Therefore, the existing technology still needs to be improved and improved.

发明内容SUMMARY OF THE INVENTION

针对现有技术的上述缺陷,本发明提供基于网格形变优化的人脸图像处理方法、终端及存储介质,旨在解决现有技术中人脸识别技术识别效率低的问题。In view of the above-mentioned defects of the prior art, the present invention provides a face image processing method, terminal and storage medium based on mesh deformation optimization, aiming at solving the problem of low recognition efficiency of face recognition technology in the prior art.

为了解决上述技术问题,本发明所采用的技术方案如下:In order to solve the above-mentioned technical problems, the technical scheme adopted in the present invention is as follows:

本发明的第一方面,提供一种基于网格形变优化的人脸图像处理方法,所述方法包括:A first aspect of the present invention provides a face image processing method based on mesh deformation optimization, the method comprising:

获取姿态脸图像的第一特征点阵以及所述姿态脸图像对应的预测正脸图像的第二特征点阵,其中,所述第一特征点阵包括各个第一特征点,所述第二特征点阵包括各个第二特征点;Obtain the first feature lattice of the pose face image and the second feature lattice of the predicted frontal face image corresponding to the pose face image, wherein the first feature lattice includes each first feature point, and the second feature The lattice includes each second feature point;

分别构建所述第一特征点阵对应的第一网格网络以及所述第二特征点阵对应的第二网格网络;respectively constructing a first grid network corresponding to the first feature lattice and a second grid network corresponding to the second feature lattice;

根据所述第二网格网络、所述第二特征点阵以及所述第一特征点阵对所述第一网格网络进行优化;Optimizing the first grid network according to the second grid network, the second feature lattice and the first feature lattice;

根据优化后的第一网格网络将所述姿态脸图像转化为目标正脸图像。The pose face image is converted into a target front face image according to the optimized first mesh network.

所述的基于网格形变优化的人脸图像处理方法,其中,获取所述姿态脸图像对应的预测正脸图像的第二特征点阵包括:The described face image processing method based on grid deformation optimization, wherein, obtaining the second feature lattice of the predicted frontal face image corresponding to the posture face image comprises:

构建人脸形状数据库,获取所述人脸形状数据库的特征向量;constructing a face shape database, and obtaining the feature vector of the face shape database;

根据第一预设公式获取所述第二特征点阵,The second feature lattice is obtained according to the first preset formula,

其中,所述第一预设公式为:Wherein, the first preset formula is:

Figure BDA0002581495000000021
Figure BDA0002581495000000021

Figure BDA0002581495000000022
Figure BDA0002581495000000022

其中,Q0为所述第二特征点阵的向量表示,Ei表示所述人脸形状数据库第i个特征向量,

Figure BDA0002581495000000023
为所述人脸形状数据库的平均形状,O为所述姿态脸图像的人脸形状,n0为常数,n0-1表示去掉的特征向量的个数。Wherein, Q 0 is the vector representation of the second feature lattice, E i represents the ith feature vector of the face shape database,
Figure BDA0002581495000000023
is the average shape of the face shape database, O is the face shape of the pose face image, n 0 is a constant, and n 0 -1 represents the number of removed feature vectors.

所述的基于网格形变优化的人脸图像处理方法,其中,所述分别构建所述第一特征点阵对应的第一网格网络以及所述第二特征点阵对应的第二网格网络之前包括:The described face image processing method based on grid deformation optimization, wherein the first grid network corresponding to the first feature lattice and the second grid network corresponding to the second feature lattice are respectively constructed Previously included:

对所述第一特征点阵中的所述第一特征点的数量以及所述第二特征点阵中的所述第二特征点的数量进行扩充。The number of the first feature points in the first feature lattice and the number of the second feature points in the second feature lattice are expanded.

所述的基于网格形变优化的人脸图像处理方法,其中,所述分别构建所述姿态脸图像对应的第一网格网络以及所述预测正脸图像对应的第二网格网络包括:The described face image processing method based on grid deformation optimization, wherein the respectively constructing the first grid network corresponding to the posture face image and the second grid network corresponding to the predicted frontal face image comprises:

根据第二预设公式分别构建所述第一网格网络以及所述第二网格网络;respectively constructing the first mesh network and the second mesh network according to a second preset formula;

其中,所述第二预设公式为:Wherein, the second preset formula is:

Pi+1,j+Pi-1,j+Pi,j+1+Pi,j-1-4Pi,j=0P i+1,j +P i-1,j +P i,j+1 +P i,j-1 -4P i,j =0

i=0,…,Nu;j=0,…,Nv i =0,...,Nu; j=0,..., Nv

其中,Pi,j为网格中位置为第i行,第j列的一个网格点,Nu+1为网格的行数,Nv+1为网格的列数。Among them, P i,j is a grid point in the i-th row and j-th column in the grid, N u +1 is the number of rows of the grid, and N v +1 is the number of columns of the grid.

所述的基于网格形变优化的人脸图像处理方法,其中,所述根据所述第二网格网络、所述第二特征点阵以及所述第一特征点阵对所述各个第一特征点的位置以及所述第一网格网络进行优化包括:The method for processing face images based on grid deformation optimization, wherein the first feature is analyzed according to the second grid network, the second feature lattice and the first feature lattice. Optimizing the location of points and the first mesh network includes:

根据第三预设公式对所述第一网格网络进行初优化;Perform initial optimization on the first mesh network according to a third preset formula;

根据第一优化函数、第二优化函数以及第三优化函数对进行了所述初优化的所述第一网格网络进行再优化;Re-optimize the first grid network on which the initial optimization has been performed according to the first optimization function, the second optimization function and the third optimization function;

其中,所述第三预设公式为:Wherein, the third preset formula is:

Figure BDA0002581495000000031
Figure BDA0002581495000000031

其中,Pi,j,P′i,j分别为所述第一网格网络和所述第二网格网络的网格点,Qt,Q′t分别为从所述第一网格网络中Pi,j网格点开始的网格中的第t个第一特征点和从所述第二网格网络中从P′i,j网格点开始的网格中第t个第二特征点;Wherein, P i,j , P′ i,j are the grid points of the first grid network and the second grid network, respectively, Q t , Q′ t are the grid points from the first grid network The t-th first feature point in the grid starting from the grid point P i,j and the t-th second feature point in the grid starting from the grid point P′ i,j in the second grid network Feature points;

所述根据第一优化函数、第二优化函数以及第三优化函数分别是基于平滑度、平移不变性以及人脸左右对称性构建的。The first optimization function, the second optimization function and the third optimization function are respectively constructed based on smoothness, translation invariance and left-right symmetry of the human face.

所述的基于网格形变优化的人脸图像处理方法,其中,所述第一优化函数为:The described face image processing method based on grid deformation optimization, wherein, the first optimization function is:

ETPS(z(Pi,j))=(zx″u,u)2+2(zx″u,v)2+(zx″v,v)2+(zy″u,u)2+2(zy″u,v)2+(zy″v,v)2 E TPS (z(P i,j ))=(zx″ u,u ) 2 +2(zx″ u,v ) 2 +(zx″ v,v ) 2 +(zy″ u,u ) 2 +2 (zy″ u,v ) 2 +(zy″ v,v ) 2

其中,z(Pi,j)=(zx,zy),表示Pi,j网格点的偏移量,zx为Pi,j网格点在u方向上的偏移量,zy为Pi,j网格点在v方向上的偏移量,zx″u,v表示zx相对于u方向和v方向的二阶方向偏导数;Among them, z(P i,j )=(zx,zy), represents the offset of the P i, j grid point, zx is the offset of the Pi ,j grid point in the u direction, and zy is P The offset of i, j grid points in the v direction, zx″ u, v represents the second-order partial derivative of zx with respect to the u and v directions;

所述第二优化函数为:The second optimization function is:

Figure BDA0002581495000000032
Figure BDA0002581495000000032

其中,z(Qt)=Q′t-Qt,表示Qt,Q′t之间的平移向量;Wherein, z(Q t )=Q' t -Q t , which represents the translation vector between Q t and Q't;

所述第三优化函数为:The third optimization function is:

Figure BDA0002581495000000041
Figure BDA0002581495000000041

其中,

Figure BDA0002581495000000042
分别表示姿态脸图像左右两边具有相同点序的特征点列,
Figure BDA0002581495000000043
分别为所述第一网格网络中姿态脸图像左右两边对应的网格点的像素颜色。in,
Figure BDA0002581495000000042
respectively represent the feature point columns with the same point sequence on the left and right sides of the pose face image,
Figure BDA0002581495000000043
are the pixel colors of the grid points corresponding to the left and right sides of the pose face image in the first grid network, respectively.

所述的基于网格形变优化的人脸图像处理方法,其中,所述根据第一优化函数、第二优化函数以及第三优化函数对进行了所述初优化的所述第一网格网络进行再优化包括:The method for processing face images based on grid deformation optimization, wherein the first grid network that has undergone the initial optimization is performed according to the first optimization function, the second optimization function and the third optimization function. Re-optimization includes:

获取使得所述第一优化函数、所述第二优化函数以及所述第三优化函数的函数值达到最小的第一网格网络作为优化结果。A first mesh network that minimizes the function values of the first optimization function, the second optimization function, and the third optimization function is obtained as an optimization result.

所述的基于网格形变优化的人脸图像处理方法,其中,所述根据优化后的第一网格网络将所述姿态脸图像转化为目标正脸图像包括:The described face image processing method based on grid deformation optimization, wherein, converting the posture face image into a target frontal face image according to the optimized first grid network includes:

根据优化后的第一网格网络将所述姿态脸图像转化为中间正脸图像;Converting the pose face image into an intermediate frontal face image according to the optimized first grid network;

根据第四预设公式对所述中间正脸图像进行修正,获取所述目标正脸图像;Correcting the middle frontal face image according to the fourth preset formula, and obtaining the target frontal face image;

其中,所述第四预设公式为:Wherein, the fourth preset formula is:

Figure BDA0002581495000000044
Figure BDA0002581495000000044

其中,OLp是所述中间正脸图像被遮挡区域中像素点p的亮度,OLq为p像素点的邻域中像素点q的亮度,NLp、NLq分别为与所述被遮挡区域对应的非遮挡区域中与像素点p和像素点q相应的像素点的亮度,Np为像素点p的8邻域,CEOL、CENL分别为被遮挡区域以及与所述被遮挡区域对应的非遮挡区域中边界环区域中像素点的光照强度变化幅度。Wherein, OL p is the brightness of the pixel p in the occluded area of the intermediate frontal face image, OL q is the brightness of the pixel q in the neighborhood of the p pixel, NL p and NL q are the same as the occluded area, respectively. The brightness of the pixel points corresponding to the pixel point p and the pixel point q in the corresponding non-occluded area, N p is the 8 neighborhoods of the pixel point p, CE OL and CE NL are the occluded area and the corresponding occluded area respectively. The magnitude of the illumination intensity change of the pixels in the bounding ring region in the non-occluded region.

本发明的第二方面,提供一种终端,所述终端包括处理器、与处理器通信连接的存储介质,所述存储介质适于存储多条指令,所述处理器适于调用所述存储介质中的指令,以执行实现上述任一项所述的基于网格形变优化的人脸图像处理方法的步骤。A second aspect of the present invention provides a terminal, the terminal includes a processor and a storage medium communicatively connected to the processor, the storage medium is suitable for storing a plurality of instructions, and the processor is suitable for calling the storage medium to execute the steps of implementing the mesh deformation optimization-based face image processing method described in any of the above.

本发明的第三方面,提供一种存储介质,所述存储介质存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个处理器执行,以实现上述任一项所述的基于网格形变优化的人脸图像处理方法的步骤。According to a third aspect of the present invention, a storage medium is provided, and the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement any one of the above The steps of a face image processing method based on mesh deformation optimization.

与现有技术相比,本发明提供了一种基于网格形变优化形变优化的人脸图像处理方法、终端及存储介质,所述基于网格形变优化的人脸图像处理方法用于处理姿态脸图像,通过根据姿态脸图像的第一特征点阵获取预测正脸图像的第二特征点阵,并构建姿态脸图像的第一网格网络和预测正脸图像的第二网格网络,根据所述第二网格网络、所述第二特征点阵以及所述第一特征点阵对所述第一网格网络进行优化;根据优化后的第一网格网络将所述姿态脸图像转化为目标正脸图像,本发明实现了将姿态脸图像转化为正脸图像,能够使得人脸识别技术能够识别姿态脸图像,提升人脸识别系统的性能。Compared with the prior art, the present invention provides a face image processing method, terminal and storage medium based on mesh deformation optimization and deformation optimization, and the face image processing method based on mesh deformation optimization is used for processing posture faces. image, obtain the second feature lattice of the predicted frontal face image according to the first feature lattice of the posture face image, and construct the first grid network of the posture face image and the second grid network of the predicted frontal face image, according to the The second grid network, the second feature lattice and the first feature lattice optimize the first grid network; according to the optimized first grid network, the posture face image is converted into For the target front face image, the present invention realizes the transformation of the gesture face image into the front face image, which enables the face recognition technology to recognize the gesture face image and improves the performance of the face recognition system.

附图说明Description of drawings

图1为本发明提供的基于网格形变优化的人脸图像处理方法的实施例的流程图;1 is a flowchart of an embodiment of a method for processing a face image based on mesh deformation optimization provided by the present invention;

图2为本发明提供的基于网格形变优化的人脸图像处理方法的实施例中获取姿态脸图像的第一特征点阵的示意图;2 is a schematic diagram of obtaining a first feature lattice of a pose face image in an embodiment of a face image processing method based on grid deformation optimization provided by the present invention;

图3为本发明提供的基于网格形变优化的人脸图像处理方法的实施例中人脸形状数据库的示意图;3 is a schematic diagram of a face shape database in an embodiment of a face image processing method based on grid deformation optimization provided by the present invention;

图4为本发明提供的基于网格形变优化的人脸图像处理方法的实施例中获取第二特征点阵的示意图;4 is a schematic diagram of obtaining a second feature lattice in an embodiment of a face image processing method based on grid deformation optimization provided by the present invention;

图5为本发明提供的基于网格形变优化的人脸图像处理方法的实施例的步骤S300的子步骤流程图;FIG. 5 is a flowchart of sub-steps of step S300 of an embodiment of a face image processing method based on mesh deformation optimization provided by the present invention;

图6为本发明提供的基于网格形变优化人脸图像处理方法的实施例中生成中间正脸图像的示意图;6 is a schematic diagram of generating an intermediate frontal face image in an embodiment of a method for optimizing face image processing based on mesh deformation provided by the present invention;

图7为本发明提供的基于网格形变优化人脸图像处理方法的实施例中生成目标正脸图像的示意图;7 is a schematic diagram of generating a target frontal face image in an embodiment of a method for optimizing face image processing based on mesh deformation provided by the present invention;

图8为本发明提供的终端的实施例的原理示意图。FIG. 8 is a schematic diagram of the principle of an embodiment of a terminal provided by the present invention.

具体实施方式Detailed ways

为使本发明的目的、技术方案及效果更加清楚、明确,以下参照附图并举实施例对本发明进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本发明,并不用于限定本发明。In order to make the objectives, technical solutions and effects of the present invention clearer and clearer, the present invention will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention, but not to limit the present invention.

实施例一Example 1

本发明提供的基于网格形变优化的人脸图像处理方法,可以是应用在终端中,所述终端可以通过本发明提供的基于网格形变优化的人脸图像处理方法对姿态脸图像进行处理,将姿态脸图像转化为正脸图像。如图1所示,所述基于网格形变优化的人脸图像处理方法的一个实施例中,包括步骤:The face image processing method based on grid deformation optimization provided by the present invention may be applied in a terminal, and the terminal can process the pose face image through the face image processing method based on grid deformation optimization provided by the present invention, Convert the pose face image to the front face image. As shown in FIG. 1, an embodiment of the method for processing face images based on mesh deformation optimization includes the steps:

S100、获取姿态脸图像的第一特征点阵以及所述姿态脸图像对应的预测正脸图像的第二特征点阵。S100. Acquire a first feature lattice of the pose face image and a second feature lattice of the predicted front face image corresponding to the pose face image.

在本实施例中,正脸图像表示朝向正前方的人脸图像,姿态脸图像为非正脸图像的人脸图像,在需要将姿态脸图像转化为正脸图像时,首先获取所述姿态脸图像的第一特征点阵,所述第一特征点阵包括各个第一特征点,即在所述姿态脸图像中提取多个特征点得到所述第一特征点阵(如图2所示),所述第二特征点阵包括各个第二特征点,所述第一特征点阵中的所述第一特征点的个数与所述第二特征点阵中所述第二特征点的个数相等,在一种可能的实现方式中,所述第一特征点阵和所述第二特征点阵中的特征点数量可以均为68,所述第一特征点可以是在所述姿态脸图像上进行特征点提取所得到。获取所述姿态脸对应的预测正脸图像的第二特征点阵包括:In this embodiment, the frontal face image represents the face image facing straight ahead, and the posture face image is a face image that is not a frontal face image. When the posture face image needs to be converted into a frontal face image, the posture face image is obtained first. The first feature lattice of the image, the first feature lattice includes each first feature point, that is, the first feature lattice is obtained by extracting multiple feature points in the posture face image (as shown in Figure 2) , the second feature lattice includes each second feature point, the number of the first feature point in the first feature lattice is the same as the number of the second feature point in the second feature lattice In a possible implementation manner, the number of feature points in the first feature lattice and the second feature lattice may both be 68, and the first feature point may be in the pose face Feature points are extracted from the image. Obtaining the second feature lattice of the predicted frontal face image corresponding to the posture face includes:

S110、构建人脸形状数据库,获取所述人脸形状数据库的特征向量.S110. Build a face shape database, and obtain the feature vector of the face shape database.

所述预测正脸图像是根据所述姿态脸图像估计的正脸图像,即,所述预测正脸图像为一个虚拟对象,在本实施例中,通过PCA(主成分分析)方法获取所述姿态脸图像对应的所述预测正脸图像的所述第二特征点阵,具体地,首先构建人脸形状数据库,如图3所示,所述人脸形状数据库中存储有多张人脸图像,对于每张人脸图像,都提取n个特征点,每张人脸图像对应的特征点阵(人脸图像对应的特征点阵也可以称为人脸的形状)可以用向量O表示,O=(x1,y1...xn,yn)T,其中,(xn,yn)表示第n个特征点。S120、根据第一预设公式获取所述第二特征点阵。The predicted frontal face image is a frontal face image estimated according to the posture face image, that is, the predicted frontal face image is a virtual object. In this embodiment, the posture is obtained by a PCA (Principal Component Analysis) method. The second feature lattice of the predicted frontal face image corresponding to the face image, specifically, a face shape database is first constructed, as shown in Figure 3, and a plurality of face images are stored in the face shape database, For each face image, n feature points are extracted, and the feature lattice corresponding to each face image (the feature lattice corresponding to the face image can also be called the shape of the face) can be represented by a vector O, O=( x 1 , y 1 ... x n , y n ) T , where (x n , y n ) represents the nth feature point. S120. Acquire the second feature lattice according to a first preset formula.

具体地,所述第一预设公式为:Specifically, the first preset formula is:

Figure BDA0002581495000000071
Figure BDA0002581495000000071

Figure BDA0002581495000000072
Figure BDA0002581495000000072

其中,Q0为所述第二特征点阵的向量表示,Ei表示所述人脸形状数据库第i个特征向量,

Figure BDA0002581495000000073
为所述人脸形状数据库的平均形状,O为所述姿态脸图像的人脸形状,n0为常数,而n0-1表示去掉的特征向量的个数,也就是说,在获取所述第二特征点阵时,去掉所述人脸形状数据库的前n0-1个特征向量,n0可以设置为2,3等。根据上述公式,可以获取到所述姿态脸图像对应的预测正脸图像的形状(所述第二特征点阵),如图4所示。Wherein, Q 0 is the vector representation of the second feature lattice, E i represents the ith feature vector of the face shape database,
Figure BDA0002581495000000073
is the average shape of the face shape database, O is the face shape of the posture face image, n 0 is a constant, and n 0 -1 represents the number of removed feature vectors, that is, when obtaining the In the second feature lattice, the first n 0 -1 feature vectors of the face shape database are removed, and n 0 can be set to 2, 3, etc. According to the above formula, the shape of the predicted frontal face image corresponding to the posture face image (the second feature lattice) can be obtained, as shown in FIG. 4 .

请再次参阅图1,所述基于网格形变优化的人脸图像处理方法还包括步骤:Please refer to FIG. 1 again, the face image processing method based on mesh deformation optimization further includes the steps:

S200、分别构建所述姿态脸图像对应的第一网格网络以及所述预测正脸图像对应的第二网格网络。S200. Build a first grid network corresponding to the pose face image and a second grid network corresponding to the predicted front face image, respectively.

在一种可能的实现方式中,为了获取更多的特征点,提升图像处理的精度,所述分别构建所述姿态脸图像对应的第一网格网络以及所述预测正脸图像对应的第二网格网络之前还包括步骤:In a possible implementation manner, in order to obtain more feature points and improve the accuracy of image processing, the first grid network corresponding to the pose face image and the second grid network corresponding to the predicted face image are respectively constructed. The mesh network also includes steps before:

对所述第一特征点阵中的所述第一特征点的数量以及所述第二特征点阵中的所述第二特征点的数量进行扩充。The number of the first feature points in the first feature lattice and the number of the second feature points in the second feature lattice are expanded.

对所述第一特征点阵以及所述第二特征点阵中的特征点数量进行扩充可通过公式:

Figure BDA0002581495000000081
来实现,其中,RS、Q′分别为扩充后的所述第一特征点阵以及所述第二特征点阵,Q0、RS0分别为扩充前的所述第一特征点阵以及所述第二特征点阵,b、T、C分别为预设的尺度系数、变换矩阵和平移矩阵。b、T、C可以通过样本图像预先求解计算得到,具体地,在本实施例中,对所述第一特征点阵以及所述第二特征点阵中的特征点数量是增加人脸额头部分的特征点,扩充后的所述第一特征点阵以及所述第二特征点阵中的特征点数量可以为79个。The number of feature points in the first feature lattice and the second feature lattice can be expanded through the formula:
Figure BDA0002581495000000081
to realize, wherein RS and Q′ are respectively the expanded first feature lattice and the second feature lattice, Q 0 and RS 0 are respectively the first feature lattice before expansion and the second feature lattice The second feature lattice, b, T, and C are preset scale coefficients, transformation matrices and translation matrices, respectively. b, T, and C can be obtained by pre-solving and calculating the sample image. Specifically, in this embodiment, the number of feature points in the first feature lattice and the second feature lattice is increased by adding the forehead part of the face. The number of feature points in the expanded first feature lattice and the second feature lattice may be 79.

所述分别构建所述姿态脸图像对应的第一网格网络以及所述预测正脸图像对应的第二网格网络包括:The step of constructing the first grid network corresponding to the posture face image and the second grid network corresponding to the predicted frontal face image respectively includes:

根据第二预设公式分别构建所述第一网格网络以及所述第二网格网络;respectively constructing the first mesh network and the second mesh network according to a second preset formula;

所述第二预设公式为:The second preset formula is:

Pi+1,j+Pi-1,j+Pi,j+1+Pi,j-1-4Pi,j=0P i+1,j +P i-1,j +P i,j+1 +P i,j-1 -4P i,j =0

i=0,…,Nu;j=0,…,Nv i =0,...,Nu; j=0,..., Nv

其中,Pi,j为网格中位置为第i行,第j列的一个网格点,Nu+1为网格的行数,Nv+1为网格的列数。Among them, P i,j is a grid point in the i-th row and j-th column in the grid, N u +1 is the number of rows of the grid, and N v +1 is the number of columns of the grid.

网格的边界条件为:The boundary conditions of the mesh are:

网格的左边界线、右边界线、上边界线以及下边界线分别为:P0,j、P1,j、Pi,0以及Pi,1The left boundary line, right boundary line, upper boundary line and lower boundary line of the grid are respectively: P 0,j , P 1,j , P i,0 and P i,1 .

根据上述公式分别构建所述第一网格网络和所述第二网格网络,不难看出,所述第一网格网络和所述第二网格网络的初始形状是相同的,在后面的处理步骤中,所述第二网格网络保持不变,对所述第一网格网络进行优化调整。The first mesh network and the second mesh network are respectively constructed according to the above formulas. It is not difficult to see that the initial shapes of the first mesh network and the second mesh network are the same. In the processing step, the second mesh network remains unchanged, and the first mesh network is optimized and adjusted.

S300、根据所述第二网格网络、所述第二特征点阵以及所述第一特征点阵对所述第一网格网络进行优化。S300. Optimize the first grid network according to the second grid network, the second feature lattice, and the first feature lattice.

在构建所述第一网格网络和所述第二网格网络后,对所述第一网格网络进行优化,对所述第一网格网络进行优化是调整所述第一网格网络中各个网格点的位置,优化目的为使得所述各个第一特征点相对于第一网格网络中的网格点的第一相对距离与所述各个第二特征点相对于第二网格网络中的网格点的第二相对距离一致,从而实现根据所述第一网格网络将所述姿态脸图像处理为正脸图像的目的。After the first mesh network and the second mesh network are constructed, the first mesh network is optimized, and the optimization of the first mesh network is to adjust the The position of each grid point, the optimization purpose is to make the first relative distance of each first feature point relative to the grid point in the first grid network and the each second feature point relative to the second grid network. The second relative distances of the grid points in the grid are consistent, so as to achieve the purpose of processing the pose face image into a frontal face image according to the first grid network.

具体地,如图5所示,所述根据所述第二网格网络以及所述第二特征点阵对所述各个第一特征点的位置以及所述第一网格网络进行优化,将所述姿态脸图像处理为正脸图像包括:Specifically, as shown in FIG. 5 , the positions of the first feature points and the first grid network are optimized according to the second grid network and the second feature lattice, and the The processing of the pose face image into a frontal face image includes:

S310、根据第三预设公式对所述第一网格网络进行初优化;S310. Perform initial optimization on the first mesh network according to a third preset formula;

所述第三预设公式为:The third preset formula is:

Figure BDA0002581495000000091
Figure BDA0002581495000000091

其中,Pi,j,P′i,j分别为所述第一网格网络和所述第二网格网络的网格点,Qt,Q′t分别为从所述第一网格网络中Pi,j网格点开始的网格中的第t个第一特征点和从所述第二网格网络中从P′i,j网格点开始的网格中第t个第二特征点,通过所述第三预设公式迭代优化所述第一网格网络中网格点的位置。Wherein, P i,j , P′ i,j are the grid points of the first grid network and the second grid network, respectively, Q t , Q′ t are the grid points from the first grid network The t-th first feature point in the grid starting from the grid point P i,j and the t-th second feature point in the grid starting from the grid point P′ i,j in the second grid network feature points, iteratively optimizes the positions of grid points in the first grid network by using the third preset formula.

值得说明的是,Qt一开始可能在不在从Pi,j开始的网格中,通过所述第三预设公式,对应点Qt将在经过一个多次迭代后逐渐接近网格点Pi,jIt is worth noting that Q t may not be in the grid starting from P i,j at the beginning, and through the third preset formula, the corresponding point Q t will gradually approach the grid point P after a number of iterations. i,j .

S320、根据第一优化函数、第二优化函数以及第三优化函数对进行了所述初优化的所述第一网格网络进行再优化;S320. Re-optimize the first grid network that has performed the initial optimization according to the first optimization function, the second optimization function, and the third optimization function;

在进行了所述步骤S310后,所述第一网格网络中的网格点位置被初步优化,在所述步骤S320中,还对所述第一网格网络进行进一步优化。After performing the step S310, the grid point positions in the first grid network are preliminarily optimized, and in the step S320, the first grid network is further optimized.

在所述步骤S320中,使用中间域上的结构与纹理相似性自动进行图像形变优化,具体地,所述第一优化函数、第二优化函数以及第三优化函数分别是基于平滑度、平移不变性以及人脸左右对称性构建的。In the step S320, the image deformation optimization is automatically performed using the structure and texture similarity in the intermediate domain. Specifically, the first optimization function, the second optimization function and the third optimization function are based on smoothness, translation Transgender and the left-right symmetry of the human face.

所述第一优化函数是用于约束根据优化后的所述第一网格网络将所述姿态脸图像转换得到的正脸图像的平滑度,所述第一优化函数的值越小,正脸图像的平滑性越好,所述第一优化函数为:The first optimization function is used to constrain the smoothness of the frontal face image obtained by converting the posture face image according to the optimized first grid network. The better the smoothness of the image, the first optimization function is:

ETPS(z(Pi,j))=(zx″u,u)2+2(zx″u,v)2+(zx″v,v)2+(zy″u,u)2+2(zy″u,v)2+(zy″v,v)2 E TPS (z(P i,j ))=(zx″ u,u ) 2 +2(zx″ u,v ) 2 +(zx″ v,v ) 2 +(zy″ u,u ) 2 +2 (zy″ u,v ) 2 +(zy″ v,v ) 2

其中,z(Pi,j)=(zx,zy),表示Pi,j网格点的偏移量,zx为Pi,j网格点在u方向上的偏移量,zy为Pi,j网格点在v方向上的偏移量,zx″u,v表示zx相对于u方向和v方向的二阶方向偏导数,即在本实施例中,将平滑度表示为人脸网络x方向和y方向上的薄板样条(TPS)之和。Among them, z(P i,j )=(zx,zy), represents the offset of the P i, j grid point, zx is the offset of the Pi ,j grid point in the u direction, and zy is P The offset of i,j grid points in the v direction, zx″ u,v represents the second-order directional partial derivative of zx with respect to the u direction and the v direction, that is, in this embodiment, the smoothness is expressed as the face network The sum of thin plate splines (TPS) in the x and y directions.

所述第二优化函数是用于约束根据优化后的所述第一网格网络将所述姿态脸图像转换得到的正脸图像的平移不变性,所述第二优化函数的函数值越小,正脸图像的平移不变性越好,所述第二优化函数为:The second optimization function is used to constrain the translation invariance of the frontal face image obtained by converting the pose face image according to the optimized first grid network, and the smaller the function value of the second optimization function, The translation invariance of the frontal face image is better, and the second optimization function is:

Figure BDA0002581495000000101
Figure BDA0002581495000000101

其中,z(Qt)=Q′t-Qt,表示Qt,Q′t之间的平移向量。Wherein, z(Q t )=Q′ t −Q t , which represents the translation vector between Q t and Q′ t .

所述第三优化函数用于约束根据所述第一网格网络将姿态脸图像转换得到的正脸图像的左右对称性,所述第三优化函数的函数值越小,正脸图像的左右对称性越好,具体地,在本实施例中,左右对称性包括形状对称性和纹理对称性,所述第三优化函数为:The third optimization function is used to constrain the left-right symmetry of the frontal face image obtained by converting the posture face image according to the first grid network. The smaller the function value of the third optimization function, the left-right symmetry of the frontal face image. Specifically, in this embodiment, the left-right symmetry includes shape symmetry and texture symmetry, and the third optimization function is:

Figure BDA0002581495000000111
Figure BDA0002581495000000111

其中,LSymShape为约束形状对称性的函数,LSymTex为约束纹理对称性的函数

Figure BDA0002581495000000112
分别表示姿态脸图像左右两边具有相同点序的特征点列,
Figure BDA0002581495000000113
Figure BDA0002581495000000114
分别为所述第一网格网络中姿态脸图像左右两边对应的网格点的像素颜色。根据公式
Figure BDA0002581495000000115
可以将约束形状对称性的函数中的特征点转化为网格点,使得网格点作为函数LSymShape中的变量,实现通过函数LSymShape对所述第一网格网络进行优化。Among them, L SymShape is a function that constrains shape symmetry, and L SymTex is a function that constrains texture symmetry
Figure BDA0002581495000000112
respectively represent the feature point columns with the same point sequence on the left and right sides of the pose face image,
Figure BDA0002581495000000113
Figure BDA0002581495000000114
are the pixel colors of the grid points corresponding to the left and right sides of the pose face image in the first grid network, respectively. According to the formula
Figure BDA0002581495000000115
The feature points in the function constraining the shape symmetry can be converted into grid points, so that the grid points are used as variables in the function L SymShape to realize the optimization of the first grid network by the function L SymShape .

对进行了所述初优化的所述第一网格网络进行再优化是通过求解所述第一优化函数、所述第二优化函数以及所述第三优化函数进行的,具体地,所述根据第一优化函数、第二优化函数以及第三优化函数对进行了所述初优化的所述第一网格网络进行再优化包括:The re-optimization of the first grid network after the initial optimization is performed by solving the first optimization function, the second optimization function and the third optimization function. The first optimization function, the second optimization function and the third optimization function to re-optimize the first grid network after the initial optimization includes:

获取使得所述第一优化函数、所述第二优化函数以及所述第三优化函数的函数值达到最小的第一网格网络作为优化结果。A first mesh network that minimizes the function values of the first optimization function, the second optimization function, and the third optimization function is obtained as an optimization result.

前面已经说明了所述第一优化函数、所述第二优化函数以及所述第三优化函数与图像的平滑度、平移不变性以及左右对称性的关系,因此,通过使得所述第一优化函数、所述第二优化函数以及所述第三优化函数的和为最小值的约束方式对所述第一网格网络进行优化(调整所述第一网格网络中各个网格点的位置以及像素值),这样,根据优化后的所述第一网格网络生成的图像质量更高。The relationship between the first optimization function, the second optimization function and the third optimization function and the smoothness, translation invariance and left-right symmetry of the image has been described above. Therefore, by making the first optimization function , the second optimization function and the third optimization function sum to the minimum value to optimize the first grid network (adjust the position and pixel position of each grid point in the first grid network value), in this way, the image quality generated according to the optimized first mesh network is higher.

请再次参阅图1,所述基于网格形变优化的人脸图像处理方法还包括步骤:Please refer to FIG. 1 again, the face image processing method based on mesh deformation optimization further includes the steps:

S400、根据优化后的第一网格网络将所述姿态脸图像转化为目标正脸图像。S400. Convert the pose face image into a target front face image according to the optimized first grid network.

具体地,所述根据优化后的第一网格网络将所述姿态脸图像转化为目标正脸图像包括:Specifically, converting the pose face image into a target frontal face image according to the optimized first grid network includes:

S410、根据优化后的第一网格网络将所述姿态脸图像转化为中间正脸图像;S410, according to the optimized first grid network, the posture face image is converted into a middle frontal face image;

S420、根据第四预设公式对所述中间正脸图像进行修正,获取所述目标正脸图像。S420. Correct the middle frontal face image according to a fourth preset formula to acquire the target frontal face image.

根据优化后的所述第一网格网络可以生成所述第一网格网络对应的图像,此为现有技术,在此不再赘述。在一种可能的实现方式中,直接将所述步骤S410中生成的所述中间正脸图像作为所述目标正脸图像,即作为对所述姿态脸图像的处理结果。但是,对于较大倾斜姿势的人脸图像,所述姿态脸会包含较大的遮挡部分,根据所述姿态脸生成的所述中间正脸图像的某些区域会存在纹理丢失的情况(如图6所示),将纹理丢失的区域称为被遮挡区域,在本实施例中,采用第四预设公式对所述中间正脸图像进行处理,生成最终的所述目标正脸图像。An image corresponding to the first grid network may be generated according to the optimized first grid network, which is a prior art and will not be repeated here. In a possible implementation manner, the intermediate frontal face image generated in the step S410 is directly used as the target frontal face image, that is, as the processing result of the posture face image. However, for a face image with a relatively large tilt posture, the posture face will contain a large occluded part, and some areas of the middle frontal face image generated according to the posture face may have texture loss (as shown in the figure). 6), the area where the texture is lost is called the occluded area. In this embodiment, the fourth preset formula is used to process the intermediate frontal face image to generate the final target frontal face image.

对所述中间正脸图像进行处理是采用基于泊松的修补方法,常规的填充算法公式为:The middle frontal face image is processed using a Poisson-based inpainting method, and the conventional filling algorithm formula is:

Figure BDA0002581495000000121
Figure BDA0002581495000000121

其中,OLp是图像中被遮挡区域中像素点p的亮度,OLq为p像素点的邻域中像素点q的亮度,NLp、NLq分别为被遮挡区域对应的非遮挡区域中与像素点p和像素点q相应的像素点的亮度,Np为像素点p的4邻域,即|Np|=4。Among them, OL p is the brightness of pixel p in the occluded area in the image, OL q is the brightness of pixel q in the neighborhood of p pixel point, NL p , NL q are the non-occluded area corresponding to the occluded area and The brightness of the pixel points corresponding to the pixel point p and the pixel point q, N p is the 4 neighborhoods of the pixel point p, ie |N p |=4.

在本实施例中,对上述公式进行改进后进行对所述中间脸图像的处理,所述第四预设公式为:In this embodiment, after the above formula is improved, the middle face image is processed, and the fourth preset formula is:

Figure BDA0002581495000000131
Figure BDA0002581495000000131

其中,OLp是所述中间正脸图像被遮挡区域中像素点p的亮度,OLq为p像素点的邻域中像素点q的亮度,NLp、NLq分别为与所述被遮挡区域对应的非遮挡区域中与像素点p和像素点q相应的像素点的亮度,Np为像素点p的8邻域,CEOL、CENL分别为被遮挡区域以及与所述被遮挡区域对应的非遮挡区域中边界环区域中像素点的光照强度变化幅度。Wherein, OL p is the brightness of the pixel p in the occluded area of the intermediate frontal face image, OL q is the brightness of the pixel q in the neighborhood of the p pixel, NL p and NL q are the same as the occluded area, respectively. The brightness of the pixel points corresponding to the pixel point p and the pixel point q in the corresponding non-occluded area, N p is the 8 neighborhoods of the pixel point p, CE OL and CE NL are the occluded area and the corresponding occluded area respectively. The magnitude of the illumination intensity change of the pixels in the bounding ring region in the non-occluded region.

从上面的说明不难看出,在本实施例中,将相邻像素的数量由4个更改为8个,将与每个像素对应的方程式数量由1个更改为8个,并获取了亮度差异的比率系数,提升了填充时获取的细节信息,提升填充区域的真实性。通过所述第四预设公式求解所述中间脸图像中异常区域的光照强度,得到所述目标正脸图像,如图7所示。It is not difficult to see from the above description that in this embodiment, the number of adjacent pixels is changed from 4 to 8, the number of equations corresponding to each pixel is changed from 1 to 8, and the brightness difference is obtained The ratio coefficient of , improves the detail information obtained during filling and improves the authenticity of the filling area. The illumination intensity of the abnormal area in the intermediate face image is obtained by using the fourth preset formula to obtain the target frontal face image, as shown in FIG. 7 .

综上所述,本实施例提供了一种基于网格形变优化的人脸图像处理方法,所述基于网格形变优化的人脸图像处理方法用于处理姿态脸图像,通过根据姿态脸图像的第一特征点阵获取预测正脸图像的第二特征点阵,并构建姿态脸图像的第一网格网络和预测正脸图像的第二网格网络,根据所述第二网格网络、所述第二特征点阵以及所述第一特征点阵对所述第一网格网络进行优化;根据优化后的第一网格网络将所述姿态脸图像转化为目标正脸图像,本发明实现了将姿态脸图像转化为正脸图像,能够使得人脸识别技术能够识别姿态脸图像,提升人脸识别系统的性能。To sum up, this embodiment provides a face image processing method based on grid deformation optimization. The first feature lattice obtains the second feature lattice for predicting the frontal face image, and constructs the first grid network for the posture face image and the second grid network for predicting the frontal face image. The second feature lattice and the first feature lattice optimize the first grid network; according to the optimized first grid network, the posture face image is converted into a target face image, the present invention realizes In order to convert the gesture face image into a front face image, the face recognition technology can recognize the gesture face image and improve the performance of the face recognition system.

应该理解的是,虽然本发明说明书附图中给出的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,流程图中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些子步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the various steps in the flowcharts given in the accompanying drawings of the present invention are shown in sequence according to the arrows, these steps are not necessarily executed in the sequence shown by the arrows. Unless explicitly stated herein, the execution of these steps is not strictly limited to the order, and these steps may be performed in other orders. Moreover, at least a part of the steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but may be executed at different times. The execution of these sub-steps or stages The sequence is also not necessarily sequential, but may be performed alternately or alternately with other steps or sub-steps of other steps or at least a portion of a phase.

本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本发明所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。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 implemented by instructing relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage In the medium, when the computer program is executed, it may include the processes of the above-mentioned method embodiments. Wherein, any reference to memory, storage, database or other medium used in the various embodiments provided by the present invention may include non-volatile and/or volatile memory. Nonvolatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Road (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

实施例二Embodiment 2

基于上述实施例,本发明还相应提供了一种终端,如图8所示,所述终端包括处理器10以及存储器20。可以理解的是,图8仅示出了终端的部分组件,但是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。Based on the above embodiments, the present invention also provides a terminal correspondingly. As shown in FIG. 8 , the terminal includes a processor 10 and a memory 20 . It can be understood that FIG. 8 only shows some components of the terminal, but it should be understood that it is not required to implement all the shown components, and more or less components may be implemented instead.

所述存储器20在一些实施例中可以是所述终端的内部存储单元,例如终端的硬盘或内存。所述存储器20在另一些实施例中也可以是所述终端的外部存储设备,例如所述终端上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(SecureDigital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器20还可以既包括所述终端的内部存储单元也包括外部存储设备。所述存储器20用于存储安装于所述终端的应用软件及各类数据。所述存储器20还可以用于暂时地存储已经输出或者将要输出的数据。在一实施例中,存储器20上存储有基于网格形变优化的人脸图像处理程序30,该基于网格形变优化的人脸图像处理程序30可被处理器10所执行,从而实现本申请中基于网格形变优化的人脸图像处理方法。In some embodiments, the memory 20 may be an internal storage unit of the terminal, such as a hard disk or a memory of the terminal. In other embodiments, the memory 20 may also be an external storage device of the terminal, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD card) equipped on the terminal. ) card, flash card (Flash Card) and so on. Further, the memory 20 may also include both an internal storage unit of the terminal and an external storage device. The memory 20 is used for storing application software and various types of data installed in the terminal. The memory 20 can also be used to temporarily store data that has been output or is to be output. In one embodiment, the memory 20 stores a face image processing program 30 optimized based on mesh deformation, and the face image processing program 30 optimized based on mesh deformation can be executed by the processor 10, thereby realizing the A face image processing method based on mesh deformation optimization.

所述处理器10在一些实施例中可以是一中央处理器(Central Processing Unit,CPU),微处理器或其他芯片,用于运行所述存储器20中存储的程序代码或处理数据,例如执行所述基于网格形变优化的人脸图像处理方法等。In some embodiments, the processor 10 may be a central processing unit (Central Processing Unit, CPU), a microprocessor or other chips, for running the program codes or processing data stored in the memory 20, such as executing all Describe the face image processing method based on mesh deformation optimization, etc.

在一实施例中,当处理器10执行所述存储器20中基于网格形变优化的人脸图像处理程序30时实现以下步骤:In one embodiment, when the processor 10 executes the face image processing program 30 optimized based on mesh deformation in the memory 20, the following steps are implemented:

获取姿态脸图像的第一特征点阵以及所述姿态脸图像对应的预测正脸图像的第二特征点阵,其中,所述第一特征点阵包括各个第一特征点,所述第二特征点阵包括各个第二特征点;Obtain the first feature lattice of the pose face image and the second feature lattice of the predicted frontal face image corresponding to the pose face image, wherein the first feature lattice includes each first feature point, and the second feature The lattice includes each second feature point;

分别构建所述第一特征点阵对应的第一网格网络以及所述第二特征点阵对应的第二网格网络;respectively constructing a first grid network corresponding to the first feature lattice and a second grid network corresponding to the second feature lattice;

根据所述第二网格网络、所述第二特征点阵以及所述第一特征点阵对所述第一网格网络进行优化;Optimizing the first grid network according to the second grid network, the second feature lattice and the first feature lattice;

根据优化后的第一网格网络将所述姿态脸图像转化为目标正脸图像。The pose face image is converted into a target front face image according to the optimized first mesh network.

其中,获取所述姿态脸图像对应的预测正脸图像的第二特征点阵包括:Wherein, obtaining the second feature lattice of the predicted frontal face image corresponding to the posture face image includes:

构建人脸形状数据库,获取所述人脸形状数据库的特征向量;constructing a face shape database, and obtaining the feature vector of the face shape database;

根据第一预设公式获取所述第二特征点阵,The second feature lattice is obtained according to the first preset formula,

其中,所述第一预设公式为:Wherein, the first preset formula is:

Figure BDA0002581495000000151
Figure BDA0002581495000000151

Figure BDA0002581495000000152
Figure BDA0002581495000000152

其中,Q0为所述第二特征点阵的向量表示,Ei表示所述人脸形状数据库第i个特征向量,

Figure BDA0002581495000000162
为所述人脸形状数据库的平均形状,O为所述姿态脸图像的人脸形状,n0为常数,而n0-1表示去掉的特征向量的个数。Wherein, Q 0 is the vector representation of the second feature lattice, E i represents the ith feature vector of the face shape database,
Figure BDA0002581495000000162
is the average shape of the face shape database, O is the face shape of the pose face image, n 0 is a constant, and n 0 -1 represents the number of removed feature vectors.

其中,所述分别构建所述第一特征点阵对应的第一网格网络以及所述第二特征点阵对应的第二网格网络之前包括:Wherein, before respectively constructing the first grid network corresponding to the first feature lattice and the second grid network corresponding to the second feature lattice, the steps include:

对所述第一特征点阵中的所述第一特征点的数量以及所述第二特征点阵中的所述第二特征点的数量进行扩充。The number of the first feature points in the first feature lattice and the number of the second feature points in the second feature lattice are expanded.

其中,所述分别构建所述姿态脸图像对应的第一网格网络以及所述预测正脸图像对应的第二网格网络包括:Wherein, constructing the first grid network corresponding to the posture face image and the second grid network corresponding to the predicted frontal face image respectively includes:

根据第二预设公式分别构建所述第一网格网络以及所述第二网格网络;respectively constructing the first mesh network and the second mesh network according to a second preset formula;

其中,所述第二预设公式为:Wherein, the second preset formula is:

Pi+1,j+Pi-1,j+Pi,j+1+Pi,j-1-4Pi,j=0P i+1,j +P i-1,j +P i,j+1 +P i,j-1 -4P i,j =0

i=0,…,Nu;j=0,…,Nv i =0,...,Nu; j=0,..., Nv

其中,Pi,j为网格中位置为第i行,第j列的一个网格点,Nu+1为网格的行数,Nv+1为网格的列数。Among them, P i,j is a grid point in the i-th row and j-th column in the grid, N u +1 is the number of rows of the grid, and N v +1 is the number of columns of the grid.

其中,所述根据所述第二网格网络、所述第二特征点阵以及所述第一特征点阵对所述各个第一特征点的位置以及所述第一网格网络进行优化包括:Wherein, the optimizing the positions of the first feature points and the first grid network according to the second grid network, the second feature lattice and the first feature lattice includes:

根据第三预设公式对所述第一网格网络进行初优化;Perform initial optimization on the first mesh network according to a third preset formula;

根据第一优化函数、第二优化函数以及第三优化函数对进行了所述初优化的所述第一网格网络进行再优化;Re-optimize the first grid network on which the initial optimization has been performed according to the first optimization function, the second optimization function and the third optimization function;

其中,所述第三预设公式为:Wherein, the third preset formula is:

Figure BDA0002581495000000161
Figure BDA0002581495000000161

其中,Pi,j,P′i,j分别为所述第一网格网络和所述第二网格网络的网格点,Qt,Q′t分别为从所述第一网格网络中Pi,j网格点开始的网格中的第t个第一特征点和从所述第二网格网络中从P′i,j网格点开始的网格中第t个第二特征点;Wherein, P i,j , P′ i,j are the grid points of the first grid network and the second grid network, respectively, Q t , Q′ t are the grid points from the first grid network The t-th first feature point in the grid starting from the grid point P i,j and the t-th second feature point in the grid starting from the grid point P′ i,j in the second grid network Feature points;

所述根据第一优化函数、第二优化函数以及第三优化函数分别是基于平滑度、平移不变性以及人脸左右对称性构建的。The first optimization function, the second optimization function and the third optimization function are respectively constructed based on smoothness, translation invariance and left-right symmetry of the human face.

其中,所述第一优化函数为:Wherein, the first optimization function is:

ETPS(z(Pi,j))=(zx″u,u)2+2(zx″u,v)2+(zx″v,v)2+(zy″u,u)2+2(zy″u,v)2+(zy″v,v)2 E TPS (z(P i,j ))=(zx″ u,u ) 2 +2(zx″ u,v ) 2 +(zx″ v,v ) 2 +(zy″ u,u ) 2 +2 (zy″ u,v ) 2 +(zy″ v,v ) 2

其中,z(Pi,j)=(zx,zy),表示Pi,j网格点的偏移量,zx为Pi,j网格点在u方向上的偏移量,zy为Pi,j网格点在v方向上的偏移量,zx″u,v表示zx相对于u方向和v方向的二阶方向偏导数;Among them, z(P i,j )=(zx,zy), represents the offset of the P i, j grid point, zx is the offset of the Pi ,j grid point in the u direction, and zy is P The offset of i, j grid points in the v direction, zx″ u, v represents the second-order partial derivative of zx with respect to the u and v directions;

所述第二优化函数为:The second optimization function is:

Figure BDA0002581495000000171
Figure BDA0002581495000000171

其中,z(Qt)=Q′t-Qt,表示Qt,Q′t之间的平移向量;Wherein, z(Q t )=Q' t -Q t , which represents the translation vector between Q t and Q't;

所述第三优化函数为:The third optimization function is:

Figure BDA0002581495000000172
Figure BDA0002581495000000172

其中,

Figure BDA0002581495000000173
分别表示姿态脸图像左右两边具有相同点序的特征点列,
Figure BDA0002581495000000174
分别为所述第一网格网络中姿态脸图像左右两边对应的网格点的像素颜色。in,
Figure BDA0002581495000000173
respectively represent the feature point columns with the same point sequence on the left and right sides of the pose face image,
Figure BDA0002581495000000174
are the pixel colors of the grid points corresponding to the left and right sides of the pose face image in the first grid network, respectively.

其中,所述根据第一优化函数、第二优化函数以及第三优化函数对进行了所述初优化的所述第一网格网络进行再优化包括:Wherein, the re-optimization of the first grid network after the initial optimization according to the first optimization function, the second optimization function and the third optimization function includes:

获取使得所述第一优化函数、所述第二优化函数以及所述第三优化函数的函数值达到最小的第一网格网络作为优化结果。A first mesh network that minimizes the function values of the first optimization function, the second optimization function, and the third optimization function is obtained as an optimization result.

其中,所述根据优化后的第一网格网络将所述姿态脸图像转化为目标正脸图像包括:Wherein, converting the pose face image into a target frontal face image according to the optimized first grid network includes:

根据优化后的第一网格网络将所述姿态脸图像转化为中间正脸图像;Converting the pose face image into an intermediate frontal face image according to the optimized first grid network;

根据第四预设公式对所述中间正脸图像进行修正,获取所述目标正脸图像;Correcting the middle frontal face image according to the fourth preset formula, and obtaining the target frontal face image;

其中,所述第四预设公式为:Wherein, the fourth preset formula is:

Figure BDA0002581495000000181
Figure BDA0002581495000000181

其中,OLp是所述中间正脸图像被遮挡区域中像素点p的亮度,OLq为p像素点的邻域中像素点q的亮度,NLp、NLq分别为与所述被遮挡区域对应的非遮挡区域中与像素点p和像素点q相应的像素点的亮度,Np为像素点p的8邻域,CEOL、CENL分别为被遮挡区域以及与所述被遮挡区域对应的非遮挡区域中边界环区域中像素点的光照强度变化幅度。Wherein, OL p is the brightness of the pixel p in the occluded area of the intermediate frontal face image, OL q is the brightness of the pixel q in the neighborhood of the p pixel, NL p and NL q are the same as the occluded area, respectively. The brightness of the pixel points corresponding to the pixel point p and the pixel point q in the corresponding non-occluded area, N p is the 8 neighborhoods of the pixel point p, CE OL and CE NL are the occluded area and the corresponding occluded area respectively. The magnitude of the illumination intensity change of the pixels in the bounding ring region in the non-occluded region.

实施例三Embodiment 3

本发明还提供一种存储介质,其中,存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个处理器执行,以实现如上所述的基于网格形变优化的人脸图像处理方法的步骤。The present invention also provides a storage medium, in which one or more programs are stored, and the one or more programs can be executed by one or more processors, so as to realize the above-mentioned mesh-based deformation optimization of the human face The steps of an image processing method.

最后应说明的是:以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present invention, but not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand: it can still be Modifications are made to the technical solutions described in the foregoing embodiments, or some technical features thereof are equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. A face image processing method based on mesh deformation optimization is characterized by comprising the following steps:
acquiring a first feature lattice of an attitude face image and a second feature lattice of a predicted front face image corresponding to the attitude face image, wherein the first feature lattice comprises each first feature point, and the second feature lattice comprises each second feature point;
respectively constructing a first grid network corresponding to the first characteristic lattice and a second grid network corresponding to the second characteristic lattice;
optimizing the first mesh network according to the second mesh network, the second feature lattice and the first feature lattice;
and converting the attitude face image into a target front face image according to the optimized first grid network.
2. The method for processing the human face image based on the mesh deformation optimization according to claim 1, wherein the obtaining of the second feature lattice of the predicted front face image corresponding to the pose face image comprises:
constructing a face shape database, and acquiring a feature vector of the face shape database;
obtaining the second characteristic lattice according to a first preset formula,
wherein the first preset formula is as follows:
Figure FDA0002581494990000011
Figure FDA0002581494990000012
wherein ,Q0For the vector representation of said second feature lattice, EiRepresenting the ith feature vector of the face shape database,
Figure FDA0002581494990000013
is the average shape of the face shape database, O is the face shape of the posed face image, n0Is a constant number, n0-1 represents the number of removed feature vectors.
3. The method for processing a face image based on mesh deformation optimization according to claim 1, wherein before the respectively constructing a first mesh network corresponding to the first feature lattice and a second mesh network corresponding to the second feature lattice, the method comprises:
and expanding the number of the first characteristic points in the first characteristic lattice and the number of the second characteristic points in the second characteristic lattice.
4. The method for processing a human face image based on mesh deformation optimization according to claim 1, wherein the respectively constructing a first mesh network corresponding to the pose face image and a second mesh network corresponding to the predicted front face image comprises:
respectively constructing the first mesh network and the second mesh network according to a second preset formula;
wherein the second preset formula is as follows:
Pi+1,j+Pi-1,j+Pi,j+1+Pi,j-1-4Pi,j=0
i=0,…,Nu;j=0,…,Nv
wherein ,Pi,jFor a grid point in the grid network, which is located at the ith row and the jth column, Nu+1 is the number of rows in the mesh network, Nv+1 is the number of columns in the mesh network.
5. The method for processing a facial image based on mesh deformation optimization according to claim 1, wherein the optimizing the positions of the first feature points and the first mesh network according to the second mesh network, the second feature point lattice and the first feature point lattice comprises:
performing primary optimization on the first grid network according to a third preset formula;
re-optimizing the first mesh network subjected to the primary optimization according to a first optimization function, a second optimization function and a third optimization function;
wherein the third preset formula is as follows:
Figure FDA0002581494990000021
wherein ,Pi,j,P′i,jMesh points, Q, of the first mesh network and the second mesh network, respectivelyt,Q′tRespectively P from the first mesh networki,jT-th first feature point in mesh starting at mesh point and P 'from the second mesh network'i,jThe t-th second feature point in the grid from the grid point;
the first optimization function, the second optimization function and the third optimization function are respectively constructed based on smoothness, translation invariance and face bilateral symmetry.
6. The method for processing a facial image based on mesh deformation optimization according to claim 5, wherein the first optimization function is:
ETPS(z(Pi,j))=(zx″u,u)2+2(zx″u,v)2+(zx″v,v)2+(zy″u,u)2+2(zy″u,v)2+(zy″v,v)2
wherein ,z(Pi,j) (zx, zy) represents Pi,jOffset of grid points, zx being Pi,jThe grid points are offset in the u direction by an amount of Pi,jOffset of grid points in the v direction, zx ″u,vRepresents the second directional partial derivatives of zx with respect to the u and v directions;
the second optimization function is:
ETI(z(Pi,j))=(1-α′-β′)||z(Pi,j)-z(Qt)||2+α′||z(Pi,j+1)-z(Qt)||2+β′||z(Pi+1,j)-z(Qt)||2
Figure FDA0002581494990000031
wherein ,z(Qt)=Q″t-QtDenotes Qt,Q″tA translation vector therebetween;
the third optimization function is:
Figure FDA0002581494990000032
Figure FDA0002581494990000033
wherein ,
Figure FDA0002581494990000034
respectively represent characteristic point columns with the same point sequence on the left side and the right side of the pose face image,
Figure FDA0002581494990000035
and the pixel colors of grid points corresponding to the left side and the right side of the attitude face image in the first grid network are respectively.
7. The method of claim 6, wherein the re-optimizing the first mesh network subjected to the initial optimization according to a first optimization function, a second optimization function and a third optimization function comprises:
and acquiring a first mesh network which enables the function value of the first optimization function, the second optimization function and the third optimization function to be minimum as an optimization result.
8. The mesh deformation optimization-based facial image processing method according to claim 1, wherein the converting the pose face image into the target front face image according to the optimized first mesh network comprises:
converting the attitude face image into a middle front face image according to the optimized first grid network;
correcting the middle front face image according to a fourth preset formula to obtain the target front face image;
wherein the fourth preset formula is:
Figure FDA0002581494990000041
wherein ,OLpIs the brightness, OL, of the pixel points p in the shielded region of the intermediate front face imageqIs the brightness, NL, of pixel q in the neighborhood of p pixelsp、NLqBrightness, N, of pixel points corresponding to pixel point p and pixel point q in a non-shielding region corresponding to the shielded region, respectivelyp8 neighbourhood of pixel point p, CEOL、CENLThe variation range of the illumination intensity of the pixel points in the boundary ring region in the sheltered region and the non-sheltered region corresponding to the sheltered region are respectively.
9. A terminal, characterized in that the terminal comprises: a processor, and a storage medium communicatively connected to the processor, the storage medium being adapted to store a plurality of instructions, the processor being adapted to call the instructions in the storage medium to execute the steps of implementing the mesh deformation optimization-based face image processing method according to any one of the preceding claims 1 to 8.
10. A storage medium storing one or more programs, the one or more programs being executable by one or more processors to implement the steps of the mesh deformation optimization-based face image processing method according to any one of claims 1 to 8.
CN202010668700.3A 2020-07-13 2020-07-13 Face image processing method, terminal and storage medium based on grid deformation optimization Active CN111797797B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010668700.3A CN111797797B (en) 2020-07-13 2020-07-13 Face image processing method, terminal and storage medium based on grid deformation optimization

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010668700.3A CN111797797B (en) 2020-07-13 2020-07-13 Face image processing method, terminal and storage medium based on grid deformation optimization

Publications (2)

Publication Number Publication Date
CN111797797A true CN111797797A (en) 2020-10-20
CN111797797B CN111797797B (en) 2023-09-15

Family

ID=72808406

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010668700.3A Active CN111797797B (en) 2020-07-13 2020-07-13 Face image processing method, terminal and storage medium based on grid deformation optimization

Country Status (1)

Country Link
CN (1) CN111797797B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108304829A (en) * 2018-03-08 2018-07-20 北京旷视科技有限公司 Face identification method, apparatus and system
WO2019100608A1 (en) * 2017-11-21 2019-05-31 平安科技(深圳)有限公司 Video capturing device, face recognition method, system, and computer-readable storage medium
WO2019128508A1 (en) * 2017-12-28 2019-07-04 Oppo广东移动通信有限公司 Method and apparatus for processing image, storage medium, and electronic device
CN110363091A (en) * 2019-06-18 2019-10-22 广州杰赛科技股份有限公司 Face identification method, device, equipment and storage medium in the case of side face

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019100608A1 (en) * 2017-11-21 2019-05-31 平安科技(深圳)有限公司 Video capturing device, face recognition method, system, and computer-readable storage medium
WO2019128508A1 (en) * 2017-12-28 2019-07-04 Oppo广东移动通信有限公司 Method and apparatus for processing image, storage medium, and electronic device
CN108304829A (en) * 2018-03-08 2018-07-20 北京旷视科技有限公司 Face identification method, apparatus and system
CN110363091A (en) * 2019-06-18 2019-10-22 广州杰赛科技股份有限公司 Face identification method, device, equipment and storage medium in the case of side face

Also Published As

Publication number Publication date
CN111797797B (en) 2023-09-15

Similar Documents

Publication Publication Date Title
JP6044134B2 (en) Image area dividing apparatus, method, and program according to optimum image size
US10389936B2 (en) Focus stacking of captured images
CN111968134B (en) Target segmentation method, device, computer readable storage medium and computer equipment
CN111681165A (en) Image processing method, image processing device, computer equipment and computer readable storage medium
JP7149124B2 (en) Image object extraction device and program
CN113723399B (en) A license plate image correction method, license plate image correction device and storage medium
CN113888429B (en) Image brightening method and device, and electronic device
CN114418869B (en) Document image geometric correction method, system, device and medium
CN111768415A (en) Image instance segmentation method without quantization pooling
CN112883983B (en) Feature extraction method, device and electronic system
CN111860582B (en) Image classification model construction method and device, computer equipment and storage medium
CN111046755A (en) Character recognition method, character recognition device, computer equipment and computer-readable storage medium
CN111754521B (en) Image processing method and device, electronic equipment and storage medium
CN118608438A (en) Image quality improvement method, device, equipment and medium
CN111797797B (en) Face image processing method, terminal and storage medium based on grid deformation optimization
WO2024016368A1 (en) Mask-guided image mosaic line generation method and apparatus, computer device, and storage medium
KR102726834B1 (en) Apparatus and method for estimating human pose based AI
CN109636818A (en) A kind of Laplce's canonical constrains the Target Segmentation method of lower low-rank sparse optimization
CN115587994A (en) Method and device for image tampering detection based on model fusion based on multi-view features
CN114331871B (en) A video inverse tone mapping method and related device capable of removing banding artifacts
CN115705658A (en) Camera pose estimation method and device, computer equipment and storage medium
CN117877043B (en) Model training method, text recognition method, device, equipment and medium
CN118470539B (en) Building base extraction method, device and equipment based on non-orthographic remote sensing image
CN113592970B (en) Method and device for generating hair styling, electronic equipment and storage medium
CN113643210B (en) Image processing method, device, electronic equipment and storage medium

Legal Events

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