CN109035380B - Face modification method, device and equipment based on three-dimensional reconstruction and storage medium - Google Patents

Face modification method, device and equipment based on three-dimensional reconstruction and storage medium Download PDF

Info

Publication number
CN109035380B
CN109035380B CN201811060479.2A CN201811060479A CN109035380B CN 109035380 B CN109035380 B CN 109035380B CN 201811060479 A CN201811060479 A CN 201811060479A CN 109035380 B CN109035380 B CN 109035380B
Authority
CN
China
Prior art keywords
dimensional
target modification
target
face
modification area
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811060479.2A
Other languages
Chinese (zh)
Other versions
CN109035380A (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.)
Yuanli Jinzhi (Chongqing) Technology Co.,Ltd.
Original Assignee
Beijing Kuangshi Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kuangshi Technology Co Ltd filed Critical Beijing Kuangshi Technology Co Ltd
Priority to CN201811060479.2A priority Critical patent/CN109035380B/en
Publication of CN109035380A publication Critical patent/CN109035380A/en
Application granted granted Critical
Publication of CN109035380B publication Critical patent/CN109035380B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/00Three-dimensional [3D] image rendering
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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

Landscapes

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

Abstract

The invention provides a face modification method, a face modification device, face modification equipment and a storage medium based on three-dimensional reconstruction, and belongs to the technical field of image processing. The method comprises the following steps: determining a target modification area from an original face image; carrying out three-dimensional reconstruction on the target modification area to obtain three-dimensional space information corresponding to the target modification area; and coloring the target modification area according to the three-dimensional space information to obtain a modified face image. According to the invention, the target modification area is colored according to the three-dimensional spatial information, so that the texture sense is stronger, the details of the target modification area can be effectively restored, the texture is finer, the stereoscopic impression can be effectively enhanced by polishing the target modification area in the normal direction, and the user experience is further remarkably improved.

Description

基于三维重建的人脸修饰方法、装置、设备及存储介质Face modification method, device, equipment and storage medium based on 3D reconstruction

技术领域technical field

本发明涉及图像处理领域,具体而言,涉及基于三维重建的人脸修饰方法、装置、设备及存储介质。The present invention relates to the field of image processing, in particular, to a face modification method, device, equipment and storage medium based on three-dimensional reconstruction.

背景技术Background technique

随着科学技术的发展和技术产业化应用水平的提升,手机的性能越来越好、硬件配置已经越来越完备。但同时,随着手机市场竞争越来越激烈,拼硬件配置已经不能吸引到更多的电子消费者,所以,大部分的手机厂商都在追求手机产品的差异化功能规划、设计、营销等。例如,对于人脸修饰中的口红修饰这个应用场景来说���目前现有的口红修饰是通过对原始图像进行人脸识别;当原始图像包含人脸区域时,从人脸区域中定位嘴唇区域,并根据嘴唇区域,获取平均唇色数据;根据平均唇色数据和原始图像的色温数据,对���唇区域的像素点进行处理。由于是基于二维嘴唇区域进行处理,故现有技术存在处理结果依赖平均唇色数据、处理结果不细腻、纹理感不强、没有真实立体感、用户体验较差技术问题。With the development of science and technology and the improvement of the application level of technology industrialization, the performance of mobile phones is getting better and better, and the hardware configuration has become more and more complete. But at the same time, with the increasingly fierce competition in the mobile phone market, competing hardware configurations can no longer attract more electronic consumers. Therefore, most mobile phone manufacturers are pursuing differentiated functional planning, design, and marketing of mobile phone products. For example, for the application scenario of lipstick modification in face modification, the current existing lipstick modification is through face recognition on the original image; when the original image contains a face area, locate the lip area from the face area, And according to the lip area, the average lip color data is obtained; according to the average lip color data and the color temperature data of the original image, the pixel points of the lip area are processed. Because the processing is based on the two-dimensional lip area, there are technical problems in the prior art that the processing results depend on the average lip color data, the processing results are not delicate, the texture is not strong, there is no real three-dimensional effect, and the user experience is poor.

发明内容Contents of the invention

本发明实施例提供的基于三维重建的人脸修饰方法、装置、设备及存储介质,可以解决现有技术中存在的处理结果不具备立体光泽、依赖平均唇色数据、处理结果不细腻、纹理感不强、没有真实立体感、用户体验较差的技术问题。The face modification method, device, equipment and storage medium based on three-dimensional reconstruction provided by the embodiments of the present invention can solve the problems in the prior art that the processing result does not have three-dimensional gloss, relies on the average lip color data, the processing result is not delicate, and the texture feels Not strong, no real three-dimensional sense, poor user experience technical problems.

为了实现上述目的,本发明实施例采用的技术方案如下:In order to achieve the above object, the technical solution adopted in the embodiment of the present invention is as follows:

第一方面,本发明实施例提供的一种基于三维重建的人脸修饰方法,包括:从原始人脸图像中确定目标修饰区域;对所述目标修饰区域进行三维重建,得到所述目标修饰区域所对应的三维空间信息;根据所述三维空间信息对所述目标修饰区域进行着色处理,得到修饰后的人脸图像。In the first aspect, an embodiment of the present invention provides a face modification method based on three-dimensional reconstruction, including: determining a target modification area from an original face image; performing three-dimensional reconstruction on the target modification area to obtain the target modification area Corresponding three-dimensional space information; performing coloring processing on the target modification area according to the three-dimensional space information to obtain a modified human face image.

结合第一方面,本发明实施例提供了第一方面的第一种可能的实施方式,所述的从原始人脸图像中确定目标修饰区域,包括:根据预设人脸关键点检测模型从原始人脸图像中确定人脸关键点信息;根据所述人脸关键点信息从所述原始人脸图像中分离出待修饰区域,所述待修饰区域为所述目标修饰区域。In combination with the first aspect, the embodiment of the present invention provides a first possible implementation of the first aspect, the determining the target modification area from the original face image includes: according to the preset face key point detection model from the original Determining face key point information in the face image; separating a region to be modified from the original face image according to the face key point information, and the region to be modified is the target modification region.

结合第一方面的第一种可能的实施方式,本发明实施例提供了第一方面的第二种可能的实施方式,所述的对所述目标修饰区域进行三维重建,得到所述目标修饰区域所对应的三维空间信息,包括:将所述目标修饰区域以及所述人脸关键点信息输入预设三维基础模型,输出所述目标修饰区域所对应的三维空间信息。In combination with the first possible implementation manner of the first aspect, the embodiment of the present invention provides a second possible implementation manner of the first aspect, performing three-dimensional reconstruction on the target modification area to obtain the target modification area The corresponding three-dimensional space information includes: inputting the target modification area and the face key point information into a preset three-dimensional basic model, and outputting the three-dimensional space information corresponding to the target modification area.

结合第一方面的第二种可能的实施方式,本发明实施例提供了第一方面的第三种可能的实施方式,所述的将所述目标修饰区域以及所述人脸关键点信息输入预设三维基础模型,输出所述目标修饰区域所对应的三维空间信息,包括:获取所述人脸关键点信息和所述目标修饰区域对应的基础参数以及所述基础参数所对应的权重系数;根据所述基础参数确定与所述基础参数匹配的预设三维基础模型;通过所述权重系数对所述预设三维基础模型进行加权处理,得到所述目标修饰区域对应的三维空间信息。With reference to the second possible implementation manner of the first aspect, the embodiment of the present invention provides a third possible implementation manner of the first aspect, the inputting the target modification area and the facial key point information into the preset A three-dimensional basic model is set, and the three-dimensional space information corresponding to the target modification area is output, including: obtaining the basic parameters corresponding to the face key point information and the target modification area, and the weight coefficients corresponding to the basic parameters; The basic parameters determine a preset three-dimensional basic model matching the basic parameters; the preset three-dimensional basic model is weighted by the weight coefficient to obtain three-dimensional space information corresponding to the target modification area.

