CN116109479B - Face adjusting method, device, computer equipment and storage medium for virtual image - Google Patents

Face adjusting method, device, computer equipment and storage medium for virtual image Download PDF

Info

Publication number
CN116109479B
CN116109479B CN202310403246.2A CN202310403246A CN116109479B CN 116109479 B CN116109479 B CN 116109479B CN 202310403246 A CN202310403246 A CN 202310403246A CN 116109479 B CN116109479 B CN 116109479B
Authority
CN
China
Prior art keywords
adjusted
key point
profile
contour
target
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
CN202310403246.2A
Other languages
Chinese (zh)
Other versions
CN116109479A (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.)
Guangzhou Quwan Network Technology Co Ltd
Original Assignee
Guangzhou Quwan 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 Guangzhou Quwan Network Technology Co Ltd filed Critical Guangzhou Quwan Network Technology Co Ltd
Priority to CN202310403246.2A priority Critical patent/CN116109479B/en
Publication of CN116109479A publication Critical patent/CN116109479A/en
Application granted granted Critical
Publication of CN116109479B publication Critical patent/CN116109479B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/04Context-preserving transformations, e.g. by using an importance map
    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/42Global feature extraction by analysis of the whole pattern, e.g. using frequency domain transformations or autocorrelation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/44Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/168Feature extraction; Face representation
    • G06V40/171Local features and components; Facial parts ; Occluding parts, e.g. glasses; Geometrical relationships
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

The application provides a face adjusting method, a face adjusting device, computer equipment and a storage medium of an avatar. The method comprises the following steps: identifying the mandibular profile of the image to be adjusted; determining a midpoint and two endpoints of the mandibular profile; for any one endpoint, determining the circle center corresponding to the half profile to be adjusted according to the positions of the endpoint and the midpoint and the target radius; the half profile to be adjusted is a profile between the end point and the middle point in the mandibular profile; according to the circle center and the target radius, adjusting the corresponding half profile to be adjusted to obtain a target half profile; and stretching the mandible of the image to be adjusted according to each target semi-contour. The method can beautify the automatically generated virtual image quickly and efficiently, change the virtual image with the over-sharp mandibular angle into a form which is more in line with the preference of the user, and improve the experience of the user when using the related application.

Description

