WO2020211347A1 - 基于人脸识别的修改图片的方法、装置和计算机设备 - Google Patents

基于人脸识别的修改图片的方法、装置和计算机设备 Download PDF

Info

Publication number
WO2020211347A1
WO2020211347A1 PCT/CN2019/117660 CN2019117660W WO2020211347A1 WO 2020211347 A1 WO2020211347 A1 WO 2020211347A1 CN 2019117660 W CN2019117660 W CN 2019117660W WO 2020211347 A1 WO2020211347 A1 WO 2020211347A1
Authority
WO
WIPO (PCT)
Prior art keywords
face
model
face image
picture
matrix
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.)
Ceased
Application number
PCT/CN2019/117660
Other languages
English (en)
French (fr)
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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Publication of WO2020211347A1 publication Critical patent/WO2020211347A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/80Geometric correction
    • 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/168Feature extraction; Face representation
    • 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/174Facial expression recognition
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10016Video; Image sequence
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30196Human being; Person
    • G06T2207/30201Face

Definitions

  • This application relates to the field of artificial intelligence technology, in particular to a method, device and computer equipment for modifying pictures based on face recognition.
  • the image processing software can automatically recognize the face of the person in the picture to be processed, and then replace other faces that the user needs to replace with the face on the picture to be processed.
  • the face of the person in the picture is sideways, the other face information that the user needs to replace is all upright, resulting in inconsistent angles between the face and the body in the processed picture.
  • the main purpose of this application is to provide a method, device and computer equipment for modifying a picture based on face recognition that can modify the picture according to the deflection angle of the face in the picture.
  • this application proposes a method for modifying pictures based on face recognition, including:
  • This application also provides a device for modifying pictures based on face recognition, including:
  • the extraction module is configured to extract the face image in the video after receiving the instruction to modify the picture sent by the user, and the instruction includes the object to be loaded on the face image;
  • a projection module configured to project the 3D model according to the deflection angle to obtain a replacement picture
  • the loading module is used to load the replacement picture on the face image.
  • the present application also provides a computer device, including a memory and a processor, the memory stores a computer program, and the processor implements the steps of any one of the foregoing methods when the computer program is executed.
  • the present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of any one of the above methods are implemented.
  • the method, device and computer equipment for modifying pictures based on face recognition of the present application when replacing a face picture, according to the deflection angle of the face in the picture or video, the angle of the pre-replaced face is also replaced with The deflection angle of the face in the video is the same, which makes the replaced picture more realistic.
  • FIG. 1 is a schematic flowchart of a method for modifying a picture based on face recognition according to an embodiment of the application
  • FIG. 2 is a schematic block diagram of the structure of an apparatus for modifying pictures based on face recognition according to an embodiment of the application;
  • FIG. 3 is a schematic block diagram of the structure of a computer device according to an embodiment of the application.
  • an embodiment of the present application provides a method for modifying a picture based on face recognition, including the steps:
  • the execution body of this embodiment is applied to an image processing APP on a mobile phone, and the execution body is the processor of the mobile phone.
  • the processor receives the modified picture sent by the user, reads the video file, scans the video file to form an image, or directly extracts the frame pictures in the video, and then extracts the face in the video Image, extract the face image in the video in real time according to the video playback.
  • the above-mentioned video files include video files that are included in the mobile phone, video files played in the browser, dynamic pictures, and video files generated by online video chats.
  • the step for the user to issue an instruction to modify the picture is to receive the instruction to modify the picture from the user on the APP interface, and load multiple objects in the database to be loaded on the face image on the interface for the user to select, and to receive the user’s choice
  • There are multiple objects stored in the database and each object is displayed in the form of an image or text or a combination of the two, so that the user can quickly understand the specific information of the object and select the object the user wants. For example, there are ten objects in the database, and each object is the face of an entertainment star.
  • the APP interface When the APP interface receives the user's instruction to modify the picture, it loads these ten objects on the interface at the same time, allowing the user to select one of the face images as the object loaded on the above face image; then the APP packs the object Enter the instruction to form an instruction issued by the user to modify the picture.
  • the processor extracts the face image in the video, it calculates the deflection angle of the face according to the face feature points.
  • the processor extracts the face image in the video, it can determine the deflection angle of the face image by using the facial features information.
  • the deflection angle is the deflection angle set for the face image relative to the preset reference position. If the preset reference position is the face image when the user is looking straight ahead, when the face in the video turns left or right or tilts up or When looking down, the deflection angle is relative to the rotation angle of head-up view.
  • the preset reference position is the face image when the user is looking straight ahead, when the face in the video turns left or right or tilts up or When looking down, the deflection angle is relative to the rotation angle of head-up view.
  • the relative position of the facial features and the size of some symmetrical facial features can be used to calculate the deflection angle of the face image.
  • the two eyes in the face picture are identified, and the width dimensions of the two eyes are calculated respectively, and then the ratio of the width dimensions of the two eyes is calculated. Calculate the deflection angle. For example, in a captured image, the width of the left eye of a person is 3000, and the width of the right eye is 4000.
  • y represents the deflection angle of deflection to the left
  • x represents the ratio of the width of the left eye to the width of the right eye 3/4.
  • the final calculated y is an angle between negative 90 degrees and positive 90 degrees, that is, the deflection angle of leftward deflection. If the obtained value is negative, it means the absolute value of the rightward deflection angle.
  • a 3D model refers to a three-dimensional image corresponding to an object stored in the user's face, animal avatar, glasses and hat waiting to be loaded on the face image.
  • the three-dimensional image is formed by the user by taking a 360-degree photograph of an object or person in advance
  • Three-dimensional images can also be downloaded from the Internet.
  • step S3 after the processor calls the 3D model, it obtains the calculated deflection angle, and then projects the 3D model from the deflection angle to obtain a two-dimensional picture of the 3D model projected at the deflection angle. That is, the above replacement picture.
  • step S4 the processor then loads the replacement picture on the face image in the video, so that the replacement picture is overlaid on the face image, which achieves the purpose of replacing the face in the video.
  • the calculation of the deflection angle of the face image is also calculated in real time after receiving the user's instruction, and the corresponding loaded replacement image is also loaded in real time.
  • the aforementioned 3D model is a human face 3D model
  • the aforementioned step of projecting the 3D model according to the deflection angle to obtain a replacement picture includes:
  • the 3D model refers to a 3D model of a human face.
  • the processor After the processor extracts the face image in the video, it preprocesses the face image.
  • the preprocessing is the processing before the feature extraction, segmentation and matching of the image.
  • the main purpose of image preprocessing is to eliminate irrelevant images in the image. Information, restore useful real information, enhance the detectability of relevant information and simplify data to the greatest extent, thereby improving the reliability of feature extraction, image segmentation, matching and recognition.
  • the preprocessed face image is input to the trained training model for expression recognition, and the expression recognition result of the face image sequence is obtained; wherein, the input end to the output end of the training model are sequentially performed by the convolutional neural network
  • the model, the long and short-term memory cyclic neural network model, the first pooling layer and the logistic regression model are constructed, and the training model is obtained by training a collection of continuous frame images with annotated expression categories.
  • the processor controls the 3D face model to simulate an expression consistent with the expression of the aforementioned face image, and the method of simulating the corresponding expression is: first obtain the first feature point of the aforementioned face 3D model , And then multiply the first feature point by the adjustment matrix corresponding to the above expression to obtain the second feature point with the expression, and then map the second feature point on the above-mentioned face 3D model, then the person with the above expression is obtained 3D model of face.
  • Each expression corresponds to an adjustment matrix, and the characteristic matrix corresponding to each expression is obtained by the staff after a lot of calculation and debugging.
  • the processor first divides the various parts of the face 3D model into regions, such as face region, nose region, mouth region, eyebrow region, etc., and can continue to subdivide each region into multiple sub-regions. Area, and then adjust the type according to the expression type and the preset area. After obtaining the expression, obtain the area or sub-area corresponding to the expression, then obtain the feature points of the area or sub-area corresponding to the expression, and then multiply the feature points by the expression
  • the corresponding region adjustment matrix is used to obtain feature points with expressions, and then the feature points with expressions are mapped to corresponding regions or sub-regions to obtain a 3D face model with the above expressions.
  • the deflection angle of the aforementioned image is the y value calculated in the formula, and the replacement picture with the aforementioned expression of the 3D face model is obtained by projection.
  • the adjustment area corresponding to the smile expression type is the mouth area and the adjustment matrix corresponding to the mouth area, and then the above 3D model The mouth area in is multiplied by the above adjustment matrix to obtain a 3D face model with a smiling expression.
  • the 3D face model with the smile expression is rotated at the above deflection angle, and then project the rotated 3D face model with the smile expression from the direction facing the original 3D face model on the initial
  • a replacement picture with a smiling expression is finally obtained.
  • the 3D face model with the above expression is centered on the axis of symmetry of the 3D face model, and the angle of the y value calculated above is rotated, and then a camera is simulated, from the initial 3D face model (not rotated) Take a picture of the opposite place, and the resulting picture is the above replacement picture.
  • the aforementioned 3D model is a human face 3D model
  • the aforementioned step of projecting the 3D model according to the deflection angle to obtain a replacement picture includes:
  • S311 Control each organ of the human face 3D model to simulate the facial action
  • the extracted face image in the video is preprocessed and input into a trained organ recognition model.
  • the organ recognition model segments the aforementioned face image and recognizes each of the face images.
  • Organs The image area containing the various organs in the above face image is defined as the first organ.
  • the first organ includes multiple organs that can move on the face. Specifically, the first organ includes eyes, mouth, nose, eyebrows, and cheeks. muscle.
  • Each first organ is compared with the preset second organ state under the normal state one by one, and the action of each organ is determined according to the comparison result.
  • the specific process of judging the actions of the organs is to perform image analysis on the first organ and the corresponding second organ, and establish a matrix with the same number of rows and columns for the first organ and the second organ according to the pigment difference, and then subtract the matrix of the first organ.
  • the matrix of the second organ is removed to obtain the matrix difference, and then the rank of the matrix difference is calculated.
  • the facial movement of the organ is determined from the correspondence between the rank of the organ and the facial movement.
  • the result of the rank is less than a certain value, it is determined that the organ is in a normal state, and the corresponding organ in the aforementioned 3D face model does not need to simulate other facial movements.
  • the various organs of the human face 3D model are identified, and it is confirmed that the first organ has an abnormal facial movement in the above-mentioned organ.
  • a two-dimensional picture of the 3D face model with the same facial action is obtained by projection, and then the two-dimensional picture is loaded at the position of the face image in the video.
  • the steps of projecting the 3D face model with facial action to obtain the replacement picture are the same as the method of S35.
  • the above-mentioned organ recognition model is based on a deep neural network model training.
  • the staff first collects a number of pictures containing the face of a person, and annotates each organ on the face of each person in the picture, and then the picture And each annotation is input into the deep neural network model for training, and the organ recognition model is obtained.
  • the above step of loading the replacement picture on the face image includes:
  • S41 Acquire the size of the display screen in the attribute information of the terminal and the proportion of the face image in the display screen in the playback interface;
  • the processor calculates the size of the aforementioned face image according to the video information. Specifically, it obtains the attribute information of the mobile phone where the APP is located, and obtains the size of the display screen. Proportion, which simulates loading a face image on the playback interface, and then calculates the size of the face image in the playback interface. Then compare the size with the preset standard size to get the ratio between the two.
  • the standard size is set manually. The setting process is to place a standard face at a specified distance from the specified camera and then collect the size of the face.
  • the 3D model corresponding to the object in the database is also specified according to the specified camera. Captured after the distance.
  • the step of extracting the face image in the video after receiving the instruction to modify the picture from the user includes:
  • the processor After the processor receives the replacement or addition instruction issued by the user, it obtains the video played in the specified APP, then reads the detailed information of the video, intercepts the frame picture played at the current moment of the video, and then the frame The picture is input into the preset face recognition model, and the recognition is performed according to the face recognition model, and the face image is obtained by outputting.
  • the method before the step of inputting the frame picture into the preset face recognition model and outputting the face image, the method includes:
  • S101 Input a plurality of pictures containing human face images in a training set into a preset neural network model for training, and obtain a neural network model for recognizing human faces in the pictures as the face recognition model.
  • the staff selects a number of pictures containing human face images in advance to form a training set, and then inputs these pictures into a preset neural network model for training.
  • the neural network model is automatically based on the gray in the face image.
  • the trajectory formed by the degree is calculated and optimized to obtain the feature coefficients of the face picture, even if the neural network model can be used to identify whether there is a face image in the picture.
  • the frame picture is processed to obtain the grayscale of the picture, and then the grayscale trajectory is calculated whether the feature coefficient obtained by the above training is included, and if it is, the human face image in the video is judged. According to the gray trajectory corresponding to the feature coefficient, the face image is extracted.
  • the above step of loading the replacement picture on the face image it includes:
  • the object is stored in the database, and the corresponding information of each object is also stored in the database.
  • the attributes of each object include whether it is face information. If it is face information, the replacement picture corresponds to the person’s face information. The face information is in an irregular shape, and the replacement pictures formed rarely cover the above On the face image, therefore, it is necessary to delete the face image in the video to make the overall replacement video information more coordinated.
  • the processor reads the attribute information of the object, and judges whether the attribute information is face information. If it is face information, delete the face image.
  • the attribute information of the object includes two types of facial information and accessory information, where the facial information includes human faces, dog faces, and cat faces, and the accessory information includes glasses, earrings, and hats. If it is determined that the object is not facial information, only the replacement picture is loaded on the face image to form the effect of wearing accessories to the characters in the video, which gives the user a better experience.
  • the method for modifying a picture based on face recognition of the present application when replacing a face picture, according to the deflection angle of the face in the picture or video, the angle of the pre-replaced face is also replaced with The deflection angle of the face in the video is the same, which makes the replaced picture more realistic.
  • an embodiment of the present application also provides an apparatus for modifying pictures based on face recognition, including:
  • the extraction module 1 is configured to extract a face image in a video after receiving an instruction to modify a picture issued by a user, and the instruction includes an object to be loaded on the face image;
  • the projection module 3 is used to project the 3D model according to the deflection angle to obtain a replacement picture
  • the loading module 4 is used to load the replacement picture on the face image.
  • an embodiment of the present application also provides a computer device.
  • the computer device may be a server, and its internal structure may be as shown in FIG. 3.
  • the computer equipment includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the computer designed processor is used to provide calculation and control capabilities.
  • the memory of the computer device includes a storage medium and an internal memory.
  • the storage medium may be a non-volatile storage medium or a volatile storage medium, and the storage medium stores an operating system, a computer program, and a database.
  • the memory provides an environment for the operation of the operating system and computer programs in the storage medium.
  • the database of the computer equipment is used to store data such as 3D models.
  • the network interface of the computer device is used to communicate with an external terminal through a network connection.
  • the computer program is executed by the processor to realize a method of modifying pictures based on face recognition.
  • FIG. 3 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied.
  • An embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored.
  • a computer program is stored on which a computer program is stored.
  • the computer program is executed by a processor, a method for modifying a picture based on face recognition is implemented.
  • the computer program can be stored in a computer readable storage medium.
  • the computer-readable storage medium may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium.
  • the computer program When executed, it may include the processes of the above-mentioned method embodiments.
  • any reference to memory, storage, database or other media provided in this application and used in the embodiments may include non-volatile and/or volatile memory.
  • Non-volatile 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.
  • RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual-rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

