CN110415164A - Facial metamorphosis processing method, storage medium, electronic equipment and system - Google Patents

Facial metamorphosis processing method, storage medium, electronic equipment and system Download PDF

Info

Publication number
CN110415164A
CN110415164A CN201810395695.6A CN201810395695A CN110415164A CN 110415164 A CN110415164 A CN 110415164A CN 201810395695 A CN201810395695 A CN 201810395695A CN 110415164 A CN110415164 A CN 110415164A
Authority
CN
China
Prior art keywords
point
value
vec1
vec
abscissa
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201810395695.6A
Other languages
Chinese (zh)
Inventor
李亮
陈少杰
张文明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network 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 Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201810395695.6A priority Critical patent/CN110415164A/en
Publication of CN110415164A publication Critical patent/CN110415164A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/18Image warping, e.g. rearranging pixels individually

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)

Abstract

The invention discloses a kind of Facial metamorphosis processing method, storage medium, electronic equipment and systems, are related to field of video applications, and this method includes based on the key point in face key point technological orientation face picture;Chosen in the key point oriented deformation target point A (x, y) and target point deformation after where coordinate points B (x, y), calculate the vector Vec (x, y) between point A (x, y) and point B (x, y);Calculate the impact factor W of the point D (x, y) of point A (x, y) to point A (x, y) nearby;Calculate the offset vector Vec1 (x, y) of point D (x, y);According to place coordinate points E (x, y) after offset vector calculating point D (x, y) deformation process;Pixel at point E (x, y) is replaced with into the pixel at point D (x, y).The present invention freely can carry out deformation process to human face region.

Description