结合第一方面的第一种可能的实施方式,本发明实施例提供了第一方面的第四种可能的实施方式,还包括:获取标注有人脸关键点的图像样本数据;通过所述图像样本数据对初始人脸关键点检测模型进行神经网络训练,得到预设人脸关键点检测模型。With reference to the first possible implementation of the first aspect, the embodiment of the present invention provides a fourth possible implementation of the first aspect, which further includes: acquiring image sample data marked with key points of human faces; The data is used to perform neural network training on the initial face key point detection model, and a preset face key point detection model is obtained.

结合第一方面,本发明实施例提供了第一方面的第五种可能的实施方式,所述的根据所述三维空间信息对所述目标修饰区域进行着色处理,得到修饰后的人脸图像,包括:根据所述三维空间信息对所述目标修饰区域进行着色处理,得到三维纹理着色结果;将所述三维纹理着色结果替换到所述原始人脸图像的所述目标修饰区域上,得到修饰后的人脸图像。In combination with the first aspect, the embodiment of the present invention provides a fifth possible implementation manner of the first aspect, wherein the target modification area is colored according to the three-dimensional space information to obtain a modified face image, It includes: performing coloring processing on the target modification area according to the three-dimensional space information to obtain a three-dimensional texture coloring result; replacing the three-dimensional texture coloring result on the target modification area of the original face image to obtain a modified face images.

结合第一方面的第五种可能的实施方式,本发明实施例提供了第一方面的第六种可能的实施方式,所述的根据所述三维空间信息对所述目标修饰区域进行着色处理,得到三维纹理着色结果,包括:根据所述三维空间信息确定所述目标修饰区域对应的三维剖分网格;将纹理对应坐标的颜色迁移到所述三维剖分网格所对应的坐标位置,得到三维纹理着色结果。With reference to the fifth possible implementation manner of the first aspect, the embodiment of the present invention provides a sixth possible implementation manner of the first aspect, performing coloring processing on the target modification area according to the three-dimensional space information, Obtaining the 3D texture coloring result includes: determining the 3D subdivision grid corresponding to the target modification area according to the 3D space information; migrating the color corresponding to the coordinates of the texture to the coordinate position corresponding to the 3D subdivision grid to obtain 3D texture shader result.

结合第一方面的第六种可能的实施方式,本发明实施例提供了第一方面的第七种可能的实施方式,所述的根据所述三维空间信息确定所述目标修饰区域对应的三维剖分网格,包括:对所述三维空间信息进行三角剖分,得到所述目标修饰区域对应的三维剖分网格。With reference to the sixth possible implementation manner of the first aspect, the embodiment of the present invention provides a seventh possible implementation manner of the first aspect, wherein the determination of the 3D profile corresponding to the target modification area according to the 3D space information Subdividing the grid includes: performing triangulation on the three-dimensional space information to obtain a three-dimensional subdivision grid corresponding to the target modification area.

结合第一方面的第七种可能的实施方式,本发明实施例提供了第一方面的第八种可能的实施方式,所述的对所述三维空间信息进行三角剖分,得到所述目标修饰区域对应的三维剖分网格,包括:对所述三维空间信息进行最邻近的无交叉三角剖分,得到所述目标修饰区域对应的三维剖分网格。With reference to the seventh possible implementation manner of the first aspect, the embodiment of the present invention provides an eighth possible implementation manner of the first aspect, wherein the triangulation of the three-dimensional space information is performed to obtain the target modified The 3D subdivision grid corresponding to the region includes: performing the nearest neighbor non-intersection triangulation on the 3D spatial information to obtain the 3D subdivision grid corresponding to the target modification region.

结合第一方面的第五种可能的实施方式,本发明实施例提供了第一方面的第九种可能的实施方式,所述的将所述三维纹理着色结果替换到所述原始人脸图像的所述目标修饰区域上,得到修饰后的人脸图像,包括:对所述目标修饰区域的边缘区域做羽化处理,得到修饰后的人脸图像。With reference to the fifth possible implementation of the first aspect, this embodiment of the present invention provides a ninth possible implementation of the first aspect, the replacement of the 3D texture coloring result with the original face image Obtaining a modified human face image on the target modification area includes: performing feathering processing on an edge area of the target modification area to obtain a modified human face image.

第二方面,本发明实施例提供的一种基于三维重建的人脸修饰装置,包括:修饰目标确定单元,用于从原始人脸图像中确定目标修饰区域;第一处理单元,用于对所述目标修饰区域进行三维重建,得到所述目标修饰区域所对应的三维空间信息;第二处理单元,用于根据所述三维空间信息对所述目标修饰区域进行着色处理,得到修饰后的人脸图像。In the second aspect, the embodiment of the present invention provides a face modification device based on three-dimensional reconstruction, including: a modification target determination unit, configured to determine the target modification area from the original face image; a first processing unit, configured to performing three-dimensional reconstruction on the target modification area to obtain three-dimensional space information corresponding to the target modification area; the second processing unit is used to perform coloring processing on the target modification area according to the three-dimensional space information to obtain a modified human face image.

第三方面,本发明实施例提供的一种终端设备,包括:存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如第一方面任一项所述基于三维重建的人脸修饰方法的步骤。In a third aspect, a terminal device provided by an embodiment of the present invention includes: a memory, a processor, and a computer program stored in the memory and operable on the processor, and the processor executes the computer program When realizing the steps of the face modification method based on three-dimensional reconstruction as described in any one of the first aspect.

第四方面,本发明实施例提供的一种存储介质,所述存储介质上存储有指令,当所述指令在计算机上运行时,使得所述计算机执行如第一方面任一项所述的基于三维重建的人脸修饰方法。In a fourth aspect, an embodiment of the present invention provides a storage medium, where instructions are stored on the storage medium, and when the instructions are run on a computer, the computer is made to execute the method based on any one of the first aspect. Face Retouching Method for 3D Reconstruction.

与现有技术相比,本发明实施例带来了以下有益效果:Compared with the prior art, the embodiments of the present invention bring the following beneficial effects:

本发明实施例提供的基于三维重建的人脸修饰方法、装置、设备及存储介质,通过从原始人脸图像中确定目标修饰区域,对所述目标修饰区域进行三维重建,得到所述目标修饰区域所对应的三维空间信息,从而可以有效还原目标修饰区域的细节以及增强目标修饰区域的立体感,以及根据所述三维空间信息对所述目标修饰区域进行着色处理,可以使得目标修饰区域的纹理感更强以及纹理更细腻,进一步增强目标修饰区域的立体感,进而显著地提升用户体验。In the face modification method, device, device and storage medium based on three-dimensional reconstruction provided by the embodiments of the present invention, the target modification area is determined from the original face image, and the target modification area is three-dimensionally reconstructed to obtain the target modification area The corresponding three-dimensional space information can effectively restore the details of the target modification area and enhance the three-dimensional effect of the target modification area, and color the target modification area according to the three-dimensional space information, which can make the texture of the target modification area Stronger and finer textures further enhance the three-dimensionality of the target retouching area, thereby significantly improving the user experience.

本公开的其他特征和优点将在随后的说明书中阐述,或者,部分特征和优点可以从说明书推知或毫无疑义地确定,或者通过实施本公开的上述技术即可得知。Other features and advantages of the present disclosure will be set forth in the following description, or some of the features and advantages can be inferred or unambiguously determined from the description, or can be known by implementing the above-mentioned techniques of the present disclosure.

为使本发明的上述目的、特征和优点能更明显易懂,下文特举较佳实施例,并配合所附附图,作详细说明如下。In order to make the above-mentioned objects, features and advantages of the present invention more comprehensible, preferred embodiments will be described in detail below together with the accompanying drawings.

附图说明Description of drawings

为了更清楚地说明本发明实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,应当理解,以下附图仅示出了本发明的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。In order to illustrate the technical solutions of the embodiments of the present invention more clearly, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention, and thus It should be regarded as a limitation on the scope, and those skilled in the art can also obtain other related drawings based on these drawings without creative work.

图1为本发明第一实施例提供的基于三维重建的人脸修饰方法的流程图;Fig. 1 is the flow chart of the face modification method based on 3D reconstruction provided by the first embodiment of the present invention;

图2为图1所示的基于三维重建的人脸修饰方法中的原始人脸图像;Fig. 2 is the original face image in the face modification method based on three-dimensional reconstruction shown in Fig. 1;