Landscapes

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

Abstract

本申请揭示了一种基于人脸识别的修改图片的方法、装置和计算机设备,其中方法包括:接收到用户发出的修改图片的指令后,提取视频中的人脸图像,所述指令中包括待加载在所述人脸图像上的对象;计算所述人脸图像的偏转角度,并调用数据库中与所述对象对应的3D模型;将所述3D模型按照所述偏转角度进行投影,得到替换图片;将所述替换图片加载在所述人脸图像上。本申请在替换人脸图片时,根据图片或视频中的人脸的偏转角度后,将预替换的脸部的角度也替换成与视频中的人脸的偏转角度相同,使替换出来的画面更加真实。

Description

基于人脸识别的修改图片的方法、装置和计算机设备
本申请要求于2019年4月16日提交中国专利局、申请号为201910305175.6,发明名称为“基于人脸识别的修改图片的方法、装置和计算机设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及到人工智能技术领域,特别是涉及到一种基于人脸识别的修改图片的方法、装置和计算机设备。
背景技术
目前市场上有很多图像处理软件,图像处理软件可以自动识别出待图片中人的脸部,然后将用户需要替换的其他脸部替换到待处理的图片上的脸部。但是当图片中的人的脸部是侧着的时候,用户需要替换的其他脸部信息都是正着的,导致处理后的图片中脸部与身体的角度不协调。
技术问题
本申请的主要目的为提供一种可以根据图片中的人脸偏转角度来进行修改图片的基于人脸识别的修改图片的方法、装置和计算机设备。
技术解决方案
为了实现上述发明目的,本申请提出一种基于人脸识别的修改图片的方法,包括:
接收到用户发出的修改图片的指令后,提取视频中的人脸图像,所述指令中包括待加载在所述人脸图像上的对象;
根据公式:y=18.75x 2-135x+116.25,计算所述人脸图像的偏转角度,并调用数据库中与所述对象对应的3D模型,其中y表示向左偏转的偏转角度,x表示人脸图像中左边器官尺寸与对应的右边器官尺寸的比例值;
将所述3D模型按照所述偏转角度进行投影,得到替换图片;
将所述替换图片加载在所述人脸图像上。
本申请还提供一种基于人脸识别的修改图片的装置,包括:
提取模块,用于接收到用户发出的修改图片的指令后,提取视频中的人脸图像,所述指令中包括待加载在所述人脸图像上的对象;
计算角度模块,用于根据公式:y=18.75x 2-135x+116.25,计算所述人脸图像的偏转角度,并调用数据库中与所述对象对应的3D模型,其中y表示向左偏转的偏转角度,x表示人脸图像中左边器官尺寸与对应的右边器官尺寸的比例值;
投影模块,用于将所述3D模型按照所述偏转角度进行投影,得到替换图片;
加载模块,用于将所述替换图片加载在所述人脸图像上。
本申请还提供一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现上述任一项所述方法的步骤。
本申请还提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述任一项所述的方法的步骤。
有益效果
本申请的基于人脸识别的修改图片的方法、装置和计算机设备,在替换人脸图片时,根据图片或视频中的人脸的偏转角度后,将预替换的脸部的角度也替换成与视频中的人脸的偏转角度相同,使替换出来的画面更加真实。
附图说明
图1为本申请一实施例的基于人脸识别的修改图片的方法的流程示意图;
图2为本申请一实施例的基于人脸识别的修改图片的装置的结构示意框图;
图3为本申请一实施例的计算机设备的结构示意框图。
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。 本发明的最佳实施方式
参照图1,本申请实施例提供一种基于人脸识别的修改图片的方法,包括步骤:
S1、接收到用户发出的修改图片的指令后,提取视频中的人脸图像,所述指令中包括待加载在所述人脸图像上的对象;
S2、根据公式:y=18.75x 2-135x+116.25,计算所述人脸图像的偏转角度,并调用数据库中与所述对象对应的3D模型,其中y表示向左偏转的偏转角度,x表示人脸图像中左边器官尺寸与对应的右边器官尺寸的比例值;
S3、将所述3D模型按照所述偏转角度进行投影,得到替换图片;
S4、将所述替换图片加载在所述人脸图像上。
如上述步骤S1所述,本实施例的执行主体应用于一款手机上的图像处理APP,执行主体是该手机的处理器。当该APP加载了视频文件后,处理器接收到用户发出的修改图片后,读取该视频文件,扫描该视频文件以形成图像,或者直接提取视频中的帧图片,然后提取视频中的人脸图像,根据视频的播放实时提取视频中的人脸图像。上述视频文件包括手机中自带的视频文件、浏览器中播放的视频文件、动态图、在线视频聊天产生的视频文件等。用户发出修改图片的指令的步骤为,在APP界面接收到用户发出的修改图片的指令,将数据库中的多个要加载在人脸图像上的对象加载在界面上以供用户选择,接收用户选择的对象后,生成修改图片的指令。数据库中存储有多个对象,每一个对象均是以图像或文字或两者结合的形式展示出来,以供用户快速了解对象的具体信息,以选择出用户想要的对象。例如,数据库中有十个对象,每一个对象分别是一个娱乐明星的人脸头像。当APP界面接收到用户发出的修改图片的指令后,将这十个对象同时加载在界面上,供用户选择其中一个人脸图像作为加载在上述人脸图像上的对象;然后APP将该对象打包进指令中,以形成用户发出的修改图片的指令。
如上述步骤S2所述,处理器提取出了视频中的人脸图像后,根据人脸特征点计算脸部的偏转角度。处理器提取出了视频中的人脸图像后,利用五官信息可以判断出人脸图像的偏转角度。该偏转角度为人脸图像相对预设参考位置设置的偏转角度,如预设参考位置为用户平视正前方时的人脸图像,则当视频中的人脸向左转或向右转或向上仰或向下看时,其偏转角度为相对于平视时的转动角度,由于人脸图像进行不同程度的偏转时,所采集到的五官具有不同的相对位置,而且一些对称的五官的大小会发生变化,例如人向左边偏转,则左边的耳朵离摄像头远一些,对应的在视频中的左边耳朵相对右边耳朵小一些。因此利用五官的相对位置以及一些对称的五官的大小,可以计算出人脸图像的偏转角度。在一具体实施例中,提取出了视频中的人脸图片后,识别出人脸图片中的两个眼睛,并分别计算两只眼睛的宽度尺寸,然后根据两个眼睛的宽度尺寸的比例来计算偏转角度。如,在一个采集的图像中,人的左眼宽度是3000,右眼宽度是4000,上述宽度单位是在图像中的切割后得出最小尺寸单位。然后计算左眼与右眼的比例是3:4,即左眼宽度是右眼宽度的3/4,然后输出到预设的公式y=f(x)中,计算出向左偏转的偏转角度,上述公式中,y表示向左偏转的偏转角度,x表示左眼宽度与右眼宽度的比例3/4。最终计算得到的y是一个负90度到正90度之间的角度,即向左偏转的偏转角度,如果得出的是负值,表示是向右偏转的角度的绝对值。在一个固定的像素中经过一基础的测试,具体的公式是:y=18.75x 2-135x+116.25。
同时,用户发出修改图片的指令时,首先选择一个加载的对象用于加载在视频中的人脸图像上。其中,用户可以在手机上自带的数据库中选择一个待加载的对象。数据库中存储有多个对象,以及与各对象对应的3D模型。当用户在APP上需要对视频中的人脸图像进行替换或者增加图片时,在APP中的数据库中选择一个对象,处理器接收到用户发出的指令后,根据指令中的对象,调用出用户选择的对象对应的3D模型。3D模型是指用户预先存储的人脸、动物头像、眼镜帽子等待加载在人脸图像上的对象对应的三维立体图,其中三维立体图是用户通过事先对一个物体或人等进行360度拍照后形成的三维立体图,也可以是从网络上下载等得到。
如上述步骤S3所述,处理器调用出了3D模型后,再获取上述计算出的偏转角度,然后从偏转角度对3D模型进行投影,得到该3D模型的在偏转角度投影生成的二维图片,即上述替换图片。
如上述步骤S4所述,处理器再将该替换图片加载在视频中的人脸图像上,使替换图片覆盖在人脸图像上,即实现了对视频中的人脸进行替换的目的。
本实施例中,因视频是连续播放的,因此,接收到用户的指令后,计算人脸图像的偏转角度也是实时计算的,对应的加载的替换图像也是实时加载的。
在一个实施例中,上述3D模型为人脸3D模型,上述将所述3D模型按照所述偏转角度进行投影,得到替换图片的步骤,包括:
S31、将所述人脸图像进行预处理后,输入到训练后的表情识别模型中识别,以获取所述人脸图像的表情;
S32、获取所述人脸3D模型的第一特征点以及所述表情对应的调整矩阵,其中,表情以及调整矩阵的对应关系是预先设置的;
S33、将所述第一特征点乘以所述调整矩阵,得到所述第二特征点;
S34、将所述第二特征点映射在所述人脸3D模型上,控制所述人脸3D模型模拟出所述表情;
S35、将模拟出所述表情的所述人脸3D模型旋转所述偏转角度的度数后,映射在未旋转时所述人脸3D模型的背面以进行投影,得到替换图片。
本实施例中,3D模型是指人脸3D模型。处理器提取了视频中的人脸图像后,将人脸图像进行预处理,预处理是将图像进行特征抽取、分割和匹配前所进行的处理,图像预处理的主要目的是消除图像中无关的信息,恢复有用的真实信息,增强有关信息的可检测性和最大限度地简化数据,从而改进特征抽取、图像分割、匹配和识别的可靠性。然后将预处理后的人脸图像输入已训练好的训练模型进行表情识别,得到所述人脸图像序列的表情识别结果;其中,所述训练模型的输入端到输出端依次由卷积神经网络模型、长短时记忆循环神经网络模型、第一池化层和逻辑回归模型构建,且所述训练模型通过标注表情类别的连续帧图像集合训练得到。获取得到人脸图像的表情后,处理器控制将人脸3D模型模拟出与上述人脸图像的表情一致的表情,模拟出对应表情的方法为:首先获取上述人脸3D模型的第一特征点,然后将该第一特征点乘以上述表情对应的调整矩阵,得到具有表情的第二特征点,然后将该第二特征点映射在上述人脸3D模型上,则得到了具有上述表情的人脸3D模型。每一个表情对应一个调整矩阵,各表情对应的特征矩阵是工作人员经过大量计算调试后得出的。在进一步的具体调整过程中,处理器首先将人脸3D模型的各个部位进行区域划分,比如分为脸区域、鼻子区域、嘴巴区域、眉毛区域等,还可以继续将各个区域细分为多个子区域,然后将根据表情类型与预设的区域调整类型,首先获取了表情后,获取表情对应的区域或子区域,然后获取表情对应的区域或子区域的特征点,再将特征点乘以表情对应的区域调整矩阵,得到带有表情的特征点,再将带有表情的特征点映射到对应的区域或子区域中,得到带有上述表情的人脸3D模型。实现人脸3D模型模拟出与上述人脸图像表情相同的表情。然后根据上述图像的偏转角度,偏转角度即公式中计算得到的y值,投影得到该3D人脸模型的带有上述表情的替换图片。如,当识别出表情是微笑的时候,则在表情类型与区域调整方式的对应关系中,找到微笑这一表情类型对应的调整区域是嘴巴区域以及嘴巴区域对应的调整矩阵,然后将上述3D模型中的嘴巴区域乘以上述调整矩阵,得到带有微笑表情的3D人脸模型。然后将上述带有微笑表情的3D人脸模型以上述偏转角度进行旋转,然后从初始的3D人脸模型的正对着的方向对旋转后的带有微笑表情的3D人脸模型进行投影在初始的3D人脸模型背后的平面上,最终得到带有微笑表情的替换图片。具体的,将带有上述表情的3D人脸模型以3D人脸模型的对称轴为中心,转动上述计算得到的y值的角度,然后模拟出一个照相机,从初始3D人脸模型(未转动)的正对处进行拍照,得到的图片即为上述替换图片。
在一个实施例中,上述3D模型为人脸3D模型,上述将所述3D模型按照所述偏转角度进行投影,得到替换图片的步骤,包括:
S36、将所述人脸图像输入到预设的器官识别模型中,得到所述人脸图像中的第一器官;
S37、将所述第一器官与预设的常态下的第二器官根据色素差建立同样行列数的矩阵,分别得到第一矩阵和第二矩阵;
S38、将所述第一矩阵减去第二矩阵,得到矩阵差;
S39、计算所述矩阵差的秩;
S310、调用预设的秩与面部动作的对应关系,根据所述矩阵差的秩获取所述第一器官对应的面部动作;
S311、控制所述人脸3D模型的各个器官模拟出所述面部动作;
S312、将模拟出所述面部动作的所述人脸3D模型旋转所述偏转角度的度数后,映射在未旋转时所述人脸3D模型的背面以投影,得到替换图片。
本实施例中,将提取出的视频中的人脸图像进行预处理后,输入到一个训练后的器官识别模型中,该器官识别模型对上述人脸图像进行分割,识别出该人脸的各个器官,将上述人脸图像中包含有各器官的图像区域定义为第一器官,第一器官包括多个脸上可以活动的器官,具体的,第一器官包括眼睛、嘴巴、鼻子、眉毛、脸颊肌肉。将各个第一器官与预设的正常状态下的第二器官状态一一比较,根据比较结果来判断出各器官的动作。判断器官的动作的具体过程为,将第一器官与对应的第二器官进行图像分析,分别为第一器官和第二器官根据色素差建立同样行列数的矩阵,然后将第一器官的矩阵减去第二器官的矩阵,得到矩阵差,再计算矩阵差的秩,根据秩的结果在该器官的秩与面部动作的对应关系中判定该器官的面部动作。另,如果秩的结果小于一定值,判定该器官是处于正常状态下的,则上述人脸3D模型中的对应的器官是不需要模拟出其他面部动作的。然后识别出人脸3D模型的各个器官,并确认上述第一器官中具有非正常状态下的面部动作的器官。然后将人脸3D模型的各个器官乘以与该器官对应的面部动作的动作矩阵相乘,得到人脸模型的各个器官的面部动作,使人脸3D模型做出与上述变化的面部动作做出相同的动作。然后根据上述图像的偏转角度,投影得到该3D人脸模型的有上述面部动作相同的二维图片,再将该二维图片加载在视频中的人脸图像位置处。将带有面部动作人脸3D模型进行投影得到替换图片的步骤与上述S35的方法相同。
上述器官识别模型是基于一个深度神经网络模型训练得到的,工作人员首先采集多个包含有人的脸部的图片,并将图片中每个人有脸部上的各个器官分别进行标注,然后将该图片以及各个标注输入到该深度神经网络模型中进行训练,得到了器官识别模型。
在一个实施例中,上述将所述替换图片加载在所述人脸图像上的步骤,包括:
S41、获取终端的属性信息中的显示屏的尺寸大小以及所述人脸图像在播放界面占显示屏的比例;
S42、模拟将所述人脸图像加载在播放界面上,计算播放界面中所述人脸图像的尺寸大小;
S43、计算所述人脸图像的尺寸大小与预设的标准尺寸大小之间的比例;
S44、将所述替换图片按照所述比例进行缩放处理;
S45、将所述缩放处理后的替换图片加载在所述人脸图像上。
本实施例中,处理器根据视频信息计算得到上述人脸图像的尺寸大小,具体的,获取APP所在的手机的属性信息,得到显示屏的尺寸大小,然后根根据APP的播放界面占显示屏的比例,模拟将人脸图像加载在播放界面上,然后计算播放界面中该人脸图像的尺寸大小。然后将该尺寸大小与预设的标准尺寸大小进行比较,得出两者之间的比例。标准尺寸大小是人为设置的,设置的过程是将一个标准人脸放置在距离指定摄像头的指定距离后采集得到的人脸的尺寸大小,数据库中的对象对应的3D模型也是根据该指定摄像头在指定距离后拍摄采集的。计算到人脸图像的尺寸大小与标准尺寸大小的比例,然后将替换图像也按照上述比例进行缩放,以使替换图像的尺寸与人脸图像的尺寸相匹配,替换图片的尺寸大小与人脸图像的尺寸大小接近,以便于将替换图片加载在人脸图像上时尺寸合适,看起来比较协调。然后将缩放后的替换图片加载在人脸图像上。
在一个实施例中,上述接收到用户发出的修改图片的指令后,提取视频中的人脸图像的步骤,包括:
S11、接收到用户发出的修改图片的指令后,采集视频中的帧图片;
S12、将所述帧图片输入到预设的人脸识别模型中,输出得到所述人脸图像。
本实施例中,处理器接收到用户发出的替换或添加指令后,获取指定APP中播放的视频,然后读取视频的详细信息,将视频的当前时刻播放的帧图片截取出来,然后将该帧图片输入到预设的人脸识别模型中,根据人脸识别模型进行辨认识别,输出得到人脸图像。
在一个实施例中,上述将所述帧图片输入到预设的人脸识别模型中,输出得到所述人脸图像的步骤之前,包括:
S101、将训练集中的多个包含有人脸图像的图片输入到预设的神经网络模型进行训练,得到用于识别出图片中的人脸的神经网络模型作为所述人脸识别模型。
本实施例中,工作人员事先挑选出多个包含有人脸图像的图片,形成训练集,然后将这些图片输入到预设的神经网络模型中进行训练,神经网络模型自动根据人脸图像中的灰度形成的轨迹来计算优化得到人脸图片的特征系数,即使该神经网络模型可以用于识别出图片中是否有人脸图像。在后续提取视频中的人脸图像时,将帧图片进行处理,得到图片的灰度,然后计算灰度轨迹中是否包含有上述训练得到的特征系数,如果是,则判断视频中有人脸图片,根据特征系数对应的灰度轨迹,提取出人脸图像。
在一个实施例中,上述将所述替换图片加载在所述人脸图像上的步骤之后,包括:
S5、获取所述对象的属性信息;
S6、判断所述属性信息是否是脸部信息;
S7、若是,将所述人脸图像删除。
本实施例中,对象是存储在数据库中的,对应的每个对象的信息也均存储在数据库中。每个对象的属性包括是否是脸部信息,如果是脸部信息,则替换图片对应的也是人的脸部信息,脸部信息呈不规则的形状,形成的替换图片很少可以全面覆盖在上述人脸图像上,因此,需要将视频中的人脸图像删除,使整体的替换后的视频信息更加协调。处理器读取对象的属性信息,判断该属性信息是否是脸部信息。若是脸部信息,则将人脸图像删除。在一具体实施例中,对象的属性信息包括脸部信息与佩饰信息两类,其中脸部信息包括人脸、狗脸、猫脸,佩饰信息包括眼镜、耳环、帽子。如果判定对象不是脸部信息,则只是将替换图片加载在人脸图像上,形成给视频中的人物佩戴饰品的效果,给用户更好的体验效果。
综上所述,本申请的基于人脸识别的修改图片的方法,在替换人脸图片时,根据图片或视频中的人脸的偏转角度后,将预替换的脸部的角度也替换成与视频中的人脸的偏转角度相同,使替换出来的画面更加真实。
参照图2,本申请实施例中还提供一种基于人脸识别的修改图片的装置,包括:
提取模块1,用于接收到用户发出的修改图片的指令后,提取视频中的人脸图像,所述指令中包括待加载在所述人脸图像上的对象;
计算角度模块2,用于根据公式:y=18.75x 2-135x+116.25,计算所述人脸图像的偏转角度,并调用数据库中与所述对象对应的3D模型,其中y表示向左偏转的偏转角度,x表示人脸图像中左边器官尺寸与对应的右边器官尺寸的比例值;
投影模块3,用于将所述3D模型按照所述偏转角度进行投影,得到替换图片;
加载模块4,用于将所述替换图片加载在所述人脸图像上。
参照图3,本申请实施例中还提供一种计算机设备,该计算机设备可以是服务器,其内部结构可以如图3所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设计的处理器用于提供计算和控制能力。该计算机设备的存储器包括存储介质、内存储器。存储介质可以是非易失性存储介质,也可以是易失性存储介质,该存储介质存储有操作系统、计算机程序和数据库。该内存器为存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的数据库用于存储3D模型等数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种基于人脸识别的修改图片的方法。
本领域技术人员可以理解,图3中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定。
本申请一实施例还提供一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现一种基于人脸识别的修改图片的方法。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读取存储介质中,该计算机可读存储介质可以是非易失性计算机可读存储介质,也可以是易失性计算机可读存储介质。该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的和实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可以包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双速据率SDRAM(SSRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、装置、物品或者方法不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、装置、物品或者方法所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、装置、物品或者方法中还存在另外的相同要素。
以上所述仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。

Claims (20)

  1. 一种基于人脸识别的修改图片的方法,其特征在于,包括:
    接收到用户发出的修改图片的指令后,提取视频中的人脸图像,所述指令中包括待加载在所述人脸图像上的对象;
    根据公式:y=18.75x 2-135x+116.25,计算所述人脸图像的偏转角度,并调用数据库中与所述对象对应的3D模型,其中y表示向左偏转的偏转角度,x表示人脸图像中左边器官尺寸与对应的右边器官尺寸的比例值;
    将所述3D模型按照所述偏转角度进行投影,得到替换图片;
    将所述替换图片加载在所述人脸图像上。
  2. 如权利要求1所述的基于人脸识别的修改图片的方法,其特征在于,所述3D模型为人脸3D模型,所述将所述3D模型按照所述偏转角度进行投影,得到替换图片的步骤,包括:
    将所述人脸图像进行预处理后,输入到训练后的表情识别模型中识别,以获取所述人脸图像的表情;
    获取所述人脸3D模型的第一特征点以及所述表情对应的调整矩阵,其中,表情以及调整矩阵的对应关系是预先设置的;
    将所述第一特征点乘以所述调整矩阵,得到所述第二特征点;
    将所述第二特征点映射在所述人脸3D模型上,控制所述人脸3D模型模拟出所述表情;
    将模拟出所述表情的所述人脸3D模型旋转所述偏转角度的度数后,映射在未旋转时所述人脸3D模型的背面以进行投影,得到替换图片。
  3. 如权利要求1所述的基于人脸识别的修改图片的方法,其特征在于,所述3D模型为人脸3D模型,所述将所述3D模型按照所述偏转角度进行投影,得到替换图片的步骤,包括:
    将所述人脸图像输入到预设的器官识别模型中,得到所述人脸图像中的第一器官;
    将所述第一器官与预设的常态下的第二器官根据色素差建立同样行列数的矩阵,分别得到第一矩阵和第二矩阵;
    将所述第一矩阵减去第二矩阵,得到矩阵差;
    计算所述矩阵差的秩;
    调用预设的秩与面部动作的对应关系,根据所述矩阵差的秩获取所述第一器官对应的面部动作;
    控制所述人脸3D模型的各个器官模拟出所述面部动作;
    将模拟出所述面部动作的所述人脸3D模型旋转所述偏转角度的度数后,映射在未旋转时所述人脸3D模型的背面以进行投影,得到替换图片。
  4. 如权利要求1所述的基于人脸识别的修改图片的方法,其特征在于,所述将所述替换图片加载在所述人脸图像上的步骤,包括:
    获取终端的属性信息中的显示屏的尺寸大小以及所述人脸图像在播放界面占显示屏的比例;
    模拟将所述人脸图像加载在播放界面上,计算播放界面中所述人脸图像的尺寸大小;
    计算所述人脸图像的尺寸大小与预设的标准尺寸大小之间的比例;
    将所述替换图片按照所述比例进行缩放处理;
    将所述缩放处理后的替换图片加载在所述人脸图像上。
  5. 如权利要求1所述的基于人脸识别的修改图片的方法,其特征在于,所述接收到用户发出的修改图片的指令后,提取视频中的人脸图像的步骤,包括:
    接收到用户发出的替换人脸的指令后,采集视频中的帧图片;
    将所述帧图片输入到预设的人脸识别模型中,输出得到所述人脸图像。
  6. 如权利要求5所述的基于人脸识别的修改图片的方法,其特征在于,所述将所述帧图片输入到预设的人脸识别模型中,输出得到所述人脸图像的步骤之前,包括:
    将训练集中的多个包含有人脸图像的图片输入到预设的神经网络模型进行训练,得到用于识别出图片中的人脸的神经网络模型作为所述人脸识别模型。
  7. 如权利要求1所述的基于人脸识别的修改图片的方法,其特征在于,所述将所述替换图片加载在所述人脸图像上的步骤之后,包括:
    获取所述对象的属性信息;
    判断所述属性信息是否是脸部信息;
    若是,将所述人脸图像删除。
  8. 一种基于人脸识别的修改图片的装置,其特征在于,包括:
    提取模块,用于接收到用户发出的修改图片的指令后,提取视频中的人脸图像,所述指令中包括待加载在所述人脸图像上的对象;
    计算角度模块,用于根据公式:y=18.75x 2-135x+116.25,计算所述人脸图像的偏转角度,并调用数据库中与所述对象对应的3D模型,其中y表示向左偏转的偏转角度,x表示人脸图像中左边器官尺寸与对应的右边器官尺寸的比例值;
    投影模块,用于将所述3D模型按照所述偏转角度进行投影,得到替换图片;
    加载模块,用于将所述替换图片加载在所述人脸图像上。
  9. 如权利要求8所述的基于人脸识别的修改图片的装置,其特征在于,所述3D模型为人脸3D模型,所述投影模块包括:
    获取表情单元,用于将所述人脸图像进行预处理后,输入到训练后的表情识别模型中识别,以获取所述人脸图像的表情;
    特征点单元,用于获取所述人脸3D模型的第一特征点以及所述表情对应的调整矩阵,其中,表情以及调整矩阵的对应关系是预先设置的;
    相乘单元,用于将所述第一特征点乘以所述调整矩阵,得到所述第二特征点;
    模拟表情单元,用于将所述第二特征点映射在所述人脸3D模型上,控制所述人脸3D模型模拟出所述表情;
    第一投影单元,用于将模拟出所述表情的所述人脸3D模型旋转所述偏转角度的度数后,映射在未旋转时所述人脸3D模型的背面以进行投影,得到替换图片。
  10. 如权利要求8所述的基于人脸识别的修改图片的装置,其特征在于,所述D模型为人脸3D模型,所述投影模块包括:
    得到器官单元,用于将所述人脸图像输入到预设的器官识别模型中,得到所述人脸图像中的第一器官;
    建立矩阵单元,用于将所述第一器官与预设的常态下的第二器官根据色素差建立同样行列数的矩阵,分别得到第一矩阵和第二矩阵;
    相减单元,用于将所述第一矩阵减去第二矩阵,得到矩阵差;
    计算秩单元,用于计算所述矩阵差的秩;
    获取动作单元,用于调用预设的秩与面部动作的对应关系,根据所述矩阵差的秩获取所述第一器官对应的面部动作;
    模拟动作单元,用于控制所述人脸3D模型的各个器官模拟出所述面部动作;
    第二投影单元,用于将模拟出所述面部动作的所述人脸3D模型旋转所述偏转角度的度数后,映射在未旋转时所述人脸3D模型的背面以投影,得到替换图片。
  11. 如权利要求8所述的基于人脸识别的修改图片的装置,其特征在于,所述加载模块包括:
    获取尺寸单元,用于获取终端的属性信息中的显示屏的尺寸大小以及所述人脸图像在播放界面占显示屏的比例;
    计算尺寸单元,用于模拟将所述人脸图像加载在播放界面上,计算播放界面中所述人脸图像的尺寸大小;
    计算比例单元,用于计算所述人脸图像的尺寸大小与预设的标准尺寸大小之间的比例;
    缩放单元,用于将所述替换图片按照所述比例进行缩放处理;
    加载单元,用于将所述缩放处理后的替换图片加载在所述人脸图像上。
  12. 如权利要求8所述的基于人脸识别的修改图片的装置,其特征在于,所述提取模块包括:
    采集单元,用于接收到用户发出的修改图片的指令后,采集视频中的帧图片;
    输出单元,用于将所述帧图片输入到预设的人脸识别模型中,输出得到所述人脸图像。
  13. 如权利要求12所述的基于人脸识别的修改图片的装置,其特征在于,所述基于人脸识别的修改图片的装置还包括:
    训练模块,用于将训练集中的多个包含有人脸图像的图片输入到预设的神经网络模型进行训练,得到用于识别出图片中的人脸的神经网络模型作为所述人脸识别模型。
  14. 如权利要求8所述的基于人脸识别的修改图片的装置,其特征在于,所述基于人脸识别的修改图片的装置还包括:
    获取模块,用于获取所述对象的属性信息;
    判断模块,用于判断所述属性信息是否是脸部信息;
    删除模块,用于若所述属性信息是脸部信息,将所述人脸图像删除。
  15. 一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其特征在于,所述处理器执行所述计算机程序时实现一种基于人脸识别的修改图片的方法,该方法包括步骤:
    接收到用户发出的修改图片的指令后,提取视频中的人脸图像,所述指令中包括待加载在所述人脸图像上的对象;
    根据公式:y=18.75x 2-135x+116.25,计算所述人脸图像的偏转角度,并调用数据库中与所述对象对应的3D模型,其中y表示向左偏转的偏转角度,x表示人脸图像中左边器官尺寸与对应的右边器官尺寸的比例值;
    将所述3D模型按照所述偏转角度进行投影,得到替换图片;
    将所述替换图片加载在所述人脸图像上。
  16. 如权利要求15所述的计算机设备,其特征在于,所述所述3D模型为人脸3D模型,所述将所述3D模型按照所述偏转角度进行投影,得到替换图片的步骤,包括:
    将所述人脸图像进行预处理后,输入到训练后的表情识别模型中识别,以获取所述人脸图像的表情;
    获取所述人脸3D模型的第一特征点以及所述表情对应的调整矩阵,其中,表情以及调整矩阵的对应关系是预先设置的;
    将所述第一特征点乘以所述调整矩阵,得到所述第二特征点;
    将所述第二特征点映射在所述人脸3D模型上,控制所述人脸3D模型模拟出所述表情;
    将模拟出所述表情的所述人脸3D模型旋转所述偏转角度的度数后,映射在未旋转时所述人脸3D模型的背面以进行投影,得到替换图片。
  17. 如权利要求15所述的计算机设备,其特征在于,所述3D模型为人脸3D模型,所述将所述3D模型按照所述偏转角度进行投影,得到替换图片的步骤,包括:
    将所述人脸图像输入到预设的器官识别模型中,得到所述人脸图像中的第一器官;
    将所述第一器官与预设的常态下的第二器官根据色素差建立同样行列数的矩阵,分别得到第一矩阵和第二矩阵;
    将所述第一矩阵减去第二矩阵,得到矩阵差;
    计算所述矩阵差的秩;
    调用预设的秩与面部动作的对应关系,根据所述矩阵差的秩获取所述第一器官对应的面部动作;
    控制所述人脸3D模型的各个器官模拟出所述面部动作;
    将模拟出所述面部动作的所述人脸3D模型旋转所述偏转角度的度数后,映射在未旋转时所述人脸3D模型的背面以进行投影,得到替换图片。
  18. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现一种基于人脸识别的修改图片的方法,该方法包括步骤:接收到用户发出的修改图片的指令后,提取视频中的人脸图像,所述指令中包括待加载在所述人脸图像上的对象;
    根据公式:y=18.75x 2-135x+116.25,计算所述人脸图像的偏转角度,并调用数据库中与所述对象对应的3D模型,其中y表示向左偏转的偏转角度,x表示人脸图像中左边器官尺寸与对应的右边器官尺寸的比例值;
    将所述3D模型按照所述偏转角度进行投影,得到替换图片;
    将所述替换图片加载在所述人脸图像上。
  19. 如权利要求18所述的计算机可读存储介质,其特征在于,所述3D模型为人脸3D模型,所述将所述3D模型按照所述偏转角度进行投影,得到替换图片的步骤,包括:
    将所述人脸图像进行预处理后,输入到训练后的表情识别模型中识别,以获取所述人脸图像的表情;
    获取所述人脸3D模型的第一特征点以及所述表情对应的调整矩阵,其中,表情以及调整矩阵的对应关系是预先设置的;
    将所述第一特征点乘以所述调整矩阵,得到所述第二特征点;
    将所述第二特征点映射在所述人脸3D模型上,控制所述人脸3D模型模拟出所述表情;
    将模拟出所述表情的所述人脸3D模型旋转所述偏转角度的度数后,映射在未旋转时所述人脸3D模型的背面以进行投影,得到替换图片。
  20. 如权利要求18所述的计算机可读存储介质,其特征在于,所述3D模型为人脸3D模型,所述将所述3D模型按照所述偏转角度进行投影,得到替换图片的步骤,包括:
    将所述人脸图像输入到预设的器官识别模型中,得到所述人脸图像中的第一器官;
    将所述第一器官与预设的常态下的第二器官根据色素差建立同样行列数的矩阵,分别得到第一矩阵和第二矩阵;
    将所述第一矩阵减去第二矩阵,得到矩阵差;
    计算所述矩阵差的秩;
    调用预设的秩与面部动作的对应关系,根据所述矩阵差的秩获取所述第一器官对应的面部动作;
    控制所述人脸3D模型的各个器官模拟出所述面部动作;
    将模拟出所述面部动作的所述人脸3D模型旋转所述偏转角度的度数后,映射在未旋转时所述人脸3D模型的背面以进行投影,得到替换图片。
PCT/CN2019/117660 2019-04-16 2019-11-12 基于人脸识别的修改图片的方法、装置和计算机设备 Ceased WO2020211347A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910305175.6 2019-04-16
CN201910305175.6A CN110163814B (zh) 2019-04-16 2019-04-16 基于人脸识别的修改图片的方法、装置和计算机设备

Publications (1)

Publication Number Publication Date
WO2020211347A1 true WO2020211347A1 (zh) 2020-10-22

Family

ID=67639600

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/117660 Ceased WO2020211347A1 (zh) 2019-04-16 2019-11-12 基于人脸识别的修改图片的方法、装置和计算机设备

Country Status (2)

Country Link
CN (1) CN110163814B (zh)
WO (1) WO2020211347A1 (zh)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113486694A (zh) * 2020-10-26 2021-10-08 青岛海信电子产业控股股份有限公司 一种人脸图像处理方法及终端设备
CN113780158A (zh) * 2021-09-08 2021-12-10 宁波书写芯忆科技有限公司 一种智能专注力的检测方法
CN114170123A (zh) * 2021-12-20 2022-03-11 卓米私人有限公司 一种图像处理方法、装置、电子设备及存储介质
WO2023019699A1 (zh) * 2021-08-16 2023-02-23 武汉大学 一种基于3d人脸模型的俯角人脸识别方法及系统
CN116597472A (zh) * 2023-05-05 2023-08-15 普曼(杭州)工业科技有限公司 一种基于视觉ai的焊接生产线安全防护方法
CN116645299A (zh) * 2023-07-26 2023-08-25 中国人民解放军国防科技大学 一种深度伪造视频数据增强方法、装置及计算机设备
CN116708918A (zh) * 2022-05-12 2023-09-05 北京生数科技有限公司 一种视频换脸的处理方法、相关装置及存储介质
CN117974853A (zh) * 2024-03-29 2024-05-03 成都工业学院 同源微表情图像自适应切换生成方法、系统、终端及介质

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110163814B (zh) * 2019-04-16 2024-09-20 平安科技(深圳)有限公司 基于人脸识别的修改图片的方法、装置和计算机设备
CN112785681B (zh) * 2019-11-07 2024-03-08 杭州睿琪软件有限公司 宠物的3d形象生成方法及装置
CN113469043B (zh) * 2021-06-30 2024-10-18 南方科技大学 安全帽佩戴状态检测方法、装置、计算机设备和存储介质
CN116260992A (zh) * 2022-12-30 2023-06-13 世优(北京)科技有限公司 基于视频图像的头部替换的方法及装置
CN117133036B (zh) * 2023-08-28 2026-02-24 中国移动通信集团江苏有限公司 人脸身份识别方法、装置、设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130100227A1 (en) * 2011-10-19 2013-04-25 Hon Hai Precision Industry Co., Ltd. Video communication system and method
CN105893984A (zh) * 2016-04-29 2016-08-24 北京工业大学 一种基于面部特征的脸谱的人脸投影方法
CN107067429A (zh) * 2017-03-17 2017-08-18 徐迪 基于深度学习的人脸三维重建和人脸替换的视频编辑系统及方法
CN108550176A (zh) * 2018-04-19 2018-09-18 咪咕动漫有限公司 图像处理方法、设备及存储介质
CN110163814A (zh) * 2019-04-16 2019-08-23 平安科技(深圳)有限公司 基于人脸识别的修改图片的方法、装置和计算机设备

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100940862B1 (ko) * 2007-12-17 2010-02-09 한국전자통신연구원 3차원 얼굴 애니메이션을 위한 헤드 모션 추적 방법
CN109151540B (zh) * 2017-06-28 2021-11-09 武汉斗鱼网络科技有限公司 视频图像的交互处理方法及装置
CN109376518A (zh) * 2018-10-18 2019-02-22 深圳壹账通智能科技有限公司 基于人脸识别的防止隐私泄露方法及相关设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130100227A1 (en) * 2011-10-19 2013-04-25 Hon Hai Precision Industry Co., Ltd. Video communication system and method
CN105893984A (zh) * 2016-04-29 2016-08-24 北京工业大学 一种基于面部特征的脸谱的人脸投影方法
CN107067429A (zh) * 2017-03-17 2017-08-18 徐迪 基于深度学习的人脸三维重建和人脸替换的视频编辑系统及方法
CN108550176A (zh) * 2018-04-19 2018-09-18 咪咕动漫有限公司 图像处理方法、设备及存储介质
CN110163814A (zh) * 2019-04-16 2019-08-23 平安科技(深圳)有限公司 基于人脸识别的修改图片的方法、装置和计算机设备

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113486694A (zh) * 2020-10-26 2021-10-08 青岛海信电子产业控股股份有限公司 一种人脸图像处理方法及终端设备
WO2023019699A1 (zh) * 2021-08-16 2023-02-23 武汉大学 一种基于3d人脸模型的俯角人脸识别方法及系统
CN113780158A (zh) * 2021-09-08 2021-12-10 宁波书写芯忆科技有限公司 一种智能专注力的检测方法
CN113780158B (zh) * 2021-09-08 2023-10-31 宁波书写芯忆科技有限公司 一种智能专注力的检测方法
CN114170123A (zh) * 2021-12-20 2022-03-11 卓米私人有限公司 一种图像处理方法、装置、电子设备及存储介质
CN116708918A (zh) * 2022-05-12 2023-09-05 北京生数科技有限公司 一种视频换脸的处理方法、相关装置及存储介质
CN116708918B (zh) * 2022-05-12 2024-01-23 北京生数科技有限公司 一种视频换脸的处理方法、相关装置及存储介质
CN116597472A (zh) * 2023-05-05 2023-08-15 普曼(杭州)工业科技有限公司 一种基于视觉ai的焊接生产线安全防护方法
CN116645299A (zh) * 2023-07-26 2023-08-25 中国人民解放军国防科技大学 一种深度伪造视频数据增强方法、装置及计算机设备
CN116645299B (zh) * 2023-07-26 2023-10-10 中国人民解放军国防科技大学 一种深度伪造视频数据增强方法、装置及计算机设备
CN117974853A (zh) * 2024-03-29 2024-05-03 成都工业学院 同源微表情图像自适应切换生成方法、系统、终端及介质
CN117974853B (zh) * 2024-03-29 2024-06-11 成都工业学院 同源微表情图像自适应切换生成方法、系统、终端及介质

Also Published As

Publication number Publication date
CN110163814B (zh) 2024-09-20
CN110163814A (zh) 2019-08-23

Similar Documents

Publication Publication Date Title
WO2020211347A1 (zh) 基于人脸识别的修改图片的方法、装置和计算机设备
WO2023109753A1 (zh) 虚拟角色的动画生成方法及装置、存储介质、终端
CN110136243A (zh) 一种三维人脸重建方法及其系统、装置、存储介质
WO2020103700A1 (zh) 一种基于微表情的图像识别方法、装置以及相关设备
CN111652123B (zh) 图像处理和图像合成方法、装置和存储介质
JP2023548921A (ja) 画像の視線補正方法、装置、電子機器、コンピュータ可読記憶媒体及びコンピュータプログラム
WO2017177259A1 (en) System and method for processing photographic images
CN114202615A (zh) 人脸表情的重建方法、装置、设备和存储介质
CN110163063B (zh) 表情处理方法、装置、计算机可读存储介质和计算机设备
CN114820907B (zh) 人脸图像卡通化处理方法、装置、计算机设备和存储介质
US20250213973A1 (en) Face processing method and apparatus, computer device, and storage medium
CN114494556A (zh) 一种特效渲染方法、装置、设备及存储介质
CN113408452A (zh) 表情重定向训练方法、装置、电子设备和可读存储介质
CN113706430B (zh) 一种图像处理方法、装置和用于图像处理的装置
CN117011449A (zh) 三维面部模型的重构方法和装置、存储介质及电子设备
WO2024240180A1 (zh) 图像处理方法、显示方法及计算设备
CN118411746A (zh) 一种人脸融合方法、系统、电子设备及存储介质
KR102758007B1 (ko) 3차원 가상 캐릭터의 표정모사방법 및 표정모사장치
KR101734212B1 (ko) 표정 연습 시스템
CN115665361B (zh) 虚拟环境中的视频融合方法、装置、电子设备和在线视频会议通信方法
CN112132107B (zh) 图像处理方法、装置、电子设备及计算机可读存储介质
CN118115576A (zh) 图像处理方法、装置及相关设备
JP7175529B1 (ja) 表示装置及び表示方法
CN116129091B (zh) 生成虚拟形象视频的方法及装置、电子设备和存储介质
KR20200071008A (ko) 2차원 이미지 처리 방법 및 이 방법을 실행하는 디바이스

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19924984

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19924984

Country of ref document: EP

Kind code of ref document: A1