Face adjusting method, device, computer equipment and storage medium for virtual image
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to a method and apparatus for adjusting a face of an avatar, a computer device, and a storage medium.
Background
With the popularity of network social media and the arrival of big data age, various fashion elements derived based on computer technology are increasingly abundant, and cartoon virtual images are favored by vast users, and have wide application in the fields of social, game, film and television, entertainment and the like. Many applications can automatically generate an avatar according to a user's own avatar or a user's demand through an AI (Artificial Intelligence) algorithm. However, the face of the avatar generated by the traditional method sometimes has an excessively thin face, and the mandible is in an inverted triangle shape, i.e. the automatically generated avatar has the problem that the face is unnatural and is difficult to meet the requirements of users.
Disclosure of Invention
The object of the present application is to solve at least one of the above technical drawbacks, in particular the problem of the prior art that the automatically generated avatar is not natural enough.
In a first aspect, an embodiment of the present application provides a face adjustment method for an avatar, including:
identifying the mandibular profile of the image to be adjusted;
determining a midpoint and two endpoints of the mandibular profile;
for any one endpoint, determining the circle center corresponding to the half profile to be adjusted according to the positions of the endpoint and the midpoint and the target radius; the half profile to be adjusted is the profile between the end point and the middle point of the mandibular profile;
according to the circle center and the target radius, adjusting the corresponding half profile to be adjusted to obtain a target half profile;
and stretching the mandible of the image to be adjusted according to each target semi-contour.
In one embodiment, the to-be-adjusted half profile includes a plurality of first key points, and the adjusting the corresponding to-be-adjusted half profile according to the circle center and the target radius to obtain the target half profile includes:
for each first key point, determining a unit vector corresponding to the first key point according to the circle center and the position of the first key point; the direction of the unit vector points to the first key point from the circle center;
obtaining an adjustment vector corresponding to the first key point according to the unit vector and the target radius;
obtaining a second key point corresponding to the first key point according to the adjustment vector and the first key point;
and obtaining the target half profile according to each second key point.
In one embodiment, before obtaining the second key point corresponding to the first key point according to the adjustment vector and the first key point, the method further includes:
for one of the half contours to be adjusted, generating basic attenuation coefficients corresponding to the first key points one by one at equal intervals between the lower limit of the basic attenuation coefficient and the upper limit of the basic attenuation coefficient, and obtaining a basic attenuation coefficient set corresponding to the half contour to be adjusted; wherein, the larger the basic attenuation coefficient corresponding to the first key point which is closer to the midpoint is;
symmetrically overturning the basic attenuation coefficient set to obtain a basic attenuation coefficient set corresponding to another half profile to be adjusted;
according to the adjustment vector and the first key point, obtaining a second key point corresponding to the first key point comprises the following steps:
attenuation adjustment vectors are carried out according to the corresponding basic attenuation coefficients;
and obtaining a second key point according to the attenuated adjustment vector and the first key point.
In one embodiment, before symmetrically inverting the set of base attenuation coefficients, the method further comprises:
and carrying out smoothing treatment on the basic attenuation coefficient set, and carrying out normalization treatment on the basic attenuation coefficient set after the smoothing treatment.
In one embodiment, before obtaining the second keypoint corresponding to the first keypoint according to the adjustment vector and the first keypoint, the method further includes:
and attenuating each basic attenuation coefficient set by utilizing the quadratic attenuation coefficient.
In one embodiment, the target radius is determined by:
the target radius is determined based on the distance between the two endpoints.
In one embodiment, identifying a mandibular profile of an avatar to be adjusted includes:
determining a face area of the image to be adjusted, and obtaining a full face contour according to the face area;
determining the positions of the eyes in the face area, and obtaining a dividing line according to the positions of the eyes;
and acquiring the lower half part of the full-face outline according to the dividing line to obtain the mandibular outline.
In a second aspect, embodiments of the present application further provide a facial adjustment apparatus for an avatar, including:
the identification module is used for identifying the mandible outline of the image to be adjusted;
the reference point determining module is used for determining the midpoint and two endpoints of the mandibular outline;
the circle center determining module is used for determining the circle center corresponding to the half profile to be adjusted according to the positions of the endpoints and the midpoint and the target radius for any one endpoint; the half profile to be adjusted is the profile between the end point and the middle point of the mandibular profile;
the profile adjustment module is used for adjusting the corresponding half profile to be adjusted according to the circle center and the target radius to obtain a target half profile;
and the facial adjusting module is used for stretching the mandible of the image to be adjusted according to each target semi-contour.
In a third aspect, embodiments of the present application further provide a computer device including one or more processors, and a memory having stored therein computer readable instructions that, when executed by the one or more processors, perform the method steps of facial adjustment of an avatar in any of the embodiments described above.
In a fourth aspect, embodiments of the present application further provide a storage medium having stored therein computer readable instructions which, when executed by one or more processors, perform the steps of the method for facial adjustment of an avatar in any of the embodiments described above.
From the above technical solutions, the embodiments of the present application have the following advantages:
based on any of the above embodiments, the mandibular profile is divided into symmetrical half-profiles to be adjusted, bounded by the midpoint of the mandibular profile. And respectively determining the circle center corresponding to each half contour to be adjusted, wherein the radius of the circle where the circle center is located is a target radius, taking the circular arcs corresponding to the end points and the middle points of the mandibular contour on the circle as adjustment references, and adjusting the half contour to be adjusted into a more round target half contour. And finally, stretching the mandible of the image to be adjusted according to the target half contour to obtain the virtual image with more natural and attractive effect. The method can beautify the automatically generated virtual image quickly and efficiently, change the virtual image with the over-sharp mandibular angle into a form which is more in line with the preference of the user, and improve the experience of the user when using the related application.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive faculty for a person skilled in the art.
Fig. 1 is an effect schematic diagram of a face adjusting method according to an embodiment of the present application;
FIG. 2 is a flow chart of a face adjustment method according to an embodiment of the present disclosure;
FIG. 3 is a schematic flow chart of determining a target half-wheel width in one embodiment of the present application;
FIG. 4 is a schematic flow chart of determining a target half-wheel width according to another embodiment of the present application;
FIG. 5 is a schematic block diagram of a facial adjustment apparatus according to one embodiment of the present disclosure;
fig. 6 is an internal structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
As shown in fig. 1, some applications use automatically generated avatars, and the mandibular outline of many automatically generated avatars may be inverted triangle, as shown in fig. 1a, which does not meet the user' S requirements, therefore, the embodiments of the present application provide a facial adjustment method for an avatar, please refer to fig. 2, including steps S202 to S210.
S202, identifying the mandibular outline of the image to be adjusted.
It can be understood that the image to be adjusted is the cartoon image automatically generated by the AI algorithm, which can be just the head portrait, the body image, the whole body image and the like, and the cartoon image can be processed by the method in the application as long as the cartoon image contains the head. In actual use, the method in the application can be used as an external function in the image generation application, for example, an AI algorithm firstly generates a version of virtual image and displays the version of virtual image to a user. The user is dissatisfied with the mandible of the character and may initiate the facial optimization function. At this time, the image to be adjusted is the virtual image just generated by the AI algorithm. The method can be combined with an AI algorithm, and the virtual image generated by the AI algorithm is taken as the image to be adjusted before being displayed, so that the mandibular outline of the virtual image is obtained, and whether the mandibular outline of the virtual image does not meet the preset condition is judged. If yes, go on to step S104. If not, the avatar may be output to the user.
S204, determining the midpoint and two endpoints of the mandibular contour.
It will be appreciated that the mandibular profile is the lower half of the overall facial profile, from near one cheek bone, past the lowest end of the mandible to near the other cheek bone. The two endpoints here refer to the leftmost and rightmost points of the mandibular contour, respectively. For convenience of analysis, generally, after obtaining the mandibular outline, a plurality of points may be taken from the mandibular outline, for example, the points may be taken at equal intervals, each taken point is called a first key point, and according to the position of each first key point, the first key points for respectively representing the midpoint and two endpoints of the mandibular outline may be screened out from the first key points.
S206, for any one endpoint, determining the circle center corresponding to the half contour to be adjusted according to the endpoint, the position of the midpoint and the target radius.
Because the face of the cartoon image is in a symmetrical structure, the whole mandibular outline is divided into two half outlines to be adjusted by taking the middle point as a boundary for adjustment. Each half-profile to be adjusted is a profile between one end point and the midpoint of the mandibular profile. I.e. the mandibular profile is divided into left and right two half profiles to be adjusted. In this embodiment, an arc is used as a template, and the to-be-adjusted half contour is stretched towards the arc, so that the center of the circle where the arc of the template is located needs to be determined.
If the distance between each endpoint and the midpoint is less than twice the target radius, two circle centers can be determined according to the endpoint, the midpoint and the target radius. The two circle centers are all located at the perpendicular bisectors of the connecting line between the endpoint and the midpoint, the two circle centers are distributed up and down, the circle with the circle center located above passing through the endpoint and the midpoint is used for stretching the mandible outwards (namely the mandible contour is more round), and the circle with the circle center located above passing through the endpoint and the midpoint is used for shrinking the mandible inwards (namely the mandible contour is more sharp). Therefore, for two circle centers obtained according to any one of the end points, the middle point and the target radius, the center located above should be selected as the center corresponding to the half profile to be adjusted in this embodiment. Specifically, two circle centers can be determined on a perpendicular bisector of the connecting line between the left end point and the middle point, and the circle centers corresponding to the half-profile to be adjusted on the left side in the step are the circle centers on the upper right. Two circle centers can be determined on the middle vertical line of the connecting line between the right end point and the middle point and are respectively positioned at the upper left and the lower right, and the circle center corresponding to the half contour to be adjusted at the right side in the step is the circle center at the upper left.
If the distance between each endpoint and the midpoint is equal to twice the target radius, a circle center can be determined according to the endpoint, the midpoint and the target radius. The circle centers are all positioned at the middle point of the connecting line between the end points and the middle point, and the circle centers are directly used as the circle centers corresponding to the half contours to be adjusted.
And S208, adjusting the corresponding half profile to be adjusted according to the circle center and the target radius to obtain the target half profile.
It can be understood that, in step S206, the center of the circle corresponding to the half-contour to be adjusted on the left side and the center of the circle corresponding to the half-contour to be adjusted on the right side can be determined respectively, and each half-contour to be adjusted can obtain the target half-contour with more round visual effect through the step. Specifically, the center of the circle corresponding to the half-contour to be adjusted on the left side is called a first center of the circle, and the center of the circle corresponding to the half-contour to be adjusted on the right side is called a second center of the circle. According to the first circle center and the target radius, a first template arc passing through the left end point and the middle point at the same time can be determined, and the left half contour to be adjusted is adjusted according to the first template arc, so that the left target half contour is obtained. And according to the second circle center and the target radius, a second template arc passing through the right end point and the middle point simultaneously can be determined, and the right half contour to be adjusted is adjusted according to the second template arc, so that the right target half contour is obtained. As shown in fig. 1b, the dotted line attached to the mandible of the avatar includes left and right half contours to be adjusted, and the dotted line with white outer side includes left and right target half contours.
And S210, stretching the mandible of the image to be adjusted according to each target semi-contour.
It can be understood that the mandible of the figure to be adjusted is divided into two parts by taking the midpoint as a boundary, and each part is stretched according to the corresponding target half contour, so that a more round and natural facial effect can be obtained. The final display effect is shown in fig. 1 c.
Based on the face adjusting method of the avatar in the present embodiment, the mandibular contour is divided into symmetrical half contours to be adjusted with the midpoint of the mandibular contour as a boundary. And respectively determining the circle center corresponding to each half contour to be adjusted, wherein the radius of the circle where the circle center is located is a target radius, taking the circular arcs corresponding to the end points and the middle points of the mandibular contour on the circle as adjustment references, and adjusting the half contour to be adjusted into a more round target half contour. And finally, stretching the mandible of the image to be adjusted according to the target half contour to obtain the virtual image with more natural and attractive effect. The method can beautify the automatically generated virtual image quickly and efficiently, change the virtual image with the over-sharp mandibular angle into a form which is more in line with the preference of the user, and improve the experience of the user when using the related application.
In one embodiment, the half-profile to be adjusted includes a plurality of first keypoints. Referring to fig. 3, according to the center and the target radius, the corresponding half profile to be adjusted is adjusted to obtain the target half profile, which includes steps S302 to S308.
S302, for each first key point, determining a unit vector corresponding to the first key point according to the circle center and the position of the first key point. The direction of the unit vector points to the first key point from the circle center.
It can be understood that adjusting the half profile to be adjusted is equivalent to stretching each first key point outwards, and the stretching direction of each first key point is the direction in which the center of the circle corresponding to the half profile to be adjusted points to the first key point. Since it is necessary to adjust a position of a certain point in a specific direction in the coordinate system, the direction of the unit vector in this step is directed from the center of the circle to the first key point. Specifically, the unit vector of each first key point on the left adjustment half contour may be determined by: and subtracting the coordinates of the first circle centers from the coordinates of the first key points on the left side adjustment half contour, and dividing by the distance between the first key points and the first circle centers to obtain the unit vector corresponding to each first key point. Similarly, the coordinates of the second center of the circle are subtracted from the coordinates of each first key point on the right-side adjustment half contour, and then the coordinates are divided by the distance between each first key point and the second center of the circle, so that the unit vector corresponding to each first key point can be obtained.
S304, according to the unit vector and the target radius, and obtaining an adjustment vector corresponding to the first key point.
It can be understood that, for any one first key point, according to the unit vector and the target radius corresponding to the first key point, the corresponding position of the first key point on the target half contour can be obtained, and the adjustment vector can be obtained by making a difference between the position of the first key point and the position of the first key point.
S306, obtaining a second key point corresponding to the first key point according to the adjustment vector and the first key point.
It will be appreciated that if the circular arc is used entirely as the adjustment template, the face of the avatar may be too rounded, and thus the adjustment vector may be attenuated when calculated from the adjustment vector and the position of the first keypoint. That is, the target half contour with better visual effect is an arc line between the corresponding half contour to be adjusted and the corresponding template arc.
And S308, obtaining a target half contour according to each second key point.
And connecting the second key points on the same side to obtain the corresponding target half profile on the side.
In one embodiment, referring to fig. 4, in order to obtain a softer and more natural target half-contour, the corresponding half-contour to be adjusted is adjusted according to the center and the target radius to obtain the target half-contour, which includes steps S402 to S412.
S402, for one of the half contours to be adjusted, generating basic attenuation coefficients corresponding to the first key points one by one at equal intervals between the lower limit of the basic attenuation coefficients and the upper limit of the basic attenuation coefficients, and obtaining a basic attenuation coefficient set corresponding to the half contour to be adjusted. Wherein the greater the base attenuation coefficient corresponding to the first keypoint that is closer to the midpoint.
It will be appreciated that the set of base attenuation coefficients includes a number of base attenuation coefficients equal to the number of first key points in the half profile to be adjusted. The basic attenuation coefficient gradually increases from the lower limit of the basic attenuation coefficient to the upper limit of the basic attenuation coefficient, and corresponds to each first key point one by one, and the basic attenuation coefficient corresponding to the first key point which is closer to the midpoint is larger. This basic attenuation coefficient is set in such a way that the contour near the end points tends more toward the shape of the circular arc, while the portion near the midpoint narrows more rapidly, so that the resulting mandibular shape tends to be "goose egg-shaped".
In order to make the attenuation effect more natural, the basic attenuation coefficient set can be subjected to smoothing treatment, and the smoothed basic attenuation coefficient set can be subjected to normalization treatment. The smoothing process may be performed using a sigmoid function, a smoothclamp function, or the like. Taking the smoothclamp as an example, if the lower limit of the attenuation coefficient is 0 and the upper limit of the basic attenuation coefficient is 1, the upper and lower limit parameters of the input smoothclamp can be 0 and 0.9 respectively. The normalization process is completed by dividing each of the smoothed basic attenuation coefficients by 0.9.
S404, the basic attenuation coefficient set is symmetrically turned over to obtain another basic attenuation coefficient set corresponding to the half profile to be adjusted.
It can be understood that, in order to ensure symmetry of the face shape, after a basic attenuation coefficient set corresponding to one of the half contours to be adjusted is generated, the basic attenuation coefficient set is symmetrically turned over, so that a basic attenuation coefficient set corresponding to the other half contour to be adjusted can be obtained. Specifically, assuming that the first keypoints in the left half-contour to be adjusted are ordered in order from the end point to the middle point, the half-contour to be adjusted has 21 first keypoints, and the lower limit of the basic attenuation coefficient to the upper limit of the basic attenuation coefficient are 0 and 1, respectively, the set of basic attenuation coefficients is (0,0.05,0.10,..once again, 1). And the first key points in the half-profile to be adjusted on the right side are ordered according to the sequence from the middle point to the end point, the basic attenuation coefficient set is (0,0.05,0.10, the first key points are symmetrically turned over, and the (1,0.95,0.90, the first key points are symmetrically turned over, the basic attenuation coefficient set corresponding to the half-profile to be adjusted on the right side is also larger, and the symmetry is maintained on the left side and the right side.
S406, for each first key point, determining a unit vector corresponding to the first key point according to the circle center and the position of the first key point. The direction of the unit vector points to the first key point from the circle center.
Step S406 and step S408 are described above.
S408, according to the unit vector and the target radius, and obtaining an adjustment vector corresponding to the first key point.
S410, attenuating the adjustment vector according to the corresponding basic attenuation coefficient, and obtaining a second key point according to the attenuated adjustment vector and the first key point.
It can be understood that each first key point corresponds to an adjustment vector and a basic attenuation coefficient, and the adjustment vector is attenuated by the corresponding basic attenuation coefficient, so that the attenuated adjustment vector can be obtained. The obtained target half contour is an arc line between the corresponding half contour to be adjusted and the corresponding template arc. In some embodiments, before step S410 is performed, in order to make an overall adjustment to the adjustment effect, each set of basic attenuation coefficients may also be attenuated by using a quadratic attenuation coefficient. If each basic attenuation coefficient is multiplied by 0.3, the whole adjustment of the display effect is realized.
And S412, obtaining the target half profile according to each second key point.
In one embodiment, the target radius is determined by: the target radius is determined based on the distance between the two endpoints. I.e. the distance between the two end points of the mandibular profile, is taken as the diameter of the reference circle, resulting in the target radius.
In one embodiment, identifying a mandibular profile of an avatar to be adjusted includes:
(1) And determining a face area of the image to be adjusted, and obtaining a full face contour according to the face area.
It can be understood that the face recognition algorithm is mature at present, the face region can be quickly determined, and the full face outline of the face region is a closed curve comprising all key points of the face, which is equivalent to the whole outline of the face.
(2) And determining the positions of the eyes in the face area, and obtaining a dividing line according to the positions of the eyes.
The position of human eyes can be found from the image by utilizing a corresponding image recognition algorithm, and the lower half part of the full face outline is the mandibular outline by taking both eyes as dividing lines.
(3) And acquiring the lower half part of the full-face outline according to the dividing line to obtain the mandibular outline.
The embodiment of the application also provides a facial adjustment device for the avatar, referring to fig. 5, including an identification module 510, a reference point determination module 520, a circle center determination module 530, a contour adjustment module 540, and a facial adjustment module 550.
The recognition module 510 is used to recognize the mandibular profile of the character to be adjusted. The reference point determination module 520 is used to determine the midpoint and two endpoints of the mandibular profile. The center determining module 530 is configured to determine, for any one endpoint, a center of a circle corresponding to the half-profile to be adjusted according to the endpoint, the position of the midpoint, and the target radius. The half-profile to be adjusted is the profile between the end point and the midpoint of the mandibular profile. The profile adjustment module 540 is configured to adjust the corresponding half profile to be adjusted according to the circle center and the target radius, so as to obtain the target half profile. The facial adjustment module 550 is used for stretching the mandible of the figure to be adjusted according to each target half contour.
In one implementation, the profile adjustment module 540 is configured to determine, for each first key point, a unit vector corresponding to the first key point according to the center of the circle and the position of the first key point; the direction of the unit vector points to the first key point from the circle center; obtaining an adjustment vector corresponding to the first key point according to the unit vector and the target radius; obtaining a second key point corresponding to the first key point according to the adjustment vector and the first key point; and obtaining the target half profile according to each second key point.
In one implementation, the profile adjustment module 540 is configured to generate, for one of the half profiles to be adjusted, a base attenuation coefficient corresponding to the first key point one-to-one between a lower limit of the base attenuation coefficient and an upper limit of the base attenuation coefficient at equal intervals, to obtain a base attenuation coefficient set corresponding to the half profile to be adjusted; wherein, the larger the basic attenuation coefficient corresponding to the first key point which is closer to the midpoint is; and symmetrically overturning the basic attenuation coefficient set to obtain another basic attenuation coefficient set corresponding to the half profile to be adjusted. The profile adjustment module 540 is further configured to: attenuation adjustment vectors are carried out according to the corresponding basic attenuation coefficients; and obtaining a second key point according to the attenuated adjustment vector and the first key point.
In one implementation, the contour adjustment module 540 is configured to determine a face region of the image to be adjusted, and calculate a full-face contour of the face region; determining the positions of the eyes in the face area, and obtaining a dividing line according to the positions of the eyes; and acquiring the lower half part of the full-face outline according to the dividing line to obtain the mandibular outline.
For specific definition of the face adjusting means of the avatar, reference may be made to the definition of the face adjusting method of the avatar hereinabove, and detailed description thereof will be omitted. The respective modules in the above-described face adjusting apparatus of the avatar may be implemented in whole or in part by software, hardware, and a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules. It should be noted that, in the embodiment of the present application, the division of the modules is schematic, which is merely a logic function division, and other division manners may be implemented in actual implementation.
The embodiments also provide a computer device comprising one or more processors, and a memory having stored therein computer readable instructions that, when executed by the one or more processors, perform: identifying the mandibular profile of the image to be adjusted; determining a midpoint and two endpoints of the mandibular profile; for any one endpoint, determining the circle center corresponding to the half profile to be adjusted according to the positions of the endpoint and the midpoint and the target radius; the half profile to be adjusted is the profile between the end point and the middle point of the mandibular profile; according to the circle center and the target radius, adjusting the corresponding half profile to be adjusted to obtain a target half profile; and stretching the mandible of the image to be adjusted according to each target semi-contour.
In one embodiment, computer-readable instructions, when executed by one or more processors, perform: for each first key point, determining a unit vector corresponding to the first key point according to the circle center and the position of the first key point; the direction of the unit vector points to the first key point from the circle center; obtaining an adjustment vector corresponding to the first key point according to the unit vector and the target radius; obtaining a second key point corresponding to the first key point according to the adjustment vector and the first key point; and obtaining the target half profile according to each second key point.
In one embodiment, computer-readable instructions, when executed by one or more processors, perform: for one of the half contours to be adjusted, generating basic attenuation coefficients corresponding to the first key points one by one at equal intervals between the lower limit of the basic attenuation coefficient and the upper limit of the basic attenuation coefficient, and obtaining a basic attenuation coefficient set corresponding to the half contour to be adjusted; wherein, the larger the basic attenuation coefficient corresponding to the first key point which is closer to the midpoint is; and symmetrically overturning the basic attenuation coefficient set to obtain another basic attenuation coefficient set corresponding to the half profile to be adjusted. It also performs: attenuation adjustment vectors are carried out according to the corresponding basic attenuation coefficients; and obtaining a second key point according to the attenuated adjustment vector and the first key point.
In one embodiment, computer-readable instructions, when executed by one or more processors, perform: and carrying out smoothing treatment on the basic attenuation coefficient set, and carrying out normalization treatment on the basic attenuation coefficient set after the smoothing treatment. Also performs: and attenuating each basic attenuation coefficient set by utilizing the quadratic attenuation coefficient.
In one embodiment, computer-readable instructions, when executed by one or more processors, perform: the target radius is determined based on the distance between the two endpoints.
In one embodiment, computer-readable instructions, when executed by one or more processors, perform: determining a face area of the image to be adjusted, and calculating the full face outline of the face area; determining the positions of the eyes in the face area, and obtaining a dividing line according to the positions of the eyes; and acquiring the lower half part of the full-face outline according to the dividing line to obtain the mandibular outline.
Schematically, as shown in fig. 6, fig. 6 is a schematic internal structure of a computer device according to an embodiment of the present application, where the computer device 600 may be configured in an autonomous vehicle. Referring to FIG. 6, a computer device 600 includes a processing component 602 that further includes one or more processors and memory resources represented by a memory 601 for storing instructions, such as applications, executable by the processing component 602. The application program stored in the memory 601 may include one or more modules each corresponding to a set of instructions. Further, the processing component 602 is configured to execute instructions to perform the steps of the facial adjustment method of any of the embodiments described above.
The computer device 600 may also include a power component 603 configured to perform power management of the computer device 600, a wired or wireless network interface 604 configured to connect the computer device 600 to a network, and an input output (I/O) interface 605. The computer device 600 may operate based on an operating system stored in memory 601, such as Windows Server TM, mac OS XTM, unix TM, linux TM, free BSDTM, or the like.
It will be appreciated by those skilled in the art that the structure shown in fig. 6 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
Embodiments of the present application also provide a storage medium having stored therein computer readable instructions that, when executed by one or more processors, perform: identifying the mandibular profile of the image to be adjusted; determining a midpoint and two endpoints of the mandibular profile; for any one endpoint, determining the circle center corresponding to the half profile to be adjusted according to the positions of the endpoint and the midpoint and the target radius; the half profile to be adjusted is the profile between the end point and the middle point of the mandibular profile; according to the circle center and the target radius, adjusting the corresponding half profile to be adjusted to obtain a target half profile; and stretching the mandible of the image to be adjusted according to each target semi-contour.
In one embodiment, computer-readable instructions, when executed by one or more processors, perform: for each first key point, determining a unit vector corresponding to the first key point according to the circle center and the position of the first key point; the direction of the unit vector points to the first key point from the circle center; obtaining an adjustment vector corresponding to the first key point according to the unit vector and the target radius; obtaining a second key point corresponding to the first key point according to the adjustment vector and the first key point; and obtaining the target half profile according to each second key point.
In one embodiment, computer-readable instructions, when executed by one or more processors, perform: for one of the half contours to be adjusted, generating basic attenuation coefficients corresponding to the first key points one by one at equal intervals between the lower limit of the basic attenuation coefficient and the upper limit of the basic attenuation coefficient, and obtaining a basic attenuation coefficient set corresponding to the half contour to be adjusted; wherein, the larger the basic attenuation coefficient corresponding to the first key point which is closer to the midpoint is; and symmetrically overturning the basic attenuation coefficient set to obtain another basic attenuation coefficient set corresponding to the half profile to be adjusted. It also performs: attenuation adjustment vectors are carried out according to the corresponding basic attenuation coefficients; and obtaining a second key point according to the attenuated adjustment vector and the first key point.
In one embodiment, computer-readable instructions, when executed by one or more processors, perform: and carrying out smoothing treatment on the basic attenuation coefficient set, and carrying out normalization treatment on the basic attenuation coefficient set after the smoothing treatment. Also performs: and attenuating each basic attenuation coefficient set by utilizing the quadratic attenuation coefficient.
In one embodiment, computer-readable instructions, when executed by one or more processors, perform: the target radius is determined based on the distance between the two endpoints.
In one embodiment, computer-readable instructions, when executed by one or more processors, perform: determining a face area of the image to be adjusted, and calculating the full face outline of the face area; determining the positions of the eyes in the face area, and obtaining a dividing line according to the positions of the eyes; and acquiring the lower half part of the full-face outline according to the dividing line to obtain the mandibular outline.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In the present specification, each embodiment is described in a progressive manner, and each embodiment focuses on the difference from other embodiments, and may be combined according to needs, and the same similar parts may be referred to each other.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (8)

1. A face adjusting method of an avatar, comprising:
identifying the mandibular profile of the image to be adjusted;
determining a midpoint and two endpoints of the mandibular profile; the lower jaw outline is from one side of the cheek bone to the other side of the cheek bone through the lowest end of the lower jaw, and the endpoints are points at the leftmost side and the rightmost side of the lower jaw outline respectively;
for any one of the endpoints, determining the circle center corresponding to the half contour to be adjusted according to the endpoint, the position of the midpoint and the target radius; the half contour to be adjusted is a contour between the end point and the middle point in the mandibular contour, the half contour to be adjusted comprises a plurality of first key points, the circle center is the circle center of a circle where a template circular arc is located, the half contour to be adjusted is stretched towards the template circular arc, the template circular arc comprises a first template circular arc and a second template circular arc, the circle where the first template circular arc is located passes through a left end point and the middle point at the same time, the radius is the target radius, and the circle where the second template circular arc is located passes through a right end point and the middle point at the same time, and the radius is the target radius;
according to the circle center and the target radius, the corresponding half profile to be adjusted is adjusted to obtain a target half profile; and adjusting the corresponding half profile to be adjusted according to the circle center and the target radius to obtain a target half profile, wherein the method comprises the following steps of: for each first key point, determining a unit vector corresponding to the first key point according to the circle center and the position of the first key point; the direction of the unit vector points to the first key point from the circle center; obtaining an adjustment vector corresponding to the first key point according to the unit vector and the target radius; for one of the half contours to be adjusted, generating basic attenuation coefficients corresponding to the first key points one by one at equal intervals between a lower limit of the basic attenuation coefficients and an upper limit of the basic attenuation coefficients, and obtaining a basic attenuation coefficient set corresponding to the half contour to be adjusted; wherein the base attenuation coefficient corresponding to the first keypoint that is closer to the midpoint is greater; symmetrically overturning the basic attenuation coefficient set to obtain the basic attenuation coefficient set corresponding to the other half profile to be adjusted; obtaining a second key point corresponding to the first key point according to the adjustment vector and the first key point; obtaining the target half profile according to each second key point;
and obtaining a second key point corresponding to the first key point according to the adjustment vector and the first key point, including: attenuating the adjustment vector according to the corresponding base attenuation coefficient; obtaining the second key point according to the attenuated adjustment vector and the first key point;
and stretching the mandible of the image to be adjusted according to each target half contour.
2. The avatar face adjustment method of claim 1, further comprising, prior to said symmetrically inverting the set of base attenuation coefficients:
and carrying out smoothing treatment on the basic attenuation coefficient set, and carrying out normalization treatment on the basic attenuation coefficient set after the smoothing treatment.
3. The face adjusting method of an avatar according to claim 1 or 2, further comprising, before the second keypoints corresponding to the first keypoints are obtained according to the adjustment vector and the first keypoints:
and attenuating each basic attenuation coefficient set by utilizing a quadratic attenuation coefficient.
4. The face adjusting method of an avatar according to claim 1 or 2, wherein the determining process of the target radius is:
and determining the target radius according to the distance between the two endpoints.
5. The face adjusting method of an avatar according to claim 1 or 2, wherein the identifying a mandibular profile of the avatar to be adjusted includes:
determining a face area of the image to be adjusted, and obtaining a full face contour according to the face area;
determining the positions of the eyes in the face area, and obtaining a dividing line according to the positions of the eyes;
and acquiring the lower half part of the full-face outline according to the dividing line to obtain the mandibular outline.
6. A face adjusting apparatus of an avatar, comprising:
the identification module is used for identifying the mandible outline of the image to be adjusted;
a reference point determining module for determining a midpoint and two endpoints of the mandibular profile; the lower jaw outline is from one side of the cheek bone to the other side of the cheek bone through the lowest end of the lower jaw, and the endpoints are points at the leftmost side and the rightmost side of the lower jaw outline respectively;
the circle center determining module is used for determining the circle center corresponding to the half profile to be adjusted according to the positions of the end points, the middle points and the target radius for any one of the end points; the half contour to be adjusted is a contour between the end point and the middle point in the mandibular contour, the circle center is the circle center of a circle where a template circular arc is located, the half contour to be adjusted is stretched towards the template circular arc, the template circular arc comprises a first template circular arc and a second template circular arc, the circle where the first template circular arc is located passes through the left end point and the middle point at the same time, the radius is the target radius, and the circle where the second template circular arc is located passes through the right end point and the middle point at the same time, and the radius is the target radius;
the contour adjustment module is used for adjusting the corresponding half contour to be adjusted according to the circle center and the target radius to obtain a target half contour; and adjusting the corresponding half profile to be adjusted according to the circle center and the target radius to obtain a target half profile, wherein the method comprises the following steps of: for each first key point, determining a unit vector corresponding to the first key point according to the circle center and the position of the first key point; the direction of the unit vector points to the first key point from the circle center; obtaining an adjustment vector corresponding to the first key point according to the unit vector and the target radius; for one of the half contours to be adjusted, generating basic attenuation coefficients corresponding to the first key points one by one at equal intervals between a lower limit of the basic attenuation coefficients and an upper limit of the basic attenuation coefficients, and obtaining a basic attenuation coefficient set corresponding to the half contour to be adjusted; wherein the base attenuation coefficient corresponding to the first keypoint that is closer to the midpoint is greater; symmetrically overturning the basic attenuation coefficient set to obtain the basic attenuation coefficient set corresponding to the other half profile to be adjusted; obtaining a second key point corresponding to the first key point according to the adjustment vector and the first key point; obtaining the target half profile according to each second key point; and obtaining a second key point corresponding to the first key point according to the adjustment vector and the first key point, including: attenuating the adjustment vector according to the corresponding base attenuation coefficient; obtaining the second key point according to the attenuated adjustment vector and the first key point;
and the facial adjusting module is used for stretching the lower jaw of the image to be adjusted according to each target half contour.
7. A computer device comprising one or more processors and a memory having stored therein computer readable instructions which, when executed by the one or more processors, perform the facial adjustment method steps of the avatar as claimed in any one of claims 1-5.
8. A storage medium having stored therein computer readable instructions which, when executed by one or more processors, cause the one or more processors to perform the method steps of face adjustment of an avatar as claimed in any one of claims 1-5.
CN202310403246.2A 2023-04-17 2023-04-17 Face adjusting method, device, computer equipment and storage medium for virtual image Active CN116109479B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310403246.2A CN116109479B (en) 2023-04-17 2023-04-17 Face adjusting method, device, computer equipment and storage medium for virtual image

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310403246.2A CN116109479B (en) 2023-04-17 2023-04-17 Face adjusting method, device, computer equipment and storage medium for virtual image

Publications (2)

Publication Number Publication Date
CN116109479A CN116109479A (en) 2023-05-12
CN116109479B true CN116109479B (en) 2023-07-18

Family

ID=86267689

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310403246.2A Active CN116109479B (en) 2023-04-17 2023-04-17 Face adjusting method, device, computer equipment and storage medium for virtual image

Country Status (1)

Country Link
CN (1) CN116109479B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020062532A1 (en) * 2018-09-28 2020-04-02 北京市商汤科技开发有限公司 Face image processing method and apparatus, electronic device, and storage medium
WO2020087731A1 (en) * 2018-10-30 2020-05-07 北京市商汤科技开发有限公司 Image processing method and apparatus, computer device and computer storage medium
CN113329252A (en) * 2018-10-24 2021-08-31 广州虎牙科技有限公司 Live broadcast-based face processing method, device, equipment and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105374055B (en) * 2014-08-20 2018-07-03 腾讯科技(深圳)有限公司 Image processing method and device
CN109934766B (en) * 2019-03-06 2021-11-30 北京市商汤科技开发有限公司 Image processing method and device
CN114255230A (en) * 2021-12-27 2022-03-29 厦门美图之家科技有限公司 Face feature point-based portrait mandible line repairing method, device and equipment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020062532A1 (en) * 2018-09-28 2020-04-02 北京市商汤科技开发有限公司 Face image processing method and apparatus, electronic device, and storage medium
CN113329252A (en) * 2018-10-24 2021-08-31 广州虎牙科技有限公司 Live broadcast-based face processing method, device, equipment and storage medium
WO2020087731A1 (en) * 2018-10-30 2020-05-07 北京市商汤科技开发有限公司 Image processing method and apparatus, computer device and computer storage medium

Also Published As

Publication number Publication date
CN116109479A (en) 2023-05-12

Similar Documents

Publication Publication Date Title
CN108846793B (en) Image processing method and terminal equipment based on image style conversion model
US20160328825A1 (en) Portrait deformation method and apparatus
CN111339928B (en) Eye spirit adjusting method and device and storage medium
CN113838176B (en) Model training method, three-dimensional face image generation method and three-dimensional face image generation equipment
TWI752419B (en) Image processing method and apparatus, image device, and storage medium
WO2021012596A1 (en) Image adjustment method, device, storage medium, and apparatus
CN111652123B (en) Image processing and image synthesizing method, device and storage medium
KR20120005587A (en) Method and apparatus for generating face animation in computer system
CN109147012B (en) Image processing method and device
US11769286B2 (en) Beauty processing method, electronic device, and computer-readable storage medium
KR20190043925A (en) Method, system and non-transitory computer-readable recording medium for providing hair styling simulation service
CN111311733A (en) Three-dimensional model processing method and device, processor, electronic device and storage medium
CN111815768B (en) Three-dimensional face reconstruction method and device
CN113421204A (en) Image processing method and device, electronic equipment and readable storage medium
CN110910308B (en) Image processing method, device, equipment and medium
CN116109479B (en) Face adjusting method, device, computer equipment and storage medium for virtual image
CN112991208B (en) Image processing method and device, computer readable medium and electronic equipment
CN111652795A (en) Face shape adjusting method, face shape adjusting device, live broadcast method, live broadcast device, electronic equipment and storage medium
CN108629781B (en) Hair drawing method
WO2021197230A1 (en) Three-dimensional head model constructing method, device, system, and storage medium
CN114820894A (en) Virtual role generation method and system
CN112348069B (en) Data enhancement method, device, computer readable storage medium and terminal equipment
CN110717373B (en) Image simulation method, electronic device, and computer-readable storage medium
CN113223128B (en) Method and apparatus for generating image
CN112785490A (en) Image processing method and device and electronic equipment

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