图3为图1所示的基于三维重建的人脸修饰方法中的人脸检测结果示意图;Fig. 3 is the face detection result schematic diagram in the face modification method based on three-dimensional reconstruction shown in Fig. 1;

图4为图1所示的基于三维重建的人脸修饰方法中的三角剖分原理示意图;FIG. 4 is a schematic diagram of the principle of triangulation in the face modification method based on three-dimensional reconstruction shown in FIG. 1;

图5为图1所示的基于三维重建的人脸修饰方法中的嘴唇区域图像;Fig. 5 is the lip region image in the face modification method based on three-dimensional reconstruction shown in Fig. 1;

图6为图1所示的基于三维重建的人脸修饰方法中的嘴唇区域三角剖分结果示意图;Fig. 6 is a schematic diagram of the lip area triangulation results in the face modification method based on three-dimensional reconstruction shown in Fig. 1;

图7为本发明第二实施例提供的基于三维重建的人脸修饰装置的功能模块示意图;Fig. 7 is a schematic diagram of functional modules of a face modification device based on 3D reconstruction provided by the second embodiment of the present invention;

图8为本发明第三实施例提供的一种终端设备的示意图。Fig. 8 is a schematic diagram of a terminal device provided by a third embodiment of the present invention.

具体实施方式Detailed ways

为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。因此,以下对在附图中提供的本发明的实施例的详细描述并非旨在限制要求保护的本发明的范围,而是仅仅表示本发明的选定实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments It is a part of embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention. Accordingly, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.

下面结合附图,对本发明的一些实施方式作详细说明。在不冲突的情况下,下述的实施例及实施例中的特征可以相互组合。Some embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings. In the case of no conflict, the following embodiments and features in the embodiments can be combined with each other.

第一实施例first embodiment

由于现有的人脸修饰方法存在依赖平均唇色数据、处理结果不细腻、纹理感不强、没有真实立体感、用户体验较差技术问题,为了解决上述技术问题,本实施例首先提供了一种基于三维重建的人脸修饰方法,需要说明的是,在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行,并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。以下对本实施例进行详细介绍。Due to the existing technical problems of relying on the average lip color data, the processing results are not delicate, the texture is not strong, there is no real three-dimensional effect, and the user experience is poor, in order to solve the above technical problems, this embodiment firstly provides a A face modification method based on three-dimensional reconstruction, it should be noted that the steps shown in the flow chart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and, although shown in the flow chart logical order, but in some cases the steps shown or described may be performed in an order different from that presented here. This embodiment will be described in detail below.

请参阅图1,是本发明实施例提供的基于三维重建的人脸修饰方法的流程图。下面将对图1所示的具体流程进行详细阐述。Please refer to FIG. 1 , which is a flowchart of a face modification method based on 3D reconstruction provided by an embodiment of the present invention. The specific process shown in FIG. 1 will be described in detail below.

步骤S101,从原始人脸图像中确定目标修饰区域。Step S101, determining the target retouching area from the original face image.

可选地,原始人脸图像可以是用户存储在终端设备(如手机或平板)中的人脸图像。还可以是通过图像采集装置(如摄像头)开启预览视频流,所获取到的预览数据帧。或者是用户通过网络所下载的人脸图像。Optionally, the original face image may be a face image stored by the user in a terminal device (such as a mobile phone or a tablet). It may also be the preview data frame obtained by starting the preview video stream through an image acquisition device (such as a camera). Or it is a face image downloaded by the user through the network.

其中,目标修饰区域为原始人脸图像中的某一个或多个区域,例如,目标修饰区域可以是但不限于嘴唇区域、颧骨区域、眉毛区域或眼睑区域等。Wherein, the target modification area is one or more areas in the original face image, for example, the target modification area may be but not limited to lip area, cheekbone area, eyebrow area or eyelid area and so on.

作为一种实施方式,步骤S101包括:对原始人脸图像进行人脸检测,得到人脸关键点信息;采集用户的请求指令并根据请求指令从人脸关键点信息中提取目标修饰区域。As an implementation, step S101 includes: performing face detection on the original face image to obtain face key point information; collecting user's request instruction and extracting the target modification area from the face key point information according to the request instruction.

其中,请求指令可以是请求得到嘴唇区域,或者是眼睛区域或者是眉毛区域等。Wherein, the request instruction may be a request for a lip area, or an eye area or an eyebrow area, and the like.

可选地,可以通过终端设备的点击事件来监��用户的请求指令或者是获取用户通过终端设备���入的请求指令。Optionally, the user's request instruction can be monitored through a click event of the terminal device or the request instruction input by the user through the terminal device can be obtained.

举例来说,通过人脸识别方法(例如,基于人脸特征点的识别算法或利用神经网络进行识别的算法)对如图2所示的原始人脸图像进行人脸识别,得到如图3所示的人脸图像中的点集(即人脸关键点信息)。根据用户的请求指令从点集中确定目标修饰区域,例如嘴唇区域。For example, face recognition is performed on the original face image as shown in Figure 2 by a face recognition method (for example, a recognition algorithm based on facial feature points or an algorithm for identifying using a neural network), and the result shown in Figure 3 is obtained. The point set in the displayed face image (that is, the key point information of the face). Determine the target modification area, such as the lip area, from the point set according to the user's request instruction.

作为另一种实施方式,步骤S101包括:根据预设人脸关键点检测模型从原始人脸图像中确定人脸关键点信息;根据所述人脸关键点信息从所述原始人脸图像中分离出待修饰区域,所述待修饰区域为所述目标修饰区域。As another implementation, step S101 includes: determining face key point information from the original face image according to a preset face key point detection model; separating face key point information from the original face image according to the face key point information The area to be modified is selected, and the area to be modified is the target modification area.

可选地,可以通过将目标修饰区域从原始人脸图像中分离出来(如复制该目标修饰区域),以单独对所述目标修饰区域进行图像处理,使得所处理的图像数据较小,进而可以有效降低数据处理压力,提高数据处理效率。Optionally, by separating the target modification area from the original face image (such as copying the target modification area), image processing is performed on the target modification area separately, so that the processed image data is smaller, and then can be Effectively reduce data processing pressure and improve data processing efficiency.

可选地,可以直接对目标修饰区域进行处理,即在原始人脸图像上直接完成对目标修饰区域的修饰。Optionally, the target modification area can be processed directly, that is, the modification of the target modification area is directly completed on the original face image.

可选地,还包括:获取标注有人脸关键点的图像样本数据;通过所述图像样本数据对初始人脸关键点检测模型进行神经网络训练,得到预设人脸关键点检测模型。Optionally, it also includes: acquiring image sample data marked with key points of human face; performing neural network training on the initial key point detection model of human face through the sample image data to obtain a preset key point detection model of human face.

其中,人脸关键点信息可以是但不限于脸的轮廓点、眼睛轮廓点、鼻子轮廓点、眉毛轮廓点、额头轮廓点、上嘴唇轮廓点、下嘴唇轮廓点等。Among them, the face key point information may be but not limited to face contour points, eye contour points, nose contour points, eyebrow contour points, forehead contour points, upper lip contour points, lower lip contour points, etc.

可选地,可以通过获取预先已经标注好有人脸关键点的图像作为图像样本数据,也可以是通过采集预设数量的人脸图像(例如,预设数量可以是10万张),再对每张所述人脸图像进��人脸关键点标注,得到标注数据,包含标注数据的图像作为图像样本数据。Optionally, it is possible to obtain images that have been marked with key points of human faces in advance as image sample data, or by collecting a preset number of human face images (for example, the preset number can be 100,000), and then for each Annotate key points of the face on the face image to obtain annotation data, and an image containing the annotation data is used as image sample data.