Facial metamorphosis processing method, storage medium, electronic equipment and system
Technical field
The present invention relates to field of video applications, and in particular to a kind of Facial metamorphosis processing method, storage medium, electronic equipment And system.
Background technique
With the development of internet technology, more and more people like enriching the business life of oneself by viewing live streaming It is living, and be broadcast live in the present age more by the welcome of young man.
Now, during live streaming, substantially at standard configuration, U.S. face is referred to changing by algorithm and be regarded main broadcaster for U.S. face and U.S. type The colour of skin of face in frequency or picture eliminates acne print etc. on face, and U.S. type refers to increasing people in video or picture by algorithm The eyes of object or the shape of face for reducing personage, but existing U.S. face and U.S. type processing mode be only capable of it is automatically right according to preset scheme The face of personage is handled, and flexibility is lower when in use by main broadcaster, causes to experience poor.
Summary of the invention
In view of the deficiencies in the prior art, the purpose of the present invention is to provide a kind of Facial metamorphosis processing methods, certainly By carrying out deformation process to human face region.
To achieve the above objectives, the technical solution adopted by the present invention is that, comprising:
Based on the key point in face key point technological orientation face picture;
Chosen in the key point oriented deformation target point A (x, y) and target point deformation after where coordinate points B (x, Y), the vector Vec (x, y) between point A (x, y) and point B (x, y) is calculated;
Calculate the impact factor W of the point D (x, y) of point A (x, y) to point A (x, y) nearby, calculation are as follows:
W=β/L2
Wherein, L2 be the distance between point D (x, y) and point A (x, y), β be impact factor coefficient, value range for [0.5, 5.0];
Calculate the offset vector Vec1 (x, y) of point D (x, y):
Vec1.x=Vec.x*W
Vec1.y=Vec.y*W
Wherein, Vec1.x is the abscissa value of offset vector, and Vec1.y is the ordinate value of offset vector;
According to place coordinate points E (x, y) after offset vector calculating point D (x, y) deformation process:
E.x=D.x-Vec1.x
E.y=D.y-Vec1.y
Wherein, E.x is the abscissa value of point E (x, y), and the ordinate value of E.y point E (x, y), D.x is the cross of point D (x, y) Coordinate value, the ordinate value of D.y point D (x, y);
Pixel at point E (x, y) is replaced with into the pixel at point D (x, y).
Based on the above technical solution, for vector Vec (x, y), specific formula for calculation are as follows:
Vec.x=B.x-A.x
Vec.y=B.y-A.y
Wherein, Vec.x is the abscissa value of vector Vec (x, y), and Vec.y is the ordinate value of vector Vec (x, y), A.x For the abscissa value of point A (x, y), A.y is the ordinate value of point A (x, y), and B.x is the abscissa value of point B (x, y), and B.y is point B The ordinate value of (x, y).
Based on the above technical solution, for the distance between point D (x, y) and point A (x, y) L2, calculation formula are as follows:
L2=sqr ((A.x-D.x) * (A.x-D.x)+(A.y-D.y) * (A.y-D.y))
Wherein, sqr is evolution function, and A.x is the abscissa value of point A (x, y), and A.y is the ordinate value of point A (x, y).
Based on the above technical solution, for the impact factor W being calculated, value range is [0,1.0], and is worked as When the value for the impact factor W being calculated is greater than 1.0, impact factor W value 1.0, when the value for the impact factor W being calculated is small When 0, impact factor W value 0.
Based on the above technical solution,
Carrying out deformation process to the face picture of video or picture includes the processing of amplification face and the processing of thin face;
When L1 is greater than L, handled for the processing of amplification face when L1 is less than L for thin face, wherein L is point A (x, y) and point The distance between C (x, y), L1 are the distance between point B (x, y) and point C, and point C (x, y) is that the center key point of face nose is sat Mark, L=sqr ((A.x-C.x) * (A.x-C.x)+(A.y-C.y) * (A.y-C.y)), L1=sqr ((B.x-C.x) * (B.x- C.x)+(B.y-C.y) * (B.y-C.y)), sqr is evolution function, and A.x is the abscissa value of point A (x, y), and A.y is point A (x, y) Ordinate value, B.x be point B (x, y) abscissa value, B.y be point B (x, y) ordinate value, C.x for point C (x, y) cross Coordinate value, C.y are the ordinate value of point C (x, y).
The present invention also provides a kind of storage medium, computer program, the computer program are stored on the storage medium It is performed the steps of when being executed by processor
Based on the key point in face key point technological orientation face picture;
Chosen in the key point oriented deformation target point A (x, y) and target point deformation after where coordinate points B (x, Y), the vector Vec (x, y) between point A (x, y) and point B (x, y) is calculated;
Calculate the impact factor W of the point D (x, y) of point A (x, y) to point A (x, y) nearby, calculation are as follows:
W=β/L2
Wherein, L2 be the distance between point D (x, y) and point A (x, y), β be impact factor coefficient, value range for [0.5, 5.0];
Calculate the offset vector Vec1 (x, y) of point D (x, y):
Vec1.x=Vec.x*W
Vec1.y=Vec.y*W
Wherein, Vec1.x is the abscissa value of offset vector, and Vec1.y is the ordinate value of offset vector;
According to place coordinate points E (x, y) after offset vector calculating point D (x, y) deformation process:
E.x=D.x-Vec1.x
E.y=D.y-Vec1.y
Wherein, E.x is the abscissa value of point E (x, y), and the ordinate value of E.y point E (x, y), D.x is the cross of point D (x, y) Coordinate value, the ordinate value of D.y point D (x, y);
Pixel at point E (x, y) is replaced with into the pixel at point D (x, y).
The present invention also provides a kind of electronic equipment, the electronic equipment includes:
First unit, the first unit are used for based on the key point in face key point technological orientation face picture;
Second unit, the second unit are used to choose the target point A (x, y) and mesh of deformation in the key point oriented Coordinate points B (x, y) where after punctuate deformation, calculates the vector Vec (x, y) between point A (x, y) and point B (x, y);
Third unit, the third unit be used to calculate the influence of the point D (x, y) of point A (x, y) nearby to point A (x, y) because Sub- W, calculation are as follows:
W=β/L2
Wherein, L2 be the distance between point D (x, y) and point A (x, y), β be impact factor coefficient, value range for [0.5, 5.0];
Unit the 4th, Unit the 4th are used to calculate the offset vector Vec1 (x, y) of point D (x, y):
Vec1.x=Vec.x*W
Vec1.y=Vec.y*W
Wherein, Vec1.x is the abscissa value of offset vector, and Vec1.y is the ordinate value of offset vector;
Unit the 5th, Unit the 5th are used to calculate place coordinate points after point D (x, y) deformation process according to offset vector E (x, y):
E.x=D.x-Vec1.x
E.y=D.y-Vec1.y
Wherein, E.x is the abscissa value of point E (x, y), and the ordinate value of E.y point E (x, y), D.x is the cross of point D (x, y) Coordinate value, the ordinate value of D.y point D (x, y);
Unit the 6th, Unit the 6th are used to replacing with the pixel at point E (x, y) into the pixel at point D (x, y).
The present invention also provides a kind of Facial metamorphosis processing systems, comprising:
Key point locating module is used for based on the key point in face key point technological orientation face picture;
Vector calculation module, the target point A (x, y) and target point for being used to choose deformation in the key point oriented become Coordinate points B (x, y) where after shape, calculates the vector Vec (x, y) between point A (x, y) and point B (x, y);
Impact factor computing module is used to calculate the impact factor of the point D (x, y) of point A (x, y) nearby to point A (x, y) W, calculation are as follows:
W=β/L2
Wherein, L2 be the distance between point D (x, y) and point A (x, y), β be impact factor coefficient, value range for [0.5, 5.0];
Offset vector computing module is used to calculate the offset vector Vec1 (x, y) of point D (x, y):
Vec1.x=Vec.x*W
Vec1.y=Vec.y*W
Wherein, Vec1.x is the abscissa value of offset vector, and Vec1.y is the ordinate value of offset vector;
Deform execution module, be used to be calculated according to offset vector place coordinate points E after point D (x, y) deformation process (x, Y), the pixel at point E (x, y) is then replaced with to the pixel at point D (x, y), in which:
E.x=D.x-Vec1.x
E.y=D.y-Vec1.y
E.x is the abscissa value of point E (x, y), and the ordinate value of E.y point E (x, y), D.x is the abscissa of point D (x, y) Value, the ordinate value of D.y point D (x, y).
Based on the above technical solution, for vector Vec (x, y), specific formula for calculation are as follows:
Vec.x=B.x-A.x
Vec.y=B.y-A.y
Wherein, Vec.x is the abscissa value of vector Vec (x, y), and Vec.y is the ordinate value of vector Vec (x, y), A.x For the abscissa value of point A (x, y), A.y is the ordinate value of point A (x, y), and B.x is the abscissa value of point B (x, y), and B.y is point B The ordinate value of (x, y).
Based on the above technical solution, for the distance between point D (x, y) and point A (x, y) L2, calculation formula are as follows:
L2=sqr ((A.x-D.x) * (A.x-D.x)+(A.y-D.y) * (A.y-D.y))
Wherein, sqr is evolution function, and A.x is the abscissa value of point A (x, y), and A.y is the ordinate value of point A (x, y).
Compared with the prior art, the advantages of the present invention are as follows: selection target point, the face that artificial unrestricted choice need to deform Position, while the location of the point coordinate that target point attachment after deformation is calculated based on vector sum offset vector, complete people Face deformation, and freely deformation extent can be selected, strong flexibility, freedom degree is high, increases the interest of live content.
Detailed description of the invention
Fig. 1 is a kind of flow chart of Facial metamorphosis processing method in the embodiment of the present invention;
Fig. 2 is the structural schematic diagram of a kind of electronic equipment in the embodiment of the present invention.
Specific embodiment
Invention is further described in detail with reference to the accompanying drawings and embodiments.
Shown in Figure 1, the embodiment of the present invention provides a kind of Facial metamorphosis processing method, for in video or picture Face picture carries out deformation process, and especially in live streaming field, main broadcaster uses the Facial metamorphosis processing method of the embodiment of the present invention, Deformation process is carried out to itself face, arbitrarily stretches face, the positions such as zoom eyes, mouth, nose, uglify face or Face is carried out exaggeration processing by person, thus to increase the interest of live content.The Facial metamorphosis processing side of the embodiment of the present invention Method, specifically includes the following steps:
S1: based on the key point in face key point technological orientation face picture.It such as needs to become face in video When shape processing, then using the key point of face in face key point technological orientation video, if you need to become to the face in picture When shape processing, then using the key point of face in face key point technological orientation picture.Gone out by face key point technological orientation Key point in face picture, be subsequent Amoebida punctuate, target point deformation recoil punctuate, face picture cheek key point, The selection of the key points such as face picture nose key point or target point provides reference.Face key point technology can be nowadays to answer With the crucial 68 point location technologies of more mature face, face key point technology can orient in real time cheek, eyes, eyebrow, The position of the key points such as mouth, chin, nose.
S2: chosen in the key point oriented deformation target point A (x, y) and target point deformation after where coordinate points B (x, y) calculates the vector Vec (x, y) between point A (x, y) and point B (x, y).I.e. firstly the need of the position artificially deformed to needs It is chosen, and chooses locating point position after deformation, such as need to reduce cheek, then needed to choose in face picture at cheek Point a, then some point b, this time point a again between selected point a and nose are exactly the target point chosen, and point b is that target point becomes Coordinate points where after shape, if desired amplification stretches cheek, then needs to choose the point c in face picture at cheek, then choose again Some point d, this time point c of the side point c and separate nose are exactly the target point chosen, and point d is place coordinate after target point deformation Point, accordingly if you need to carry out stretching enhanced processing to eyes, then the target point chosen is the coordinate points at eyes.By choosing mesh Coordinate points where after punctuate and target point deformation, are to be draw textured processing or contracting to some position of face with determination Small deformation processing.
For vector Vec (x, y), specific formula for calculation are as follows:
Vec.x=B.x-A.x
Vec.y=B.y-A.y
Wherein, Vec.x is the abscissa value of vector Vec (x, y), and Vec.y is the ordinate value of vector Vec (x, y), A.x For the abscissa value of point A (x, y), A.y is the ordinate value of point A (x, y), and B.x is the abscissa value of point B (x, y), and B.y is point B The ordinate value of (x, y).
Carrying out deformation process to the face picture of video or image includes the processing of amplification face and the processing of thin face;When L1 is greater than When L, for amplification face processing, when L1 be less than L when, for thin face handle, wherein L between point A (x, y) and point C (x, y) away from From L1 is the distance between point B (x, y) and point C, and point C (x, y) is the center key point coordinate of face nose, L=sqr ((A.x-C.x) * (A.x-C.x)+(A.y-C.y) * (A.y-C.y)), L1=sqr ((B.x-C.x) * (B.x-C.x)+(B.y- C.y) * (B.y-C.y)), sqr is evolution function, and C.x is the abscissa value of point C (x, y), and C.y is the ordinate of point C (x, y) Value.By place coordinate points after selection target point and target point deformation, so that stretching or diminution processing flexibly are carried out to face, Strong applicability, flexibility ratio are high.
S3: the impact factor W of the point D (x, y) of point A (x, y) to point A (x, y) nearby, calculation are calculated are as follows:
W=β/L2
Wherein, L2 be the distance between point D (x, y) and point A (x, y), β be impact factor coefficient, value range for [0.5, 5.0].For the distance between point D (x, y) and point A (x, y) L2, calculation formula are as follows: L2=sqr ((A.x-D.x) * (A.x- D.x)+(A.y-D.y)*(A.y-D.y))。
Impact factor W is not only related with impact factor coefficient, the distance dependent between putting also and near target point and target point, Impact factor W is directly proportional to impact factor factor beta, is inversely proportional with distance L2, and impact factor is bigger, then influence of the point A to point D be just Bigger, impact factor is smaller, then with regard to smaller, L2 is bigger for influence of the point A to point D, and with regard to smaller, L2 is smaller for influence of the point A to point D, Influence of the point A to point D is bigger.In the application, according to the actual situation, the value range of β is [0.5,5.0], is avoided because of β too Small, face cheek deformation effect is unobvious, and β is too big, and face facial deformations effect is excessively exaggerated, and guarantees at the deformation effect of face In in an acceptable zone of reasonableness.
The value of impact factor factor beta is affected to final impact factor W, if the value range of β is excessive, can make The value of impact factor W is crossed the border, therefore for impact factor W, value range is [0,1.0], guarantees that Facial metamorphosis is in reasonable In range, and when the value for the impact factor W being calculated is greater than 1.0, impact factor W value 1.0, when the influence being calculated When the value of factor W is less than 0, impact factor W value 0, impact factor W calculated result then takes and is actually calculated in [0,1.0] Value.
S4: the offset vector Vec1 (x, y) of point D (x, y) is calculated:
Vec1.x=Vec.x*W
Vec1.y=Vec.y*W
Wherein, Vec1.x is the abscissa value of offset vector, and Vec1.y is the ordinate value of offset vector;
S5: according to place coordinate points E (x, y) after offset vector calculating point D (x, y) deformation process:
E.x=D.x-Vec1.x
E.y=D.y-Vec1.y
Wherein, E.x is the abscissa value of point E (x, y), and the ordinate value of E.y point E (x, y), D.x is the cross of point D (x, y) Coordinate value, the ordinate value of D.y point D (x, y).So far coordinate the location of has just been obtained after the point deformation near target point, Calculating coordinate locating after all point deformation near target point, can be attached to target point after choosing target point in practical operation Close point carries out deformation process together, point locating after deforming is calculated, therefore deformation is near selected target point One piece of region carry out deformation process, for the point near target point, by artificially carrying out Definition of Division, with determine deformation region Size.
S6: the pixel at point E (x, y) is replaced with into the pixel at point D (x, y), that is, by the picture at point D (x, y) Element is moved at point E (x, y).According to the method described above, point locating after all point deformation is calculated near target point, and will Locating point pixel replaces with the corresponding pixel that target point is nearby put before after deformation, completes deformation, shows final people Face deformation effect.
For above-mentioned Facial metamorphosis processing method, total Facial metamorphosis formula is D=S*I, wherein S is the image of input, I is the algorithm of the Facial metamorphosis processing method of the embodiment of the present invention, and D is Face Changing treated result images.
The Facial metamorphosis processing method of the embodiment of the present invention, selection target point, the face that artificial unrestricted choice need to deform Position, while the location of the point coordinate that target point attachment after deformation is calculated based on vector sum offset vector, complete people Face deformation, and freely deformation extent can be selected, strong flexibility, freedom degree is high, increases the interest of live content.
In addition, corresponding above-mentioned Facial metamorphosis processing method stores on storage medium the present invention also provides a kind of storage medium There is computer program, is performed the steps of when computer program is executed by processor
Based on the key point in face key point technological orientation face picture;
Chosen in the key point oriented deformation target point A (x, y) and target point deformation after where coordinate points B (x, Y), the vector Vec (x, y) between point A (x, y) and point B (x, y) is calculated;
Calculate the impact factor W of the point D (x, y) of point A (x, y) to point A (x, y) nearby, calculation are as follows:
W=β/L2
Wherein, L2 be the distance between point D (x, y) and point A (x, y), β be impact factor coefficient, value range for [0.5, 5.0];
Calculate the offset vector Vec1 (x, y) of point D (x, y):
Vec1.x=Vec.x*W
Vec1.y=Vec.y*W
Wherein, Vec1.x is the abscissa value of offset vector, and Vec1.y is the ordinate value of offset vector;
According to place coordinate points E (x, y) after offset vector calculating point D (x, y) deformation process:
E.x=D.x-Vec1.x
E.y=D.y-Vec1.y
Wherein, E.x is the abscissa value of point E (x, y), and the ordinate value of E.y point E (x, y), D.x is the cross of point D (x, y) Coordinate value, the ordinate value of D.y point D (x, y);
Pixel at point E (x, y) is replaced with into the pixel at point D (x, y).
It should be noted that the storage medium include USB flash disk, mobile hard disk, ROM (Read-Only Memory, it is read-only to deposit Reservoir), RAM (Random Access Memory, random access memory), magnetic or disk etc. is various can store program The medium of code.
Shown in Figure 2, corresponding above-mentioned Facial metamorphosis processing method, the present invention also provides a kind of electronic equipment, comprising:
First unit, the first unit are used for based on the key point in face key point technological orientation face picture;
Second unit, the second unit are used to choose the target point A (x, y) and mesh of deformation in the key point oriented Coordinate points B (x, y) where after punctuate deformation, calculates the vector Vec (x, y) between point A (x, y) and point B (x, y);
Third unit, the third unit be used to calculate the influence of the point D (x, y) of point A (x, y) nearby to point A (x, y) because Sub- W, calculation are as follows:
W=β/L2
Wherein, L2 be the distance between point D (x, y) and point A (x, y), β be impact factor coefficient, value range for [0.5, 5.0];
Unit the 4th, Unit the 4th are used to calculate the offset vector Vec1 (x, y) of point D (x, y):
Vec1.x=Vec.x*W
Vec1.y=Vec.y*W
Wherein, Vec1.x is the abscissa value of offset vector, and Vec1.y is the ordinate value of offset vector;
Unit the 5th, Unit the 5th are used to calculate place coordinate points after point D (x, y) deformation process according to offset vector E (x, y):
E.x=D.x-Vec1.x
E.y=D.y-Vec1.y
Wherein, E.x is the abscissa value of point E (x, y), and the ordinate value of E.y point E (x, y), D.x is the cross of point D (x, y) Coordinate value, the ordinate value of D.y point D (x, y);
Unit the 6th, Unit the 6th are used to replacing with the pixel at point E (x, y) into the pixel at point D (x, y).
The invention also discloses a kind of Facial metamorphosis processing systems based on above-mentioned Facial metamorphosis processing method, including positioning Key point locating module, vector calculation module, impact factor computing module, offset vector computing module and deformation execution module.
Key point locating module is used for based on the key point in face key point technological orientation face picture;Vector calculates mould Block be used for chosen in the key point oriented deformation target point A (x, y) and target point deformation after place coordinate points B (x, y), Calculate the vector Vec (x, y) between point A (x, y) and point B (x, y);Impact factor computing module is for calculating point A (x, y) to point The impact factor W of the point D (x, y) of A (x, y) nearby, calculation are as follows:
W=β/L2
Wherein, L2 be the distance between point D (x, y) and point A (x, y), β be impact factor coefficient, value range for [0.5, 5.0]。
Offset vector computing module is used to calculate the offset vector Vec1 (x, y) of point D (x, y):
Vec1.x=Vec.x*W
Vec1.y=Vec.y*W
Wherein, Vec1.x is the abscissa value of offset vector, and Vec1.y is the ordinate value of offset vector;
It deforms execution module and is used to calculate place coordinate points E (x, y) after point D (x, y) deformation process according to offset vector, so Pixel at point E (x, y) is replaced with to the pixel at point D (x, y) afterwards, in which:
E.x=D.x-Vec1.x
E.y=D.y-Vec1.y
E.x is the abscissa value of point E (x, y), and the ordinate value of E.y point E (x, y), D.x is the abscissa of point D (x, y) Value, the ordinate value of D.y point D (x, y).
For vector Vec (x, y), specific formula for calculation are as follows:
Vec.x=B.x-A.x
Vec.y=B.y-A.y
Wherein, Vec.x is the abscissa value of vector Vec (x, y), and Vec.y is the ordinate value of vector Vec (x, y), A.x For the abscissa value of point A (x, y), A.y is the ordinate value of point A (x, y), and B.x is the abscissa value of point B (x, y), and B.y is point B The ordinate value of (x, y).
For the distance between point D (x, y) and point A (x, y) L2, calculation formula are as follows:
L2=sqr ((A.x-D.x) * (A.x-D.x)+(A.y-D.y) * (A.y-D.y))
Wherein, sqr is evolution function, and A.x is the abscissa value of point A (x, y), and A.y is the ordinate value of point A (x, y).
The Facial metamorphosis processing system of the embodiment of the present invention, selection target point, the face that artificial unrestricted choice need to deform Position, while the location of the point coordinate that target point attachment after deformation is calculated based on vector sum offset vector, complete people Face deformation, and freely deformation extent can be selected, strong flexibility, freedom degree is high, increases the interest of live content.
The present invention is not limited to the above-described embodiments, for those skilled in the art, is not departing from Under the premise of the principle of the invention, several improvements and modifications can also be made, these improvements and modifications are also considered as protection of the invention Within the scope of.The content being not described in detail in this specification belongs to the prior art well known to professional and technical personnel in the field.