可选地,通过所述图像样本数据对初始人脸关键点检测模型进行神经网络训练,得到预设人脸关键点检测模型,包括:将所述图像样本数据按预设比例划分为训练集、验证集和测试集;通过所述训练集对初始人脸关键点检测模型进行神经网络训练,并用所述验证集对训练过程中的中间结果进行验证(实时调整训练参数);当训练精度和验证精度均达到预设阈值时,停止训练过程,得到训练后的人脸关键点检测模型;根据所述测试集对所述训练后的人脸关键点检测模型进行测试,得到测试结果;若所述测试结果满足预设规则(例如,性能或能力),将所述训练后的人脸关键点检测模型作为预设人脸关键点检测模型。Optionally, performing neural network training on the initial facial key point detection model through the image sample data to obtain a preset human face key point detection model, including: dividing the image sample data into a training set according to a preset ratio, Verification set and test set; Carry out neural network training to initial face key point detection model by described training set, and verify (real-time adjustment training parameter) to intermediate result in training process with described verification set; When training accuracy and verification When the accuracy reaches the preset threshold, the training process is stopped to obtain the trained facial key point detection model; the trained human face key point detection model is tested according to the test set to obtain the test result; if the The test result satisfies the preset rule (for example, performance or ability), and the trained facial key point detection model is used as the preset human face key point detection model.

其中,预设比例可以根据实际需求进行设置。一般地,训练集所占比例大于验证集和测试集所占比例。例如,训练集、验证集和测试集的比例可以是8:1:1。Wherein, the preset ratio can be set according to actual needs. Generally, the proportion of the training set is larger than that of the verification set and the test set. For example, the ratio of training set, validation set and test set can be 8:1:1.

其中,训练精度是指通过训练集对人脸关键点检测模型进行训练所得到的误差范围,一般的,预先为训练精度设置有一个预设阈值,预设阈值的大小可以根据实际需求进行设置,在此,不作具体限定。同理,验证精度是指对训练后的人脸关键点检测模型进行验证时所得到的一个数值,并且同样预先为验证精度设置有一个预设阈值,预设阈值的大小可以根据实际需求进行设置,在此,不作具体限定。Among them, the training accuracy refers to the error range obtained by training the facial key point detection model through the training set. Generally, a preset threshold is set for the training accuracy in advance, and the size of the preset threshold can be set according to actual needs. Here, no specific limitation is made. In the same way, the verification accuracy refers to a value obtained when verifying the trained face key point detection model, and a preset threshold is also set for the verification accuracy in advance, and the size of the preset threshold can be set according to actual needs , and is not specifically limited here.

作为一种应用场景,假设目标修饰区域为嘴唇,需要对嘴唇抹口红。则用户先运行本发明实施例提供的基于三维重建的人脸修饰方法的程序,程序加载口红的默认参数映射表(不同唇型有不同的三维重建参数、三维网格剖分参数等,如:花瓣唇、小圆唇、樱桃唇等),其中,用户也可以自己调节相应的参数大小。然后执行本发明实施例提供的基于三维重建的人脸修饰方法以对目标修饰区域进行修饰(即对嘴唇实现抹口红的效果)。As an application scenario, it is assumed that the target modification area is lips, and lipstick needs to be applied to the lips. Then the user first runs the program of the face modification method based on three-dimensional reconstruction provided by the embodiment of the present invention, and the program loads the default parameter mapping table of lipstick (different lip shapes have different three-dimensional reconstruction parameters, three-dimensional meshing parameters, etc., such as: petal lip, small round lip, cherry lip, etc.), among which, the user can also adjust the corresponding parameter size by himself. Then execute the face modification method based on 3D reconstruction provided by the embodiment of the present invention to modify the target modification area (that is, to achieve the effect of applying lipstick to the lips).

步骤S102,对所述目标修饰区域进行三维重建,得到所述目标修饰区域所对应的三维空间信息。Step S102, performing three-dimensional reconstruction on the target modification area to obtain three-dimensional space information corresponding to the target modification area.

三维空间信息包括目标修饰区域所对应的目标点集以及该目标点集在三维空间系下的三维坐标及其欧拉角。The three-dimensional space information includes the target point set corresponding to the target modification area, and the three-dimensional coordinates and Euler angles of the target point set in the three-dimensional space system.

作为一种实施方式,步骤S102包括:将所述目标修饰区域以及所述人脸关键点信息输入预设三维基础模型,输出所述目标修饰区域所对应的三维空间信息。As an implementation manner, step S102 includes: inputting the target modification area and the face key point information into a preset three-dimensional basic model, and outputting three-dimensional space information corresponding to the target modification area.

可选地,所述的将所述目标修饰区域以及所述人脸关键点信息输入预设三维基础模型,输出所述目标修饰区域所对应的三维空间信息,包括:获取所述人脸关键点信息和所述目标修饰区域对应的基础参数以及所述基础参数所对应的权重系数;根据所述基础参数确定与所述基础参数匹配的预设三维基础模型;根据所述权重系数对所述预设三维基础模型进行加权处理,得到所述目标修饰区域对应的三维空间信息。Optionally, inputting the target modification area and the face key point information into a preset three-dimensional basic model, and outputting the three-dimensional space information corresponding to the target modification area includes: obtaining the face key points Information and basic parameters corresponding to the target modification area and weight coefficients corresponding to the basic parameters; determining a preset three-dimensional basic model matching the basic parameters according to the basic parameters; The 3D basic model is set to carry out weighting processing to obtain the 3D spatial information corresponding to the target modification area.

其中,所述基础参数是指目标点集中的所有点的坐标,即三维空间坐标点集,三维空间坐标点集包括每个点的三维坐标及其欧拉角。Wherein, the basic parameter refers to the coordinates of all points in the target point set, that is, the three-dimensional space coordinate point set, which includes the three-dimensional coordinates of each point and its Euler angle.

权重系数为每个基础参数的的权重。The weight coefficient is the weight of each basic parameter.

可选地,权重系数可以是实时生成的。Optionally, the weight coefficients may be generated in real time.

可选地,根据所述权重系数对所述预设三维基础模型进行加权处理,包括:将每个预设三维基础模型与其对应的权重系数相乘,得到一乘积,将所有乘积相加。Optionally, performing weighting processing on the preset three-dimensional basic models according to the weight coefficients includes: multiplying each preset three-dimensional basic model with its corresponding weight coefficients to obtain a product, and adding all the products together.

举例来说,假设有3个预设三维基础模型,分别为G1、G2、G3,其分别对应的权重系数为Q1、Q2、Q3,则加权处理得到的结果为G1*Q1+G2*Q2+G3*Q3。For example, assuming that there are 3 preset 3D basic models, namely G1, G2, and G3, and their corresponding weight coefficients are Q1, Q2, and Q3, the result of the weighting process is G1*Q1+G2*Q2+ G3*Q3.

在本实施例中,预先建立了预设数量的预设三维基础模型(如100个),如张嘴、闭嘴、左边嘴角上扬、右边嘴角上扬等预设三维基础模型。In this embodiment, a preset number of preset three-dimensional basic models (such as 100) are established in advance, such as preset three-dimensional basic models such as mouth opening, mouth closing, left corner of the mouth rising, and right corner of the mouth rising.

可选地,获取所述人脸关键点信息和所述目标修饰区域对应的基础参数,包括:根据所述人脸关键点信息检测所述目标修饰区域,得到目标修饰区域对应的形状参数(例如,张嘴时的嘴唇形状)和表情参数(例如,微笑),将形状参数和表情参数进行分解,得到基础参数。Optionally, acquiring the basic parameters corresponding to the face key point information and the target modification area includes: detecting the target modification area according to the human face key point information, and obtaining shape parameters corresponding to the target modification area (such as , lip shape when opening the mouth) and expression parameters (for example, smile), the shape parameters and expression parameters are decomposed to obtain the basic parameters.

其中,形状参数和表情参数均为通过特定区域(如嘴唇或面部区域)的点,通过该点的坐标计算出来的结果,如嘴角区域的坐标相对于预设三维模型(例如,无表情基础模型)的嘴角,如果其纵向方向都减小,那么,可以抽像为微笑。又例如,若上下嘴唇的间距相对于无表情基础模型,如果上下嘴唇的间距变大,那么,可以抽像为张嘴。Among them, the shape parameters and expression parameters are the results calculated through the coordinates of a point in a specific area (such as lips or face area), such as the coordinates of the corners of the mouth relative to the preset 3D model (for example, the expressionless basic model ) of the mouth, if its longitudinal direction is reduced, then it can be abstracted as a smile. For another example, if the distance between the upper and lower lips is larger than that of the expressionless basic model, then it can be abstracted as an open mouth.

可选地,将形状参数和表情参数进行分解,得到基础参数,包括:按照形状参数和表情参数所对应的关键点进行分解,得到基础参数。Optionally, decomposing the shape parameters and the expression parameters to obtain the basic parameters includes: decomposing according to the key points corresponding to the shape parameters and the expression parameters to obtain the basic parameters.

当然,在实际使用中,还可以通过其他方式进行分解,例如,按照坐标将形状参数和表情参数分解为多个基础参数。���者是通过预设区域将形状参数和表情参数分解为多个基础参数。Of course, in actual use, other methods can also be used for decomposing, for example, decomposing shape parameters and expression parameters into multiple basic parameters according to coordinates. Or decompose the shape parameters and expression parameters into multiple basic parameters through the preset area.

步骤S103,根据所述三维空间信息对所述目标修饰区域进行着色处理,得到修饰后的人脸图像。Step S103, performing coloring processing on the target modification area according to the three-dimensional space information to obtain a modified human face image.

作为一种实施方式,步骤S103包括:根据所述三维空间信息对所述目标修饰区域进行着色处理,得到三维纹理着色结果;将所述三维纹理着色结果替换到所述原始人脸图像的所述目标修饰区域上,得到修饰后的人脸图像。As an implementation, step S103 includes: performing coloring processing on the target modification area according to the three-dimensional space information to obtain a three-dimensional texture coloring result; replacing the three-dimensional texture coloring result with the original face image On the target modified area, the modified face image is obtained.

可选地,根据所述三维空间信息对所述目标修饰区域进行着色处理,得到三维纹理着色结果,包括:根据所述三维空间信息确定所述目标修饰区域对应的三维剖分网格;对所述三维剖分网格进行纹理着色处理,得到三维纹理着色结果。Optionally, performing coloring processing on the target modification area according to the three-dimensional space information to obtain a three-dimensional texture coloring result, including: determining a three-dimensional subdivision grid corresponding to the target modification area according to the three-dimensional space information; The above three-dimensional subdivision mesh is used for texture coloring processing, and the three-dimensional texture coloring result is obtained.

可选地,对所述三维剖分网格进行纹理着色处理,包括:将纹理对应坐标的颜色迁移到三维剖分网格对应的坐标位置,以实现着色处理。Optionally, performing texture coloring processing on the three-dimensional subdivision grid includes: migrating the color corresponding to the coordinates of the texture to the coordinate position corresponding to the three-dimensional subdivision grid, so as to realize the coloring process.

可选地,根据所述三维空间信息确定所述目标修饰区域对应的三维剖分网格,包括:对所述三维空间信息进行三角剖分,得到所述目标修饰区域对应的三维剖分网格。具体地,获取所述三维空间信息中的目标点集以及所述目标点集所对应的三维信息,根据三维信息以及三角剖分算法(delaunay)对目标点集进行三角剖分,得到所述目标修饰区域对应的三维剖分网格。Optionally, determining the 3D subdivision grid corresponding to the target modification area according to the 3D space information includes: performing triangulation on the 3D space information to obtain the 3D subdivision grid corresponding to the target modification area . Specifically, acquire the target point set in the three-dimensional space information and the three-dimensional information corresponding to the target point set, perform triangulation on the target point set according to the three-dimensional information and a triangulation algorithm (delaunay), and obtain the target The 3D subdivision mesh corresponding to the grooming area.

可选地,对所述三维空间信息进行三角剖分(即根据目标点集的三维信息通过三角剖分算法(delaunay)对该目标点集进行三角剖分),得到所述目标修饰区域对应的三维剖分网格,包括:通过三角剖分算法对所述三维空间信息进行最邻近的无交叉三角剖分,得到所述目标修饰区域对应的三维剖分网格。Optionally, performing triangulation on the three-dimensional space information (that is, performing triangulation on the target point set according to the three-dimensional information of the target point set through a triangulation algorithm (delaunay)), to obtain the corresponding The three-dimensional subdivision grid includes: performing the nearest-neighbor non-intersection triangulation on the three-dimensional space information through a triangulation algorithm to obtain the three-dimensional subdivision grid corresponding to the target modification area.

在本实施例中,通过无交叉三角剖分,可以使得所得到的无交叉三角剖分中的每个三角形之间没有交叉,从而使得在进行着色的时候,不会导致某个三角形对应的坐标被重复着色进而使得着色更加均匀,进而使得着色效果更好。In this embodiment, through the non-intersection triangulation, each triangle in the obtained non-intersection triangulation can have no intersection, so that when coloring, the coordinates corresponding to a certain triangle will not be caused It is repeatedly colored to make the coloring more uniform, which in turn makes the coloring effect better.

当然,在实际使用中,还可以通过其他方式对所述三维空间信息进行最邻近的无交叉三角剖分。例如,可以通过分治法、逐点插入法(Lawson算法)或三角网生成法(BowyerWatson算法)等算法实现对所述三维空间信息进行最邻近的无交叉三角剖分。Of course, in actual use, the nearest neighbor non-intersection triangulation may also be performed on the three-dimensional spatial information in other ways. For example, the nearest-neighbor intersection-free triangulation of the three-dimensional space information can be realized by algorithms such as divide-and-conquer method, point-by-point insertion method (Lawson algorithm), or triangular network generation method (BowyerWatson algorithm).

例如,如图4所示,按照三角剖分原理对目标点集进行三角剖分,以得到多个三角形组成的网格即三维剖分网格。For example, as shown in FIG. 4 , the target point set is triangulated according to the triangulation principle to obtain a grid composed of multiple triangles, that is, a three-dimensional subdivision grid.

例如,以嘴唇区域为目标修饰区域为例来说,对图5所示的嘴唇中的点集进行三角剖分,从而得到目标修饰区域(即嘴唇区域)对应的三维剖分网格,即得到如图6所示的示意图。For example, taking the lip area as the target modification area as an example, the point set in the lip shown in Figure 5 is triangulated, so as to obtain the three-dimensional subdivision mesh corresponding to the target modification area (ie, the lip area), that is, The schematic diagram shown in Figure 6.

可选地,还可以通过对三维空间信息进行矩形剖分(例如,四边形或多边形),得到目标修饰区域对应的三维剖分网格。Optionally, the three-dimensional subdivision grid corresponding to the target modification area may also be obtained by performing rectangular subdivision (for example, quadrilateral or polygon) on the three-dimensional spatial information.

在本实施例中,通过对三维剖分网格进行纹理着色,使得纹理感更强,并且能够有效还原目标修饰区域的细节、以及纹理更细腻,通过对目标修饰区域进行法向打光,可以有效增强立体感。In this embodiment, by performing texture coloring on the 3D subdivided mesh, the sense of texture is stronger, and the details of the target modification area can be effectively restored, and the texture is finer. By performing normal lighting on the target modification area, it can Effectively enhance the three-dimensional sense.

可选地,将所述三维纹理着色结果替换到所述原始人脸图像的所述目标修饰区域上,包括:对所述目标修饰区域的边缘区域做羽化处理,得到修饰后的人脸图像。Optionally, replacing the three-dimensional texture coloring result on the target modification area of the original face image includes: performing feathering processing on an edge area of the target modification area to obtain a modified face image.

在本实施例中,通过独立的对从原始人脸图像中分离出来的目标修饰区域进行修饰后,将修饰后的三维纹理着色结果贴图(或替换)到原始人脸图像中的目标修饰区域上。In this embodiment, after independently modifying the target modification area separated from the original human face image, the modified three-dimensional texture coloring result is mapped (or replaced) on the target modification area in the original human face image .

在一可能的实施例中,在对所述目标修饰区域的边缘区域做羽化处理,得到修饰后的人脸图像之后,还包括:将所述人脸图像显示在终端设备上。In a possible embodiment, after performing feathering processing on the edge area of the target modification area to obtain the modified face image, the method further includes: displaying the face image on a terminal device.