Claims (10)

1. a kind of Facial metamorphosis processing method, which is characterized in that deformation process is carried out for the face picture to video or picture, The following steps are included:
Based on the key point in face key point technological orientation face picture;
Chosen in the key point oriented deformation target point A (x, y) and target point deformation after where coordinate points B (x, y), meter Calculate the vector Vec (x, y) between point A (x, y) and point B (x, y);
Calculate the impact factor W of the point D (x, y) of point A (x, y) to point A (x, y) nearby, calculation are as follows:
W=β/L2
Wherein, L2 be the distance between point D (x, y) and point A (x, y), β be impact factor coefficient, value range for [0.5, 5.0];
Calculate the offset vector Vec1 (x, y) of point D (x, y):
Vec1.x=Vec.x*W
Vec1.y=Vec.y*W
Wherein, Vec1.x is the abscissa value of offset vector, and Vec1.y is the ordinate value of offset vector;
According to place coordinate points E (x, y) after offset vector calculating point D (x, y) deformation process:
E.x=D.x-Vec1.x
E.y=D.y-Vec1.y
Wherein, E.x is the abscissa value of point E (x, y), and the ordinate value of E.y point E (x, y), D.x is the abscissa of point D (x, y) Value, the ordinate value of D.y point D (x, y);
Pixel at point E (x, y) is replaced with into the pixel at point D (x, y).
2. a kind of Facial metamorphosis processing method as described in claim 1, it is characterised in that: for vector Vec (x, y), specifically Calculation formula are as follows:
Vec.x=B.x-A.x
Vec.y=B.y-A.y
Wherein, Vec.x is the abscissa value of vector Vec (x, y), and Vec.y is the ordinate value of vector Vec (x, y), and A.x is point A The abscissa value of (x, y), A.y are the ordinate value of point A (x, y), and B.x is the abscissa value of point B (x, y), and B.y is point B (x, y) Ordinate value.
3. a kind of Facial metamorphosis processing method as described in claim 1, it is characterised in that: for point D (x, y) and point A (x, y) The distance between L2, calculation formula are as follows:
L2=sqr ((A.x-D.x) * (A.x-D.x)+(A.y-D.y) * (A.y-D.y))
Wherein, sqr is evolution function, and A.x is the abscissa value of point A (x, y), and A.y is the ordinate value of point A (x, y).
4. a kind of Facial metamorphosis processing method as described in claim 1, it is characterised in that: for the impact factor being calculated W, value range are [0,1.0], and when the value for the impact factor W being calculated is greater than 1.0, impact factor W value 1.0, when When the value for the impact factor W being calculated is less than 0, impact factor W value 0.
5. a kind of Facial metamorphosis processing method as described in claim 1, it is characterised in that:
Carrying out deformation process to the face picture of video or picture includes the processing of amplification face and the processing of thin face;
When L1 is greater than L, handled for the processing of amplification face when L1 is less than L for thin face, wherein L be point A (x, y) and point C (x, The distance between y), L1 is the distance between point B (x, y) and point C, and point C (x, y) is the center key point coordinate of face nose, L =sqr ((A.x-C.x) * (A.x-C.x)+(A.y-C.y) * (A.y-C.y)), L1=sqr ((B.x-C.x) * (B.x-C.x)+ (B.y-C.y) * (B.y-C.y)), sqr is evolution function, and A.x is the abscissa value of point A (x, y), and A.y is the vertical of point A (x, y) Coordinate value, B.x are the abscissa value of point B (x, y), and B.y is the ordinate value of point B (x, y), and C.x is the abscissa of point C (x, y) Value, C.y are the ordinate value of point C (x, y).
6. a kind of storage medium, computer program is stored on the storage medium, it is characterised in that: the computer program is located Reason device performs the steps of when executing
Based on the key point in face key point technological orientation face picture;
Chosen in the key point oriented deformation target point A (x, y) and target point deformation after where coordinate points B (x, y), meter Calculate the vector Vec (x, y) between point A (x, y) and point B (x, y);
Calculate the impact factor W of the point D (x, y) of point A (x, y) to point A (x, y) nearby, calculation are as follows:
W=β/L2
Wherein, L2 be the distance between point D (x, y) and point A (x, y), β be impact factor coefficient, value range for [0.5, 5.0];
Calculate the offset vector Vec1 (x, y) of point D (x, y):
Vec1.x=Vec.x*W
Vec1.y=Vec.y*W
Wherein, Vec1.x is the abscissa value of offset vector, and Vec1.y is the ordinate value of offset vector;
According to place coordinate points E (x, y) after offset vector calculating point D (x, y) deformation process:
E.x=D.x-Vec1.x
E.y=D.y-Vec1.y
Wherein, E.x is the abscissa value of point E (x, y), and the ordinate value of E.y point E (x, y), D.x is the abscissa of point D (x, y) Value, the ordinate value of D.y point D (x, y);
Pixel at point E (x, y) is replaced with into the pixel at point D (x, y).
7. a kind of electronic equipment, which is characterized in that the electronic equipment includes:
First unit, the first unit are used for based on the key point in face key point technological orientation face picture;
Second unit, the second unit are used to choose the target point A (x, y) and target point of deformation in the key point oriented Coordinate points B (x, y) where after deformation, calculates the vector Vec (x, y) between point A (x, y) and point B (x, y);
Third unit, the third unit are used to calculate the impact factor W of the point D (x, y) of point A (x, y) nearby to point A (x, y), Calculation are as follows:
W=β/L2
Wherein, L2 be the distance between point D (x, y) and point A (x, y), β be impact factor coefficient, value range for [0.5, 5.0];
Unit the 4th, Unit the 4th are used to calculate the offset vector Vec1 (x, y) of point D (x, y):
Vec1.x=Vec.x*W
Vec1.y=Vec.y*W
Wherein, Vec1.x is the abscissa value of offset vector, and Vec1.y is the ordinate value of offset vector;
Unit the 5th, Unit the 5th be used to be calculated according to offset vector place coordinate points E after point D (x, y) deformation process (x, Y):
E.x=D.x-Vec1.x
E.y=D.y-Vec1.y
Wherein, E.x is the abscissa value of point E (x, y), and the ordinate value of E.y point E (x, y), D.x is the abscissa of point D (x, y) Value, the ordinate value of D.y point D (x, y);
Unit the 6th, Unit the 6th are used to replacing with the pixel at point E (x, y) into the pixel at point D (x, y).
8. a kind of Facial metamorphosis processing system characterized by comprising
Key point locating module is used for based on the key point in face key point technological orientation face picture;
Vector calculation module, after being used to choose target point A (x, y) and the target point deformation of deformation in the key point oriented Place coordinate points B (x, y) calculates the vector Vec (x, y) between point A (x, y) and point B (x, y);
Impact factor computing module is used to calculate the impact factor W of the point D (x, y) of point A (x, y) nearby to point A (x, y), meter Calculation mode are as follows:
W=β/L2
Wherein, L2 be the distance between point D (x, y) and point A (x, y), β be impact factor coefficient, value range for [0.5, 5.0];
Offset vector computing module is used to calculate the offset vector Vec1 (x, y) of point D (x, y):
Vec1.x=Vec.x*W
Vec1.y=Vec.y*W
Wherein, Vec1.x is the abscissa value of offset vector, and Vec1.y is the ordinate value of offset vector;
Execution module is deformed, is used to calculate place coordinate points E (x, y) after point D (x, y) deformation process according to offset vector, so Pixel at point E (x, y) is replaced with to the pixel at point D (x, y) afterwards, in which:
E.x=D.x-Vec1.x
E.y=D.y-Vec1.y
E.x is the abscissa value of point E (x, y), and the ordinate value of E.y point E (x, y), D.x is the abscissa value of point D (x, y), D.y The ordinate value of point D (x, y).
9. a kind of Facial metamorphosis processing system as claimed in claim 8, it is characterised in that: for vector Vec (x, y), specifically Calculation formula are as follows:
Vec.x=B.x-A.x
Vec.y=B.y-A.y
Wherein, Vec.x is the abscissa value of vector Vec (x, y), and Vec.y is the ordinate value of vector Vec (x, y), and A.x is point A The abscissa value of (x, y), A.y are the ordinate value of point A (x, y), and B.x is the abscissa value of point B (x, y), and B.y is point B (x, y) Ordinate value.
10. a kind of Facial metamorphosis processing system as claimed in claim 8, it is characterised in that: for point D (x, y) and point A (x, The distance between y) L2, calculation formula are as follows:
L2=sqr ((A.x-D.x) * (A.x-D.x)+(A.y-D.y) * (A.y-D.y))
Wherein, sqr is evolution function, and A.x is the abscissa value of point A (x, y), and A.y is the ordinate value of point A (x, y).
CN201810395695.6A 2018-04-27 2018-04-27 Facial metamorphosis processing method, storage medium, electronic equipment and system Pending CN110415164A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810395695.6A CN110415164A (en) 2018-04-27 2018-04-27 Facial metamorphosis processing method, storage medium, electronic equipment and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810395695.6A CN110415164A (en) 2018-04-27 2018-04-27 Facial metamorphosis processing method, storage medium, electronic equipment and system