举例来说,假设目标修饰区域为嘴唇,即先将嘴唇区域从原始人脸图像中分离出来,再对嘴唇区域进行着色,得到三维纹理着色结果,将三维纹理着色结果贴图在原始人脸图像的嘴唇区域上,以实现对人脸图像的修饰。所以,一方面通过���离出目标修饰区域,对目标修饰区域进行修饰,可以有效降低数据处理的压力,提高数据处理效率,另一方面通过将修饰后的图直接进行贴图,以贴合在原始人脸图像所对应的区域,进而完成对人脸的修饰,使得修饰效果更好。For example, assuming that the target modification area is lips, the lip area is first separated from the original face image, and then the lip area is colored to obtain a three-dimensional texture coloring result, and the three-dimensional texture coloring result is mapped on the original face image on the lip area to realize the modification of the face image. Therefore, on the one hand, by separating out the target modification area and modifying the target modification area, the pressure of data processing can be effectively reduced and the efficiency of data processing can be improved; The area corresponding to the face image, and then complete the modification of the face, making the modification effect better.

本发明实施例所提供的基于三维重建的人脸修饰方法,通过从原始人脸图像中确定目标修饰区域,对所述目标修饰区域进行三维重建,得到所述目标修饰区域所对应的三维空间信息,从而可以有效还原目标修饰区域的细节以及增强目标修饰区域的立体感,以及根据所述三维空间信息对所述目标修饰区域进行着色,可以使得目标修饰区域的纹理感更强以及纹理更细腻,进一步增强目标修饰区域的立体感,进而显著地提升用户体验。The face modification method based on 3D reconstruction provided by the embodiment of the present invention determines the target modification area from the original face image, performs 3D reconstruction on the target modification area, and obtains the 3D spatial information corresponding to the target modification area , so that the details of the target modification area can be effectively restored and the three-dimensional effect of the target modification area can be enhanced, and the target modification area can be colored according to the three-dimensional space information, which can make the texture of the target modification area stronger and more delicate. The three-dimensional effect of the target modification area is further enhanced, thereby significantly improving user experience.

第二实施例second embodiment

对应于第一实施例中的基于三维重建的人脸修饰方法,图7示出了采用第一实施例所示的基于三维重建的人脸修饰方法一一对应的基于三维重建的人脸修饰装置。如图7所示,所述基于三维重建的人脸修饰装置400包括修饰目标确定单元410、第一处理单元420、第二处理单元430和第三处理单元440。其中,修饰目标确定单元410、第一处理单元420、第二处理单元430和第三处理单元440的实现功能与第一实施例中对应的步聚一一对应,为避免赘述,本实施例不一一详述。Corresponding to the face modification method based on 3D reconstruction in the first embodiment, Fig. 7 shows the face modification device based on 3D reconstruction using the face modification method based on 3D reconstruction shown in the first embodiment in one-to-one correspondence . As shown in FIG. 7 , the three-dimensional reconstruction-based face modification device 400 includes a modification target determination unit 410 , a first processing unit 420 , a second processing unit 430 and a third processing unit 440 . Wherein, the realization functions of the modification target determination unit 410, the first processing unit 420, the second processing unit 430, and the third processing unit 440 are in one-to-one correspondence with the corresponding steps in the first embodiment. To avoid redundant description, this embodiment does not Describe in detail.

修饰目标确定单元410,用于从原始人脸图像中确定目标修饰区域。A modification target determining unit 410, configured to determine a target modification area from the original face image.

可选地,所述原始人脸图像为预览图像。Optionally, the original face image is a preview image.

可选地,修饰目标确定单元410,用于根据预设人脸关键点检测模型从原始人脸图像中确定人脸关键点信息;根据所述人脸关键点信息从所述原始人脸图像中分离出待修饰区域,所述待修饰区域为所述目标修饰区域。Optionally, the modified target determination unit 410 is configured to determine face key point information from the original face image according to a preset face key point detection model; The region to be modified is isolated, and the region to be modified is the target modification region.

可选地,还包括获取标注有人脸关键点的图像样本数据;以及通过所述图像样本数据对初始人脸关键点检测模型进行神经网络训练,得到预设人脸关键点检测模型。Optionally, it also includes acquiring image sample data labeled with key points of human face; and performing neural network training on the initial key point detection model of human face through the sample image data to obtain a preset key point detection model of human face.

第一处理单元420,用于对所述目标修饰区域进行三维重建,得到所述目标修饰区域所对应的三维空间信息。The first processing unit 420 is configured to perform three-dimensional reconstruction on the target modification area to obtain three-dimensional space information corresponding to the target modification area.

可选地,第一处理单元420,还用于将所述目标修饰区域以及所述人脸关键点信息输入预设三维基础模型,输出所述目标修饰区域所对应的三维空间信息。Optionally, the first processing unit 420 is further configured to input the target modification area and the face key point information into a preset 3D basic model, and output the 3D space information corresponding to the target modification area.

可选地,所述的将所述目标修饰区域以及所述人脸关键点信息输入预设三维基础模型,输出所述目标修饰区域所对应的三维空间信息,包括:获取所述人脸关键点信息和所述目标修饰区域对应的基础参数以及所述基础参数所对应的权重系数;根据所述基础参数确定与所述基础参数匹配的预设三维基础模型;通过所述权重系数对所述预设三维基础模型进行加权处理,得到所述目标修饰区域对应的三维空间信息。Optionally, inputting the target modification area and the face key point information into a preset three-dimensional basic model, and outputting the three-dimensional space information corresponding to the target modification area includes: obtaining the face key points Information and basic parameters corresponding to the target modification area and weight coefficients corresponding to the basic parameters; determine a preset three-dimensional basic model matching the basic parameters according to the basic parameters; The 3D basic model is set to carry out weighting processing to obtain the 3D spatial information corresponding to the target modification area.

第二处理单元430,用于根据所述三维空间信息对所述目标修饰区域进行着色处理,得到修饰后的人脸图像。The second processing unit 430 is configured to perform coloring processing on the target modification area according to the three-dimensional space information to obtain a modified human face image.

可选地,第二处理单元430,还用于根据所述三维空间信息对所述目标修饰区域进行着色处理,得到三维纹理着色结果;将所述三维纹理着色结果替换到所述原始人脸图像的所述目标修饰区域上,得到修饰后的人脸图像。Optionally, the second processing unit 430 is further configured to perform coloring processing on the target modification area according to the three-dimensional space information to obtain a three-dimensional texture coloring result; replace the three-dimensional texture coloring result into the original face image On the target modification area, the modified face image is obtained.

可选地,据所述三维空间信息对所述目标修饰区域进行着色处理,得到三维纹理着色结果,包括:根据所述三维空间信息确定所述目标修饰区域对应的三维剖分网格;对所述三维剖分网格进行纹理着色处理,得到三维纹理着色结果。Optionally, performing coloring processing on the target modification area according to the three-dimensional space information to obtain a three-dimensional texture coloring result, including: determining a three-dimensional subdivision grid corresponding to the target modification area according to the three-dimensional space information; The above three-dimensional subdivision mesh is used for texture coloring processing, and the three-dimensional texture coloring result is obtained.

可选地,所述的根据所述三维空间信息确定所述目标修饰区域对应的三维剖分网格,包括:对所述三维空间信息进行三角剖分,得到所述目标修饰区域对应的三维剖分网格。Optionally, the determining the 3D subsection grid corresponding to the target modification area according to the 3D space information includes: performing triangulation on the 3D space information to obtain the 3D subsection grid corresponding to the target modification area. sub-grid.

可选地,所述的对所述三维空间信息进行三角剖分,得到所述目标修饰区域对应的三维剖分网格,包括:对所述三维空间信息进行最邻近的无交叉三角剖分,得到所述目标修饰区域对应的三维剖分网格。Optionally, performing triangulation on the three-dimensional space information to obtain the three-dimensional subdivision grid corresponding to the target modification area includes: performing nearest-neighbor intersection-free triangulation on the three-dimensional space information, A three-dimensional subdivision grid corresponding to the target modification area is obtained.

可选地,将所述三维纹理着色结果替换到所述原始人脸图像的所述目标修饰区域上,包括:对所述目标修饰区域的边缘区域做羽化处理,得到修饰后的人脸图像。Optionally, replacing the three-dimensional texture coloring result on the target modification area of the original face image includes: performing feathering processing on an edge area of the target modification area to obtain a modified face image.

可选地,在第二处理单元430之后,所述基于三维重建的人脸修饰装置400还包括第四处理单元,用于将所述修饰后的人脸图像在显示终端进行显示。Optionally, after the second processing unit 430, the three-dimensional reconstruction-based face modification apparatus 400 further includes a fourth processing unit, configured to display the modified face image on a display terminal.

第三实施例third embodiment

如图8所示,是终端设备300的示意图。所述终端设备300包括存储器302、处理器304、存储在所述存储器302中并可在所述处理器304上运行的计算机程序303以及用于显示修饰后的人脸图像的显示器305,所述计算机程序303被处理器304执行时实现第一实施例中的所述基于三维重建的人脸修饰方法,为避免重复,此处不再赘述。或者,所述计算机程序303被处理器304执行时实现第二实施例所述基于三维重建的人脸修饰装置中各模型/单元的功能,为避免重复,此处不再赘述。As shown in FIG. 8 , it is a schematic diagram of a terminal device 300 . The terminal device 300 includes a memory 302, a processor 304, a computer program 303 stored in the memory 302 and operable on the processor 304, and a display 305 for displaying a modified face image, the When the computer program 303 is executed by the processor 304, the method for modifying a face based on 3D reconstruction in the first embodiment is realized, and to avoid repetition, details are not repeated here. Alternatively, when the computer program 303 is executed by the processor 304, the functions of each model/unit in the three-dimensional reconstruction-based face modification device described in the second embodiment are realized, and details are not repeated here to avoid repetition.

示例性的,计算机程序303可以被分割成一个或多个模块/单元,一个或者多个模块/单元被存储在存储器302中,并由处理器304执行,以完成本发明。一个或多个模块/单元可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述计算机程序303在终端设备300中的执行过程。例如,计算机程序303可以被分割成第二实施例中的修饰目标确定单元410、第一处理单元420和第二处理单元430,各单元的具体功能如第一实施例或第二实施例所述,在此不一一赘述。Exemplarily, the computer program 303 can be divided into one or more modules/units, and one or more modules/units are stored in the memory 302 and executed by the processor 304 to implement the present invention. One or more modules/units may be a series of computer program instruction segments capable of accomplishing specific functions, and the instruction segments are used to describe the execution process of the computer program 303 in the terminal device 300 . For example, the computer program 303 can be divided into the modification target determining unit 410, the first processing unit 420 and the second processing unit 430 in the second embodiment, and the specific functions of each unit are as described in the first embodiment or the second embodiment , which will not be repeated here.

终端设备300可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。The terminal device 300 may be computing devices such as desktop computers, notebooks, palmtop computers, and cloud servers.

其中,存储器302可以是,但不限于,随机存取存储器(Random Access Memory,RAM),只读存储器(Read Only Memory,ROM),可编程只读存储器(Programmable Read-Only Memory,PROM),可擦除只读存储器(Erasable Programmable Read-Only Memory,EPROM),电可擦除只读存储器(Electric Erasable Programmable Read-Only Memory,EEPROM)等。其中,存储器302用于存储程序,所述处理器304在接收到执行指令后,执行所述程序,前述本发明实施例任一实施例揭示的流程定义的方法可以应用于处理器304中,或者由处理器304实现。Wherein, the memory 302 can be, but not limited to, random access memory (Random Access Memory, RAM), read only memory (Read Only Memory, ROM), programmable read only memory (Programmable Read-Only Memory, PROM), can Erasable Programmable Read-Only Memory (EPROM), Electric Erasable Programmable Read-Only Memory (EEPROM), etc. Wherein, the memory 302 is used to store a program, and the processor 304 executes the program after receiving an execution instruction, and the process definition method disclosed in any embodiment of the foregoing embodiments of the present invention can be applied to the processor 304, or implemented by processor 304 .