Publications (1)

Publication Number Publication Date
CN110415164A true CN110415164A (en) 2019-11-05

Family

ID=68346889

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810395695.6A Pending CN110415164A (en) 2018-04-27 2018-04-27 Facial metamorphosis processing method, storage medium, electronic equipment and system

Country Status (1)

Country Link
CN (1) CN110415164A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112509005A (en) * 2020-12-10 2021-03-16 北京达佳互联信息技术有限公司 Image processing method, image processing device, electronic equipment and storage medium
CN114296622A (en) * 2020-09-23 2022-04-08 北京达佳互联信息技术有限公司 Image processing method, image processing device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011233073A (en) * 2010-04-30 2011-11-17 Omron Corp Image deformation device, electronic equipment, image deformation method and image deformation program
CN105096353A (en) * 2014-05-05 2015-11-25 腾讯科技(深圳)有限公司 Image processing method and device
CN105956997A (en) * 2016-04-27 2016-09-21 腾讯科技(深圳)有限公司 Image deformation treatment method and device
CN106373095A (en) * 2016-08-29 2017-02-01 广东欧珀移动通信有限公司 Image processing method and terminal

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011233073A (en) * 2010-04-30 2011-11-17 Omron Corp Image deformation device, electronic equipment, image deformation method and image deformation program
CN105096353A (en) * 2014-05-05 2015-11-25 腾讯科技(深圳)有限公司 Image processing method and device
CN105956997A (en) * 2016-04-27 2016-09-21 腾讯科技(深圳)有限公司 Image deformation treatment method and device
CN106373095A (en) * 2016-08-29 2017-02-01 广东欧珀移动通信有限公司 Image processing method and terminal

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114296622A (en) * 2020-09-23 2022-04-08 北京达佳互联信息技术有限公司 Image processing method, image processing device, electronic equipment and storage medium
CN114296622B (en) * 2020-09-23 2023-08-08 北京达佳互联信息技术有限公司 Image processing method, device, electronic equipment and storage medium
CN112509005A (en) * 2020-12-10 2021-03-16 北京达佳互联信息技术有限公司 Image processing method, image processing device, electronic equipment and storage medium
WO2022121577A1 (en) * 2020-12-10 2022-06-16 北京达佳互联信息技术有限公司 Image processing method and apparatus
CN112509005B (en) * 2020-12-10 2023-01-20 北京达佳互联信息技术有限公司 Image processing method, image processing device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN108596024B (en) Portrait generation method based on face structure information
CN110555796B (en) Image adjusting method, device, storage medium and equipment
CN106919906B (en) Image interaction method and interaction device
CN110418146A (en) Method of changing face, storage medium, electronic equipment and system applied to live scene
CN102567716B (en) Face synthetic system and implementation method
CN105447823A (en) Image processing method and electronic device
CN110415164A (en) Facial metamorphosis processing method, storage medium, electronic equipment and system
CN111985268A (en) Method and device for driving animation by human face
CN109302628A (en) A kind of face processing method based on live streaming, device, equipment and storage medium
CN107610239A (en) The virtual try-in method and device of a kind of types of facial makeup in Beijing operas
CN111833257A (en) Video dynamic face changing method and device, computer equipment and storage medium
CN110910512B (en) Virtual object self-adaptive adjustment method, device, computer equipment and storage medium
CN111652795A (en) Face shape adjusting method, face shape adjusting device, live broadcast method, live broadcast device, electronic equipment and storage medium
CN110910308A (en) Image processing method, apparatus, device and medium
CN110415168B (en) Face local scaling processing method, storage medium, electronic device and system
CN112507766B (en) Face image extraction method, storage medium and terminal equipment
WO2023103813A1 (en) Image processing method and apparatus, device, storage medium, and program product
CN108171671B (en) Beautifying method and device for enlarging eye
CN114140828B (en) Real-time lightweight 2D human body posture estimation method
CN111652023B (en) Mouth-type adjustment and live broadcast method and device, electronic equipment and storage medium
CN111652792A (en) Image local processing method, image live broadcasting method, image local processing device, image live broadcasting equipment and storage medium
CN112785490B (en) Image processing method and device and electronic equipment
CN110020982B (en) Cheek automatic beautifying method, storage medium, electronic device and system
CN113379623A (en) Image processing method, image processing device, electronic equipment and storage medium
CN108833771A (en) A kind of portrait patterned lines generation method, system and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20191105

RJ01 Rejection of invention patent application after publication