处理器304可能是一种集成电路芯片,具有信号的处理能力。上述的处理器304可以是通用处理器,包括中央处理器(Central Processing Unit,CPU)、网络处理器(NetworkProcessor,NP)等;还可以是数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本发明实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。The processor 304 may be an integrated circuit chip with signal processing capabilities. The above-mentioned processor 304 can be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (NetworkProcessor, NP), etc.; it can also be a digital signal processor (Digital Signal Processor, DSP), a dedicated integrated Circuit (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. Various methods, steps and logic block diagrams disclosed in the embodiments of the present invention may be implemented or executed. A general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.

显示器305可以是LCD显示屏,也可以是LED显示屏。例如,手机上的显示屏。The display 305 can be an LCD display or an LED display. For example, the display screen on a mobile phone.

可以理解的是,图8所示的结构仅为终端设备300的一种结构示意图,终端设备300还可以包括比图8所示更多或更少的组件。图8中所示的各组件可以采用硬件、软件或其组合实现。It can be understood that the structure shown in FIG. 8 is only a schematic structural diagram of the terminal device 300, and the terminal device 300 may also include more or fewer components than those shown in FIG. 8 . Each component shown in FIG. 8 may be implemented by hardware, software or a combination thereof.

第四实施例Fourth embodiment

本发明实施例还提供一种存储介质,所述存储介质上存储有指令,当所述指令在计算机上运行时,所述计算机程序被处理器执行时实现第一实施例中的所述基于三维重建的人脸修饰方法,为避免重复,此处不再赘述。或者,所述计算机程序被处理器执行时实现第二实施例所述基于三维重建的人脸修饰装置中各模型/单元的功能,为避免重复,此处不再赘述。An embodiment of the present invention also provides a storage medium, on which instructions are stored. When the instructions are run on a computer, the computer program is executed by a processor to implement the three-dimensional based on the first embodiment. In order to avoid repetition, the reconstructed face modification method will not be repeated here. Alternatively, when the computer program is executed by the processor, the functions of each model/unit in the 3D reconstruction-based face modification device of the second embodiment are implemented, and to avoid repetition, details are not repeated here.

通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到本发明可以通过硬件实现,也可以借助软件加必要的通用硬件平台的方式来实现,基于这样的理解,本发明的技术方案可以以软件产品的形式体现出来,该软件产品可以存储在一个非易失性存储介质(可以是CD-ROM,U盘,移动硬盘等)中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施场景的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the present invention can be implemented by hardware, or by means of software plus a necessary general-purpose hardware platform. Based on this understanding, the technical solution of the present invention It can be embodied in the form of software products, which can be stored in a non-volatile storage medium (which can be CD-ROM, U disk, mobile hard disk, etc.), and include several instructions to make a computer device (which can be It is a personal computer, a server, or a network device, etc.) to execute the method of each implementation scenario of the present invention.

以上所述仅为本发明的优选实施例而已,并不用于限制本发明,对于本领域的技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步定义和解释。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and changes. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included within the protection scope of the present invention. It should be noted that like numerals and letters denote similar items in the following figures, therefore, once an item is defined in one figure, it does not require further definition and explanation in subsequent figures.

Claims (10)

1. A face modification method based on three-dimensional reconstruction is characterized by comprising the following steps:
determining a target modification area from an original face image;
performing three-dimensional reconstruction on the target modification region to obtain three-dimensional space information corresponding to the target modification region;
coloring the target modification area according to the three-dimensional space information to obtain a modified human face image;
wherein, the determining the target modification region from the original face image comprises: determining face key point information from an original face image according to a preset face key point detection model; separating a region to be modified from the original face image according to the face key point information, wherein the region to be modified is the target modification region;
the three-dimensional reconstruction of the target modification region to obtain three-dimensional space information corresponding to the target modification region includes: acquiring the human face key point information, basic parameters corresponding to the target modification area and used for representing a three-dimensional space coordinate point set of the target modification area, and weight coefficients corresponding to the basic parameters; determining a preset three-dimensional basic model matched with the basic parameters according to the basic parameters; and carrying out weighting processing on the preset three-dimensional basic model through the weighting coefficient to obtain three-dimensional space information corresponding to the target modification area.
2. The method of claim 1, further comprising:
acquiring image sample data marked with key points of the face;
and carrying out neural network training on the initial face key point detection model through the image sample data to obtain a preset face key point detection model.
3. The method according to claim 1, wherein the coloring the target modified region according to the three-dimensional spatial information to obtain a modified face image comprises:
coloring the target modification area according to the three-dimensional space information to obtain a three-dimensional texture coloring result;
and replacing the three-dimensional texture coloring result on the target modification area of the original face image to obtain a modified face image.
4. The method according to claim 3, wherein the rendering the target modified region according to the three-dimensional spatial information to obtain a three-dimensional texture rendering result comprises:
determining a three-dimensional subdivision grid corresponding to the target modification area according to the three-dimensional space information;
and transferring the color of the coordinate corresponding to the texture to the coordinate position corresponding to the three-dimensional subdivision grid to obtain a three-dimensional texture coloring result.
5. The method according to claim 4, wherein the determining the three-dimensional split mesh corresponding to the target modification region according to the three-dimensional spatial information comprises:
and triangulating the three-dimensional space information to obtain a three-dimensional subdivision grid corresponding to the target modification area.
6. The method according to claim 5, wherein the triangulating the three-dimensional spatial information to obtain a three-dimensional mesh corresponding to the target modification region comprises:
and performing nearest non-cross triangulation on the three-dimensional space information to obtain a three-dimensional mesh corresponding to the target modification area.
7. The method according to claim 3, wherein said replacing the three-dimensional texture coloring result onto the target modified region of the original face image to obtain a modified face image, comprises:
and performing feathering processing on the edge area of the target modification area to obtain a modified face image.
8. A face modification device based on three-dimensional reconstruction is characterized by comprising:
a modified target determining unit for determining a target modified region from the original face image;
the first processing unit is used for carrying out three-dimensional reconstruction on the target modification area to obtain three-dimensional space information corresponding to the target modification area;
the second processing unit is used for carrying out coloring processing on the target modification area according to the three-dimensional space information to obtain a modified human face image;
the modification target determining unit is further specifically configured to determine face key point information from an original face image according to a preset face key point detection model; separating a region to be modified from the original face image according to the face key point information, wherein the region to be modified is the target modification region;
the first processing unit is further specifically configured to obtain the face key point information, a basic parameter corresponding to the target modification region and used for representing a three-dimensional space coordinate point set of the target modification region, and a weight coefficient corresponding to the basic parameter; determining a preset three-dimensional basic model matched with the basic parameters according to the basic parameters; and carrying out weighting processing on the preset three-dimensional basic model through the weighting coefficient to obtain three-dimensional space information corresponding to the target modification area.
9. A terminal device, comprising: a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the three-dimensional reconstruction based face embellishment method according to any one of claims 1 to 7 when executing the computer program.
10. A storage medium having stored thereon instructions which, when run on a computer, cause the computer to execute the method of face embellishment based on three-dimensional reconstruction of any of claims 1 to 7.
CN201811060479.2A 2018-09-11 2018-09-11 Face modification method, device and equipment based on three-dimensional reconstruction and storage medium Active CN109035380B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811060479.2A CN109035380B (en) 2018-09-11 2018-09-11 Face modification method, device and equipment based on three-dimensional reconstruction and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811060479.2A CN109035380B (en) 2018-09-11 2018-09-11 Face modification method, device and equipment based on three-dimensional reconstruction and storage medium

Publications (2)

Publication Number Publication Date
CN109035380A CN109035380A (en) 2018-12-18
CN109035380B true CN109035380B (en) 2023-03-10

Family

ID=64621664

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811060479.2A Active CN109035380B (en) 2018-09-11 2018-09-11 Face modification method, device and equipment based on three-dimensional reconstruction and storage medium

Country Status (1)

Country Link
CN (1) CN109035380B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111882666B (en) * 2020-07-20 2022-06-21 浙江商汤科技开发有限公司 Method, device and equipment for reconstructing three-dimensional grid model and storage medium
CN112529808A (en) * 2020-12-15 2021-03-19 北京映客芝士网络科技有限公司 Image color adjusting method, device, equipment and medium
CN113538639B (en) * 2021-07-02 2024-05-21 北京达佳互联信息技术有限公司 Image processing method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106327571A (en) * 2016-08-23 2017-01-11 北京的卢深视科技有限公司 Three-dimensional face modeling method and three-dimensional face modeling device
CN106920274A (en) * 2017-01-20 2017-07-04 南京开为网络科技有限公司 Mobile terminal 2D key points rapid translating is the human face model building of 3D fusion deformations
CN106952221A (en) * 2017-03-15 2017-07-14 中山大学 A three-dimensional Beijing opera facial makeup automatic makeup method
CN107274493A (en) * 2017-06-28 2017-10-20 河海大学常州校区 A kind of three-dimensional examination hair style facial reconstruction method based on mobile platform
CN107480613A (en) * 2017-07-31 2017-12-15 广东欧珀移动通信有限公司 Face identification method, device, mobile terminal and computer-readable recording medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106327571A (en) * 2016-08-23 2017-01-11 北京的卢深视科技有限公司 Three-dimensional face modeling method and three-dimensional face modeling device
CN106920274A (en) * 2017-01-20 2017-07-04 南京开为网络科技有限公司 Mobile terminal 2D key points rapid translating is the human face model building of 3D fusion deformations
CN106952221A (en) * 2017-03-15 2017-07-14 中山大学 A three-dimensional Beijing opera facial makeup automatic makeup method
CN107274493A (en) * 2017-06-28 2017-10-20 河海大学常州校区 A kind of three-dimensional examination hair style facial reconstruction method based on mobile platform
CN107480613A (en) * 2017-07-31 2017-12-15 广东欧珀移动通信有限公司 Face identification method, device, mobile terminal and computer-readable recording medium

Also Published As

Publication number Publication date
CN109035380A (en) 2018-12-18

Similar Documents

Publication Publication Date Title
EP3992919B1 (en) Three-dimensional facial model generation method and apparatus, device, and medium
CN109859305B (en) Three-dimensional face modeling and recognizing method and device based on multi-angle two-dimensional face
CN109325437B (en) Image processing method, device and system
US20250157114A1 (en) Animatable character generation using 3d representations
CN113628327B (en) Method and device for three-dimensional reconstruction of head
WO2022001236A1 (en) Three-dimensional model generation method and apparatus, and computer device and storage medium
CN109961496B (en) Expression driving method and expression driving device
JP6863596B2 (en) Data processing device and data processing method
CN109102559A (en) three-dimensional model processing method and device
US12602889B2 (en) Method and system of rendering a 3D image for automated facial morphing
CN110060348B (en) Face image shaping method and device
WO2015021381A1 (en) Real-time reconstruction of the human body and automated avatar synthesis
JP2024501986A (en) 3D face reconstruction method, 3D face reconstruction apparatus, device, and storage medium
CN111008935B (en) Face image enhancement method, device, system and storage medium
US11769309B2 (en) Method and system of rendering a 3D image for automated facial morphing with a learned generic head model
CN107705240A (en) Virtual examination cosmetic method, device and electronic equipment
CN108463823A (en) A reconstruction method, device and terminal of a user's hair model
CN109035380B (en) Face modification method, device and equipment based on three-dimensional reconstruction and storage medium
CN112766215B (en) Face image processing method and device, electronic equipment and storage medium
EP4111420A1 (en) Face mesh deformation with detailed wrinkles
CN113610958A (en) 3D image construction method and device based on style migration and terminal
CN109584145A (en) Cartoonize method and apparatus, electronic equipment and computer storage medium
CN113380269B (en) Video image generation method, apparatus, device, medium, and computer program product
US11854156B2 (en) Method and system of multi-pass iterative closest point (ICP) registration in automated facial reconstruction
CN111557022B (en) Two-dimensional image processing method and device for executing the method

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
TR01 Transfer of patent right

Effective date of registration: 20241119

Address after: No. 257, 2nd Floor, Building 9, No. 2 Huizhu Road, Liangjiang New District, Yubei District, Chongqing 401100

Patentee after: Yuanli Jinzhi (Chongqing) Technology Co.,Ltd.

Country or region after: China

Address before: 313, block a, No.2, south academy of Sciences Road, Haidian District, Beijing

Patentee before: BEIJING KUANGSHI TECHNOLOGY Co.,Ltd.

Country or region before: China

TR01 Transfer of patent right