CN114095646B - Image processing method, image processing device, electronic equipment and storage medium - Google Patents

Image processing method, image processing device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114095646B
CN114095646B CN202010859036.0A CN202010859036A CN114095646B CN 114095646 B CN114095646 B CN 114095646B CN 202010859036 A CN202010859036 A CN 202010859036A CN 114095646 B CN114095646 B CN 114095646B
Authority
CN
China
Prior art keywords
point
target
triangle
type
coordinate value
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
CN202010859036.0A
Other languages
Chinese (zh)
Other versions
CN114095646A (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.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202010859036.0A priority Critical patent/CN114095646B/en
Priority to PCT/CN2021/114378 priority patent/WO2022042570A1/en
Publication of CN114095646A publication Critical patent/CN114095646A/en
Application granted granted Critical
Publication of CN114095646B publication Critical patent/CN114095646B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/18Eye characteristics, e.g. of the iris
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/64Computer-aided capture of images, e.g. transfer from script file into camera, check of taken image quality, advice or proposal for image composition or decision on when to take image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T3/04
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/80Camera processing pipelines; Components thereof

Abstract

The disclosure provides an image processing method, an image processing device, an electronic device and a storage medium. The method comprises the following steps: acquiring a target image containing a makeup part of a target; acquiring coordinate values of the contour feature points of the beautiful makeup part of the target in the target image to serve as target coordinate values; obtaining a grid structure of the cosmetic part of the target according to the coordinate value of the target and a predetermined configuration file to serve as the target grid structure; and performing makeup treatment on the target makeup part according to the target grid structure to obtain a makeup image. In the present disclosure, the target grid structure generated according to the configuration file may generate different changes according to the change of the state of the cosmetic part of the target, so that cosmetic images adapted to different states of the cosmetic part of the target may be generated according to the target grid structure, that is, different cosmetic effects may be generated in different states.

Description

Image processing method, image processing device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to an image processing method and apparatus, an electronic device, and a storage medium.
Background
Along with the development of smart phones, the mobile phone operation photographing performance is greatly improved. Especially, the more advanced AI processing function in recent years enables the mobile phone terminal to perform real-time computation, and a large number of camera shooting and video recording application programs with special effects are created.
Of the various effects, makeup is one of the most common effects. For eye cosmetics, a whole set of detailed Mesh structures (i.e. Mesh structures) is formed by creating extension points, which are then combined with AI points (i.e. contour points of the eye).
The real world eye makeup has a smooth curve, and is bent upward properly when the eyes are closed, and is straight or downward when the eyes are opened. However, the grid structure of the current structure is too stable, so that the effect is not ideal when the grid structure is used for making makeup. As shown in fig. 1, the whole grid structure cannot flexibly move along with the eye, resulting in abnormal structures of the canthus positions when the eye is closed. Wherein, when the M mark in fig. 1 shows that the eyes are closed, the outer canthus part of the mesh structure still has a similar difference with the eyes opened, but the eyelid part has moved downward as a whole, so that the partial image has a larger amplitude of displacement, i.e. the effect indicated by the M mark in fig. 1.
Therefore, for the makeup of the eyes, the grid structure of the prior structure can not adapt to different states of the eyes, so that the makeup effect is too thick, or the problem of strange bending is caused. Similarly, the same problem can exist for other beautiful parts of the human face by adopting the grid structure constructed by the prior art.
Disclosure of Invention
The present disclosure provides an image processing method, an image processing apparatus, an electronic device, and a storage medium, which are used to solve the problem that a grid structure constructed in the prior art cannot adapt to different states of a part to be beautified, so that the beautification effect is too rigid, or strange and different bends are generated.
According to a first aspect of the present disclosure, there is provided an image processing method comprising:
acquiring a target image containing a part of a target to be beautified;
acquiring coordinate values of the contour feature points of the target makeup-treated part in the target image to serve as target coordinate values;
obtaining a grid structure of the target cosmetic part according to the target coordinate value and a predetermined configuration file to serve as a target grid structure;
performing makeup treatment on the target makeup part according to the target grid structure to obtain a makeup image;
the configuration file comprises preset triangles in a grid structure of a cosmetic part and coordinate values of vertexes of the preset triangles, wherein the preset triangles comprise at least one first type of triangle and a second type of triangle corresponding to the first type of triangle, the vertex of one first type of triangle comprises two stable points and a first expansion point, and the vertex of one second type of triangle comprises a first expansion point, a switch point and a second expansion point in the first type of triangle corresponding to the vertex of the second type of triangle;
the stable point and the switch point are respectively the point with the minimum motion amplitude and the point with the maximum motion amplitude in the contour characteristic points of the cosmetic part in the process of changing the cosmetic part from the first state to the second state, and the first expansion point and the second expansion point are points which are set in advance according to the contour of the cosmetic part.
Optionally, before the obtaining the target image including the makeup part of the target, the method further includes:
in response to a first operation of a user, modifying a coordinate value of one first extension point in the predetermined configuration file;
saving the modified configuration file;
the obtaining of the grid structure of the cosmetic part of the target according to the target coordinate values and a predetermined configuration file comprises:
and obtaining the target grid structure according to the target coordinate value and the modified configuration file.
Optionally, the coordinate value of the switch point in the second triangle is a coordinate value of the position of the switch point when the cosmetic part is in the first state, where one second triangle has a target triangle corresponding to the second triangle, the vertex of the target triangle includes the first extension point in the second triangle corresponding to the second triangle, the point at the position of the switch point when the cosmetic part is in the second state, and the target point, and the second triangle is similar to the target triangle corresponding to the second triangle;
before the acquiring the target image containing the makeup part of the target, the method further comprises the following steps:
calculating the coordinate value of the target point according to the similarity relation between the second type triangle and the corresponding target triangle, the coordinate value of the vertex of the second type triangle and the coordinate value of the point at the position of the switch point when the cosmetic part is in the second state;
displaying a direction pointing from the target point to the corresponding second expansion point according to the coordinate value of the target point and the coordinate value of the second expansion point;
and the second expansion point corresponding to the target point is the second expansion point in the second type of triangle corresponding to the target triangle to which the target point belongs.
Optionally, the coordinate value of the switch point in the second triangle is a coordinate value of a position where the switch point is located when the cosmetic part is in the first state, where one second triangle has a target triangle corresponding to the second triangle, a vertex of the target triangle includes a first extension point in the second triangle corresponding to the second triangle, a point where the switch point is located when the cosmetic part is in the second state, and a target point, and the second triangle is similar to the target triangle corresponding to the second triangle;
the first operation is modification operation of a coordinate value of a target point displayed on a target interface by a user;
the modifying the coordinate value of one of the predetermined first extension points in the configuration file in response to the first operation of the user comprises:
according to the first operation, determining a coordinate value of a modified reference point, wherein the reference point is a target point aimed at by the first operation;
calculating the coordinate value of the modified first extension point of the second triangle corresponding to the target triangle to which the reference point belongs according to the target triangle to which the reference point belongs, the similarity relation of the second triangle corresponding to the target triangle and the target parameter;
the target parameters comprise coordinate values after the reference point is modified, coordinate values of a point at the position of the switch point when the cosmetic part is in the first state, coordinate values of a point at the position of the switch point when the cosmetic part is in the second state, and coordinate values of a second expansion point of a second triangle corresponding to the target triangle to which the reference point belongs.
Optionally, the obtaining the grid structure of the cosmetic part of the target according to the target coordinate value and a predetermined configuration file includes:
calculating to obtain coordinate values of a first-class extension point according to the coordinate values of a stable point in the contour feature points of the cosmetic part in the target image and the coordinate values of the vertexes of the first-class triangles in the configuration file by adopting a similar triangle algorithm;
calculating to obtain coordinate values of a second type of extension points by adopting a similar triangle algorithm according to the coordinate values of a switch point in the contour feature points of the cosmetic part in the target image, the coordinate values of the first type of extension points and the coordinate values of the vertexes of the second type of triangle in the configuration file;
calculating to obtain a coordinate value of a third type extension point according to the coordinate value of the first type extension point, the coordinate value of the second type extension point and the target coordinate value;
obtaining the target grid structure according to the coordinate values of the first type extension points, the second type extension points and the third type extension points;
wherein, the first-class extension points are points in the target mesh structure corresponding to the first extension points in the first-class triangles; the second type of extension point is a point in the target mesh structure corresponding to the second extension point in the second type of triangle, and the third type of extension point is other points in the target mesh structure except for the contour feature point of the makeup part in the target image, the first type of extension point and the second type of extension point.
Optionally, the coordinate values of at least some of the third type extension points are determined by using a smooth transition or interpolation method.
Optionally, the preset triangles further include at least one third type of triangle, where the vertex of one third type of triangle includes a third extension point and two points in a target set, the third extension point is a point set in advance according to the contour of the cosmetic part, the target set includes the vertex of the first type of triangle and the vertex of the second type of triangle, and other points excluding the stable point and the switch point in the contour feature points of the cosmetic part;
the step of obtaining a coordinate value of a third type extension point by calculation according to the coordinate value of the first type extension point, the coordinate value of the second type extension point and the target coordinate value includes:
and calculating to obtain the coordinate value of the third type extension point by adopting a similar triangle algorithm according to the coordinate value of the first type extension point, the coordinate value of the second type extension point, the target coordinate value and the coordinate value of the vertex of the third type triangle in the configuration file.
Optionally, when the part to be made up is an eye, the stable points are two eye corner points, and the switch point is a middle point of the contour of the upper eyelid.
According to a second aspect of the present disclosure, there is provided an image processing apparatus comprising:
an image acquisition module configured to acquire a target image including a target makeup part;
a coordinate acquisition module configured to acquire coordinate values of the contour feature points of the cosmetic part of the target in the target image as target coordinate values;
the grid structure acquisition module is configured to obtain a grid structure of the makeup part of the target according to the coordinate value of the target and a predetermined configuration file to serve as a target grid structure;
the image drawing module is configured to perform makeup processing on the target makeup part according to the target grid structure to obtain a makeup image;
the configuration file comprises preset triangles in a grid structure of a cosmetic part and coordinate values of vertexes of the preset triangles, wherein the preset triangles comprise at least one first type of triangle and a second type of triangle corresponding to the first type of triangle, the vertex of one first type of triangle comprises two stable points and a first expansion point, and the vertex of one second type of triangle comprises a first expansion point, a switch point and a second expansion point in the first type of triangle corresponding to the vertex of the second type of triangle;
the stable point and the switch point are respectively the point with the minimum motion amplitude and the point with the maximum motion amplitude in the contour characteristic points of the part to be beautified in the process of changing the part to be beautified from the first state to the second state, and the first spreading point and the second spreading point are points which are set in advance according to the contour of the part to be beautified.
Optionally, the apparatus further comprises:
the modification module is configured to modify a predetermined coordinate value of one first extension point in the configuration file in response to a first operation of a user;
a saving module configured to save the modified configuration file;
the grid structure acquisition module is specifically configured to:
and obtaining the target grid structure according to the target coordinate value and the modified configuration file.
Optionally, the coordinate value of the switch point in the second triangle is a coordinate value of the position of the switch point when the cosmetic part is in the first state, where one second triangle has a target triangle corresponding to the second triangle, the vertex of the target triangle includes the first extension point in the second triangle corresponding to the second triangle, the point at the position of the switch point when the cosmetic part is in the second state, and the target point, and the second triangle is similar to the target triangle corresponding to the second triangle;
the device further comprises:
the first calculation module is configured to calculate the coordinate value of the target point according to the similarity relation between the second type triangle and the corresponding target triangle, the coordinate value of the vertex of the second type triangle and the coordinate value of the point at the position of the switch point when the cosmetic part is in the second state;
the display module is configured to display the direction pointing from the target point to the corresponding second expansion point according to the coordinate values of the target point and the coordinate values of the second expansion point;
and the second expansion point corresponding to the target point is a second expansion point in a second type of triangle corresponding to the target triangle to which the target point belongs.
Optionally, the coordinate value of the switch point in the second triangle is a coordinate value of the position of the switch point when the cosmetic part is in the first state, where one second triangle has a target triangle corresponding to the second triangle, the vertex of the target triangle includes the first extension point in the second triangle corresponding to the second triangle, the point at the position of the switch point when the cosmetic part is in the second state, and the target point, and the second triangle is similar to the target triangle corresponding to the second triangle;
the first operation is a modification operation of a coordinate value of a target point displayed on the target interface by a user;
the modification module includes:
a first determining submodule configured to determine, according to the first operation, a coordinate value of a modified reference point, where the reference point is a target point to which the first operation is directed;
the first calculation submodule is configured to calculate a coordinate value after modification of a first extension point of a second type of triangle corresponding to a target triangle to which a reference point belongs according to the target triangle to which the reference point belongs, a similarity relation between the target triangle and the second type of triangle corresponding to the target triangle, and a target parameter;
the target parameters comprise coordinate values after the reference point is modified, coordinate values of a point at the position of the switch point when the cosmetic part is in the first state, coordinate values of a point at the position of the switch point when the cosmetic part is in the second state, and coordinate values of a second expansion point of a second triangle corresponding to the target triangle to which the reference point belongs.
Optionally, the grid structure obtaining module includes:
the second calculation submodule is configured to calculate a coordinate value of a first-class extension point according to a coordinate value of a stable point in a contour feature point of the makeup-treated part in the target image and a coordinate value of a vertex of a first-class triangle in the configuration file by adopting a similar triangle algorithm;
the third calculation sub-module is configured to calculate to obtain coordinate values of a second type of extension points according to the coordinate values of the switch points in the contour feature points of the cosmetic part in the target image, the coordinate values of the first type of extension points and the coordinate values of the vertexes of the second type of triangles in the configuration file by adopting a similar triangle algorithm;
the fourth calculation submodule is configured to calculate a coordinate value of a third type extension point according to the coordinate value of the first type extension point, the coordinate value of the second type extension point and the target coordinate value;
the grid structure drawing submodule is configured to obtain the target grid structure according to the coordinate values of the first type of extension points, the second type of extension points and the third type of extension points;
wherein, the first-class extension points are points in the target mesh structure corresponding to the first extension points in the first-class triangles; the second type of extension point is a point in the target mesh structure corresponding to the second extension point in the second type of triangle, and the third type of extension point is other points in the target mesh structure except for the contour feature point of the makeup part in the target image, the first type of extension point and the second type of extension point.
Optionally, the coordinate values of at least some of the third type extension points are determined by using a smooth transition or interpolation method.
Optionally, the preset triangles further include at least one third type of triangle, where the vertex of one third type of triangle includes two points of a third expansion point and a target set, the third expansion point is a point preset according to the contour of the cosmetic part, the target set includes the vertex of the first type of triangle, the vertex of the second type of triangle, and other points excluding the stable point and the switch point in the contour feature points of the cosmetic part;
the fourth computing submodule is particularly configured to:
and calculating to obtain the coordinate value of the third type extension point by adopting a similar triangle algorithm according to the coordinate value of the first type extension point, the coordinate value of the second type extension point, the target coordinate value and the coordinate value of the vertex of the third type triangle in the configuration file.
Optionally, when the cosmetic part is an eye, the stable points are two eye corner points, and the switch point is a midpoint of an upper eyelid contour.
According to a third aspect of the present disclosure, there is provided an electronic device comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute operations performed to implement any of the image processing methods described above.
According to a fourth aspect of the present disclosure, there is provided a computer-readable storage medium, wherein instructions, when executed by a processor of an electronic device, enable the electronic device to perform operations performed by any of the image processing methods described above.
According to a fifth aspect of embodiments of the present disclosure, there is provided, according to the fifth aspect of embodiments of the present disclosure, a computer program product comprising one or more instructions which, when executed by a processor of an electronic device, enable the electronic device to perform an operation to implement the image processing method as provided by the present disclosure.
Compared with the prior art, the method has the following advantages:
according to the embodiment of the disclosure, two stable points and a first expansion point are adopted to form a first type triangle, a first expansion point, a switch point and a second expansion point are adopted to form a second type triangle, namely, a double similar triangle structure is adopted to form a triangle of a mesh structure of a cosmetic part, a configuration file is formed, so that the configuration file is facilitated, the coordinate value of the contour characteristic point of the target cosmetic part in a target image is calculated to obtain the target mesh structure of the target cosmetic part, and then cosmetic treatment is performed on the target cosmetic part according to the target mesh structure, and a cosmetic image is obtained.
The first type of triangles comprise a stable point and a first expansion point, so that the state of the target makeup part is changed, the checking result of the first expansion point is not greatly influenced, and the second type of triangles comprise a first expansion point, a switch point and a second expansion point.
Therefore, the embodiment of the disclosure can generate different makeup effects in different states of the target makeup part, thereby solving the problem that the makeup effects are too thick or are bent irregularly to a certain extent.
It should be noted here that, if the points included in the configuration file are in a one-to-one correspondence relationship with the points in the target mesh structure to be calculated, checking an extension point in the configuration file, that is, calculating coordinates of the corresponding point of the extension point in the configuration file in the target mesh structure.
The foregoing description is only an overview of the technical solutions of the present disclosure, and the embodiments of the present disclosure are described below in order to make the technical means of the present disclosure more clearly understood and to make the above and other objects, features, and advantages of the present disclosure more clearly understandable.
Drawings
Various advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the disclosure. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a schematic diagram showing the display and cosmetic effect comparison of different states of human eyes by using a grid structure constructed in the prior art;
fig. 2 is a flowchart of an image processing method according to a first embodiment of the disclosure;
fig. 3 is a flowchart of an image processing method according to a second embodiment of the disclosure;
FIG. 4 is a schematic flow chart of a configuration file from design to use in an embodiment of the present disclosure;
FIG. 5 is a schematic flow chart illustrating the design of a first type of triangle and a second type of triangle according to an embodiment of the present disclosure;
fig. 6 is a schematic view of a point location structure for the cosmetic effect setting for the outward extending blink canthus in the embodiment of the present disclosure;
fig. 7 is a schematic view of a point location structure set for a cosmetic effect of blinking corners of eyes;
FIG. 8 is a schematic diagram of a first class of triangles formed in a configuration file in an embodiment of the present disclosure;
FIG. 9 is a schematic diagram of a second class of triangles formed in a configuration file in an embodiment of the present disclosure;
FIG. 10 is one of the schematic diagrams of a third class of triangles formed in a configuration file in an embodiment of the present disclosure;
FIG. 11 is a second schematic diagram illustrating a third type of triangle formed in a configuration file according to an embodiment of the present disclosure;
FIG. 12 is a schematic diagram illustrating a display of a direction in which a target point points to a corresponding second extension point in an embodiment of the present disclosure;
FIG. 13 is a schematic diagram illustrating the display and cosmetic effects of the grid structure obtained by using the configuration file in the embodiment of the present disclosure in different states of the human eye;
fig. 14 is a block diagram of the configuration of an image processing apparatus according to a third embodiment of the present disclosure;
fig. 15 is a block diagram of the configuration of an image processing apparatus according to the fourth embodiment of the present disclosure;
fig. 16 is a block diagram of an electronic device according to a fifth embodiment of the present disclosure;
FIG. 17 is a schematic diagram of a known three-point coordinate solution for one of the angles of the triangle formed by the three points in the disclosed embodiment;
FIG. 18 is a schematic diagram of a similar triangle algorithm in an embodiment of the present disclosure.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. The following description refers to the accompanying drawings in which the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Example one
Referring to fig. 2, an image processing method provided by an embodiment of the present disclosure is illustrated, and the image processing method may include the following steps:
step 801: acquiring a target image containing the part of the target to be beautified.
The target image may be a locally stored image, an image shot by the electronic device in real time, one frame of image in a locally stored video file, or one frame of image in a video file shot by the electronic device in real time.
Step 802: and acquiring coordinate values of the contour characteristic points of the target cosmetic part in the target image as target coordinate values.
Wherein, the contour characteristic points are points on the contour of the makeup part.
Step 803: and obtaining the grid structure of the makeup part of the target according to the coordinate value of the target and a predetermined configuration file to serve as the target grid structure.
The configuration file comprises preset triangles in a grid structure of a cosmetic part and coordinate values of vertexes of the preset triangles, wherein the preset triangles comprise at least one first type of triangle and a second type of triangle corresponding to the first type of triangle, the vertex of one first type of triangle comprises two stable points and a first expansion point, and the vertex of one second type of triangle comprises a first expansion point, a switch point and a second expansion point in the first type of triangle corresponding to the vertex of the second type of triangle;
the stable point and the switch point are respectively the point with the minimum motion amplitude and the point with the maximum motion amplitude in the contour characteristic points of the cosmetic part in the process of changing the cosmetic part from the first state to the second state.
Namely, the stable point is the point with the minimum motion amplitude in the contour characteristic points of the cosmetic part in the process of changing the cosmetic part from the first state to the second state; the switch point is a point with the largest movement amplitude in the contour characteristic points of the cosmetic part in the process of changing the cosmetic part from the first state to the second state, and the first expansion point and the second expansion point are points which are set in advance according to the contour of the cosmetic part.
Therefore, in the embodiment of the present disclosure, the configuration file includes a plurality of points, where the plurality of points includes the contour feature point of the cosmetic part and the manually set point (i.e., the extension point). For example, the eye-specific configuration file may include points 39-50, points 401-404, points 481-484, and points 423-478 as shown in FIG. 8, wherein the points 39-50 in FIG. 8 are contour feature points, and the points 401-404, 481-484, and points 423-478 are extension points. Wherein, a plurality of triangles are formed by a plurality of points in the configuration file according to a certain rule. And the rules for forming the triangles are predetermined.
The configuration file is used as a basis for generating the grid structure in the process of beautifying the part to be beautified. Specifically, when a known configuration file is used for cosmetic makeup of a part to be made up, firstly, an image of the part to be made up needs to be obtained, then contour feature points of the part to be made up in the image are detected, then points corresponding to the contour feature points included in the configuration file are selected from the contour feature points to serve as input parameters, then extension points forming a grid structure are calculated by using the input parameters and the configuration file, and then all the contour feature points included in the input parameters and all the calculated extension points are drawn into the grid structure. And finally, drawing the pre-drawn beautifying picture to the part to be beautified by using the drawn grid structure, thereby realizing the beautification of the part to be beautified.
The specific process of determining the rule for forming a triangle by a plurality of points in the configuration file may be as follows:
first, it was confirmed that in an application scene such as makeup for eyes, there was a problem of the outer canthus bending angle when blinking. In this case, the motion scene is "blink" and the region to be controlled is "outer canthus", the goal is to obtain a point which moves reasonably with the blink, which may be called "final point (i.e. second expansion point)" (i.e. point F in fig. 5).
Secondly, in order to obtain the final point (i.e. the second expansion point), an intermediate point needs to be generated, which may be called "leverage point (i.e. the first expansion point)", which is also a manually set point. Wherein the calculation rule of similar triangle is followed, but the verification of its two AI points (i.e. contour feature points) requires a special selection, i.e. a selection of points that are relatively stable in position during blinking. Therefore, the lever point position can be ensured to be stable in the whole movement process, and the subsequent treatment is convenient. During blinking, the positions of the two points located in the corners of the eyes are almost unchanged, and thus, the two points are stable points, i.e., points a1 and a2 in fig. 5 are stable points, and points a1, a2 and a in fig. 5 constitute a triangle of the first type.
Again, it is necessary to find the most obvious point (or structure) of change during the whole blinking process, usually in the contour feature point, and the motion trajectory of this point, which may be called "switch path". During blinking, the "switch point" of the eye is obviously the central point of the upper eyelid, and the point has the largest motion amplitude during the blinking action in the real world. It is desirable that the movement locus of the "final point (i.e., the second expansion point)" is synchronized with the rhythm of the movement of the switching point in the switching locus.
Finally, after finding the leverage point and the switch point, the two can be used as input parameters of a similar triangle to generate the final point (i.e., the second expansion point), as shown in fig. 5, where the points A, S, F form a triangle (i.e., the points A, S, F form a second type of triangle in fig. 5). These three points will then resemble a lever (here an analogy, not a complete equivalence), one end moving and the other end making a corresponding movement. The final point therefore has the property of dynamic position change, which will move synchronously with the switch point, and as shown in fig. 5, after the switch point moves from the position of the point S to the position of the point S ', the final point (i.e. the second expansion point) moves from the position of the point F to the position of the point F'.
As can be seen from the above description, in the configuration file in the embodiment of the present disclosure, the first extension point of one triangle of the first type is used as the vertex of the second type, and thus, the embodiment of the present disclosure uses double similar triangles.
In addition, it should be noted that the above description only describes the process of forming a first type of triangle and a second type of triangle corresponding to the first type of triangle. By adopting the same method, a plurality of first-class triangles and a second-class triangle corresponding to each first-class triangle can be obtained. For example, in the configuration file for eyes shown in fig. 8, all the points 401 to 404 are lever points (i.e., first expansion points), all the points 481 to 484 are final points (i.e., second expansion points), and all the points 42 are switch points, then the first type of triangles in this configuration file include triangles connected by dotted lines as shown in fig. 8, and the second type of triangles include triangles connected by dotted lines as shown in fig. 9.
Optionally, the obtaining the grid structure of the cosmetic part of the target according to the target coordinate value and a predetermined configuration file includes:
calculating to obtain a coordinate value of a first-class extension point according to a coordinate value of a stable point in the contour feature point of the cosmetic part in the target image and a coordinate value of a vertex of a first-class triangle in the configuration file by adopting a similar triangle algorithm;
calculating to obtain coordinate values of a second type of extension points by adopting a similar triangle algorithm according to the coordinate values of a switch point in the contour feature points of the cosmetic part in the target image, the coordinate values of the first type of extension points and the coordinate values of the vertexes of the second type of triangle in the configuration file;
calculating to obtain a coordinate value of a third type extension point according to the coordinate value of the first type extension point, the coordinate value of the second type extension point and the target coordinate value;
obtaining the target grid structure according to the coordinate values of the first type of extension points, the second type of extension points and the third type of extension points;
wherein, the first-class extension points are points in the target mesh structure corresponding to the first extension points in the first-class triangles; the second type of extension point is a point in the target mesh structure corresponding to the second extension point in the second type of triangle, and the third type of extension point is other points in the target mesh structure except for the contour feature point of the makeup part in the target image, the first type of extension point and the second type of extension point.
In the embodiment of the present disclosure, the configuration file includes a first type triangle and a second type triangle, and the first extension point of the first type triangle is also a vertex of the second type triangle, so that, when calculating the extension points of the target mesh structure by using the configuration file in the embodiment of the present disclosure, there is a calculation order, that is, firstly, the first extension point of the first type triangle is calculated, and secondly, the second extension point of the second type triangle is calculated. Specifically, for example, in the configuration file shown in fig. 8, it is necessary to check the points 401 to 404 according to the triangle shown by the dotted line in fig. 8, and then check the points 481 to 484 according to the triangle shown by the dotted line in fig. 9, and then check the other extension points in the static configuration file. In the process of checking other extension points in the static configuration file, the other extension points are checked based on the points known in the previous process (including the known contour feature points and the already checked extension points).
Optionally, the coordinate values of at least some of the third type extension points are determined by using a smooth transition or interpolation method.
After checking and calculating partial extension points in the configuration file, the adjacent related extension points can be generated by means of smooth transition or difference interpolation, so that the calculation amount can be reduced, and the processing speed is increased.
Optionally, the preset triangles further include at least one third type of triangle, where the vertex of one third type of triangle includes two points of a third expansion point and a target set, the third expansion point is a point preset according to the contour of the cosmetic part, the target set includes the vertex of the first type of triangle, the vertex of the second type of triangle, and other points excluding the stable point and the switch point in the contour feature points of the cosmetic part;
the step of obtaining a coordinate value of a third type extension point by calculation according to the coordinate value of the first type extension point, the coordinate value of the second type extension point and the target coordinate value includes:
and calculating to obtain the coordinate value of the third type extension point by adopting a similar triangle algorithm according to the coordinate value of the first type extension point, the coordinate value of the second type extension point, the target coordinate value and the coordinate value of the vertex of the third type triangle in the configuration file.
It can be seen that, in the embodiment of the present disclosure, a third type of triangle, which is composed of two points of the third extension point, and the outline feature point of the cosmetic part, the first extension point, and the second extension point, may also be included in one configuration file, for example, the triangle shown by the dashed line in fig. 10 and 11.
Specifically, the point included in the configuration file is in a one-to-one correspondence relationship with the point in the target mesh structure to be calculated, and the preset triangle included in the configuration file is in a one-to-one correspondence and similar to the triangle included in the target mesh structure, then the process of calculating the coordinate value of the first-type extension point by using the similar triangle algorithm according to the coordinate value of the stable point in the contour feature point of the cosmetic part in the target image and the coordinate value of the vertex of the first-type triangle in the configuration file is specifically as follows:
and calculating to obtain the coordinate value of the first-class extension point according to the similarity relation between the first-class triangle and the triangle corresponding to the first-class triangle in the target mesh structure, the coordinate value of a stable point in the contour feature point of the cosmetic part in the target image and the coordinate value of the vertex of the first-class triangle in the configuration file.
Similarly, the process of calculating and obtaining the coordinate value of the second-class extension point according to the coordinate value of the switch point in the contour feature point of the cosmetic part in the target image, the coordinate value of the first-class extension point and the coordinate value of the vertex of the second-class triangle in the configuration file by using the similar triangle algorithm is similar to the process of calculating and obtaining the coordinate value of the third-class extension point according to the coordinate value of the first-class extension point, the coordinate value of the second-class extension point, the target coordinate value and the coordinate value of the vertex of the third-class triangle in the configuration file by using the similar triangle algorithm, and the specific process of calculating and obtaining the first-class extension point is similar to this process, and details are not repeated here.
In summary, as shown in fig. 18, for the triangle-like algorithm, 5 known points need to be used, three of which are the points in the aforementioned configuration file (usually two AI points, one extension point), and we name them as A, B, C (i.e. A, B is an AI point and C is an extension point). The other two points are provided by the AI module, whose values are the values of the screen coordinates, which are named A ', B' here. A and A ', B and B' represent the same point in the grid structure. The value of a point C ' can be obtained through the related knowledge of the basic trigonometric function, and the requirement of delta ABC-delta A ' B ' C ' is met, wherein C ' is an extension point of the grid structure to be constructed.
In the embodiment of the present disclosure, the preset triangle in the configuration file is similar to the triangle corresponding to the preset triangle in the target mesh structure, and vertices of the preset triangle and the triangle in the target mesh structure are in one-to-one correspondence, that is, the two triangles are similar to each other and have a unique direction, so that the calculated extension point is unique.
Step 804: and performing makeup treatment on the target makeup part according to the target grid structure to obtain a makeup image.
Therefore, according to the embodiment of the disclosure, a first type triangle is formed by two stable points and a first expansion point, a second type triangle is formed by a first expansion point, a switch point and a second expansion point, that is, a triangle of a mesh structure of a cosmetic part is formed by a double similar triangle structure, so as to form a configuration file, thereby facilitating the configuration file and a coordinate value of a contour feature point of the cosmetic part of a target in a target image, calculating to obtain the target mesh structure of the cosmetic part of the target, and performing cosmetic treatment on the cosmetic part of the target according to the target mesh structure, so as to obtain a cosmetic image.
The first type of triangles comprise a stable point and a first expansion point, so that the state of the target makeup part is changed, the checking result of the first expansion point is not greatly influenced, and the second type of triangles comprise a first expansion point, a switch point and a second expansion point.
Therefore, the embodiment of the disclosure can generate different makeup effects in different states of the target makeup part, thereby solving the problem that the makeup effects are too thick or are bent irregularly to a certain extent.
Example two
In this embodiment, it should be noted in advance that, as shown in fig. 4, a configuration file is first designed in advance by a program developer and then provided to a makeup maker, where the makeup maker may modify the configuration file to debug a configuration file that may present different makeup effects, so that the makeup effects corresponding to the debugged configuration file may be issued to an experience user for use.
Referring to fig. 3, an image processing method provided by an embodiment of the present disclosure is illustrated, and the image processing method may include the following steps:
step 901: and modifying the coordinate value of one first extension point in a predetermined configuration file in response to a first operation of the user.
The configuration file comprises preset triangles in a grid structure of a cosmetic part and coordinate values of vertexes of the preset triangles, wherein the preset triangles comprise at least one first type of triangle and a second type of triangle corresponding to the first type of triangle, the vertex of one first type of triangle comprises two stable points and a first expansion point, and the vertex of one second type of triangle comprises a first expansion point, a switch point and a second expansion point in the first type of triangle corresponding to the vertex of the second type of triangle;
the stable point and the switch point are respectively the point with the minimum motion amplitude and the point with the maximum motion amplitude in the contour characteristic points of the cosmetic part in the process of changing the cosmetic part from the first state to the second state, and the first expansion point and the second expansion point are points which are set in advance according to the contour of the cosmetic part.
For the relevant description of the configuration file and the specific process of determining the rule for forming the triangle by the plurality of points in the configuration file, reference may be made to the relevant description of the first embodiment, and details are not repeated here.
In addition, the first operation is to modify one of the first extension points in a predetermined configuration file. In the embodiment of the disclosure, one configuration file may include a plurality of first triangles, so that one configuration file may include a plurality of first extension points, and each of the first extension points may be modified, so as to adjust the makeup effects of different parts of the makeup part. For example, the points 401 to 404 shown in fig. 8 are all the first spread points, the specific coordinate values of each of the points 401 to 404 may be changed, so as to change the cosmetic effect of different parts, for example, the coordinate values of the point 401 may be modified, so as to change the cosmetic effect at the corner of the eye indicated by the arrow H in fig. 8.
For example, in the configuration file obtained by modifying the coordinate values of the point 401, in two states of opening and closing the eyes, the generated mesh structures are as shown in fig. 13, and the cosmetic effects produced by the two mesh structures on the eyes can be as shown in fig. 13, where when the eyes are open, the cosmetic effect at the P position shown in fig. 13 has a tilting effect, and when the eyes are closed, the cosmetic effect at the Q position shown in fig. 13 is adjusted to be tilting, and is not bent downward.
As can be seen from a comparison between fig. 1 and fig. 13, the cosmetic effect of the prior art is very obvious when eyes are closed, and the image processing method according to the embodiment of the present disclosure is smoother as a whole and has a better bending effect.
Step 902: and saving the modified configuration file.
Step 903: acquiring a target image containing the part of the target to be beautified.
The target image may be a locally stored image, an image shot by the electronic device in real time, one frame of image in a locally stored video file, or one frame of image in a video file shot by the electronic device in real time.
Step 904: and acquiring coordinate values of the contour characteristic points of the target cosmetic part in the target image as target coordinate values.
Wherein, the contour characteristic points are points on the contour of the makeup part.
Step 905: and obtaining the grid structure of the beautiful makeup part of the target according to the target coordinate value and the modified configuration file to serve as the target grid structure.
Step 906: and performing makeup treatment on the target makeup part according to the target grid structure to obtain a makeup image.
Therefore, after the configuration file is determined, the makeup maker can generate and store configuration files corresponding to different makeup effects by modifying the coordinate values of the first extension point in the configuration file, so that the image including the part to be made up can be processed by directly utilizing the modified configuration files with different makeup effects.
Optionally, the coordinate value of the switch point in the second triangle is a coordinate value of the position of the switch point when the cosmetic part is in the first state, where one second triangle has a target triangle corresponding to the second triangle, the vertex of the target triangle includes the first extension point in the second triangle corresponding to the second triangle, the point at the position of the switch point when the cosmetic part is in the second state, and the target point, and the second triangle is similar to the target triangle corresponding to the second triangle;
before the acquiring the target image containing the makeup part of the target, the method further comprises the following steps:
calculating the coordinate value of the target point according to the similarity relation between the second type triangle and the corresponding target triangle, the coordinate value of the vertex of the second type triangle and the coordinate value of the point at the position of the switch point when the cosmetic part is in the second state;
displaying a direction pointing from the target point to the corresponding second expansion point according to the coordinate value of the target point and the coordinate value of the second expansion point;
and the second expansion point corresponding to the target point is a second expansion point in a second type of triangle corresponding to the target triangle to which the target point belongs.
Here, the coordinate value of the target point is a coordinate value of a position where the second extension point corresponding to the target point is located when the cosmetic part is in the second state. Namely, the cosmetic part is changed from the first state to the second state, the second expansion point moves from the first position to the second position along with the switch point, and the point at the second position forms a target point.
Therefore, the mesh structure of the part to be made up, which is composed of the preset triangles included in the configuration file, can be matched with the first state of the part to be made up, and then points to the direction of the second expansion point corresponding to the target point from the target point, so as to represent the motion trail or motion trend of the second expansion point in the process that the part to be made up is changed from the first state to the second state.
Wherein, because the first spreading point is relatively stable, the weak movement of the part to be beautified is basically not required to be considered when the state of the part to be beautified is changed. Therefore, the movement of the second expansion point depends on the movement of the switch point, and as shown in fig. 6, it can be assumed that the movement end point of the switch point is a point S ', and then the movement end point F ' of the second expansion point can be calculated, so as to obtain a line segment FF ', i.e. a movement track or movement trend of the second expansion point.
In addition, by adjusting the position of the first expansion point, a different movement trend of the second expansion point can be achieved. For example, for an application scene of a blink, by modifying the coordinate value of the first extension point (i.e. the coordinate value of point a in fig. 6 and 7), two point location structures as shown in fig. 6 and 7 can be obtained, which correspond to two effects, namely "blink canthus extend" (fig. 6) and "blink canthus raise" (fig. 7). Wherein, the canthus raising effect is in accordance with the canthus movement effect in the real world, and has important practical significance. In addition, some effects that do not match the world may also be made special effects, such as a drop in the corner of the eye, which may create a very "weak" feeling. Also of practical significance in particular requirements.
In summary, in the embodiments of the disclosure, a configuration file may include a plurality of second-type triangles, and the second expansion point of each second-type triangle moves when the switch point moves from the starting position to the ending position, so as to obtain the moving direction or the moving trend of the second expansion point of each second-type triangle. For example, in the configuration file shown in fig. 12, after the coordinate value of the point a (i.e., the first expansion point) is modified, an arrow pointing to F 'is displayed, and then the movement trend of the switch point moving from the position of the point S to the position of the point S' followed by the point F can be shown.
Namely, the embodiment of the disclosure can display the second expansion point in the configuration file in real time, and follow the movement trend of the switch point. The points in the configuration file and the points in the grid structure are in one-to-one correspondence, so that the second expansion points in the configuration file can represent the points in the grid structure corresponding to the second expansion points along with the movement trend of the switch points, and can follow the movement trend of the switch points, so that a makeup maker can timely know the change condition of the grid structure correspondingly generated after one first expansion point is modified, and can better estimate the change of the makeup effect caused by modifying the first expansion point, namely the modified second expansion points of the second triangle to which the first expansion points belong can be displayed along with the movement trend of the switch points, and a basis for adjusting different makeup effects can be provided for the makeup maker.
Optionally, a saving button may be provided on the interface that displays the direction in which the target point points at the second extension point corresponding to the target point, and when the makeup maker predicts that the modified configuration file can achieve the desired makeup effect through the direction that is displayed in the front and points at the second extension point corresponding to the target point, the makeup maker may click the saving button, so that the modified configuration file can be saved.
Optionally, the first operation is a first dragging operation of the user on one displayed first extension point;
the modifying the coordinate value of one of the predetermined first extension points in the configuration file in response to the first operation of the user comprises:
obtaining a coordinate value of the termination position of the first dragging operation;
and determining the coordinate value of the termination position of the dragging operation as the coordinate value modified by the dragged first extension point.
Therefore, in the embodiment of the disclosure, each first extension point can be displayed, and the cosmetic maker can drag any one of the first extension points to modify the coordinate value of the first extension point, that is, to which position the displayed first extension point is dragged, and the coordinate value at which position is the modified coordinate value of the first extension point, so that the cosmetic maker can greatly modify the first extension point.
Optionally, the coordinate value of the switch point in the second triangle is a coordinate value of the position of the switch point when the cosmetic part is in the first state, where one second triangle has a target triangle corresponding to the second triangle, the vertex of the target triangle includes the first extension point in the second triangle corresponding to the second triangle, the point at the position of the switch point when the cosmetic part is in the second state, and the target point, and the second triangle is similar to the target triangle corresponding to the second triangle;
the first operation is modification operation of a coordinate value of a target point displayed on a target interface by a user;
the modifying the coordinate value of one of the predetermined first extension points in the configuration file in response to the first operation of the user comprises:
according to the first operation, determining a coordinate value of a modified reference point, wherein the reference point is a target point aimed at by the first operation;
calculating the coordinate value of the modified first extension point of the second triangle corresponding to the target triangle to which the reference point belongs according to the target triangle to which the reference point belongs, the similarity relation of the second triangle corresponding to the target triangle and the target parameter;
the target parameters comprise coordinate values after the reference point is modified, coordinate values of a point at the position of the switch point when the cosmetic part is in the first state, coordinate values of a point at the position of the switch point when the cosmetic part is in the second state, and coordinate values of a second expansion point of a second triangle corresponding to the target triangle to which the reference point belongs.
In the embodiment of the present disclosure, the final purpose of modifying the coordinate value of the first extension point is to change the second extension point of the second triangle to which the first extension point belongs, and follow the movement trend of the switch point, that is, as shown in fig. 12, the purpose of modifying the coordinate value of the point a is to change the direction in which the point F points to F ', and the point F is a point set in the configuration file, that is, the point F is a known point, so that it is desirable to change the direction in which the point F points to F ', and the position of the point F ' can also be changed.
However, this method needs to reversely deduce the position of the first extension point a based on the point F', and it should be noted that the system of equations for such inverse solution is a system of binary quadratic equations, and there are cases where there is no solution and reasonable processing is required.
Specifically, before the position of the first extension point a is reversely deduced based on the point F', a calculation formula may be derived as follows. As shown in fig. 17, three-point coordinates are known: d (X1, Y1), B (X2, Y2) and C (X3, Y3), when the included angle < BDC is solved, firstly, a parallel line of an X axis is made based on a point D, and a point E is taken at the forward far end of the parallel line, so that < BDC ═ EDB-EDC is obtained; secondly, drawing a perpendicular line of DE based on B, C points to obtain two points B 'and C', wherein the coordinates of B 'are (x2, y1) and the coordinates of C' are (x3, y 1); again, the following calculation can be made from the coordinates of fig. 17 and the previously known points:
cos∠BDC=cos(∠EDB-∠EDC)
=cos∠EDB*cos∠EDC+sin∠EDB*sin∠EDC
=|DB`|/|DB|*|DC`|/|DC|+|BB`|/|DB|*|CC`|/|DC|
=[(x2-x1)(x3-x1)+(y2-y1)(y3-y1)]/|DB||DC|
through the above analysis, a target formula can be obtained: cos < BDC ═ [ (x2-x1) (x3-x1) + (y2-y1) (y3-y1) ]/| DB | | | DC |.
At this point, the position of the first extension point A can then be inferred based on point F' using the above equation. AS shown in fig. 12, since Δ F — 'AS —' Δ FAS, there are × F ═ AS ═ FAS, × F 'S ═ a ═ FSA, so that cos × F AS ═ cos ═ FAS, and cos × F' S a ═ cos ═ FSA, then the coordinates of point a are unknown, which are (x, y), and F, F 'and S, S' are known, so that a set of binary equations for x and y can be obtained according to cos ═ F AS — 'cos ═ FAS, cos — F' S ═ a ═ cos ═ FSA, and the above-mentioned target formula, and then a set of binary quadratic equations for point a can be obtained based on the set of binary equations.
It should be noted that, based on the characteristics of the binary quadratic equation system, the number of solutions may be 0, 1, 2, or an infinite number of solutions under different discriminants. Therefore, when the position of the lever point a is reversely pushed based on the point F', there may be a case where there is no solution.
Optionally, when the cosmetic part is an eye, the stable points are two eye corner points, and the switch point is a midpoint of an upper eyelid contour. That is, the image processing method in the embodiment of the present disclosure may be applied to cosmetic makeup for eyes, where it should be noted that the image processing method in the embodiment of the present disclosure is not limited to be applied to cosmetic makeup for eyes only, and may also be applied to cosmetic makeup for other parts of a human face.
It should be noted that, in the configuration file in the embodiment of the present disclosure, the extension point of one triangle is used as the vertex of another triangle, and thus, the embodiment of the present disclosure uses a double similar triangle. The double similar triangles can be expanded into more multiple similar triangles, and the principles are consistent, and are not further described herein.
In summary, the embodiment of the present disclosure provides a complete implementation scheme of a cosmetic variable bending angle by using multiple combinations of similar triangle algorithms, so that the cosmetic effect is more natural, and provides a set of tool implementation scheme for efficiently implementing configuration of a double similar triangle algorithm, thereby greatly reducing the configuration difficulty.
In addition, aiming at the setting of the extension points, the logic can be developed and constructed for specific points through a coding mode, the change is very flexible, the energy efficiency performance is highly dependent on the code logic, and more peculiar and natural effects can be obtained. However, this method has a large workload, a flexible effect and an inflexible manufacture. This approach may be used in combination with the dual similar triangle scheme and the common substantially similar triangle scheme employed in the embodiments of the present disclosure.
EXAMPLE III
Referring to fig. 14, illustrating an image processing apparatus provided by an embodiment of the present disclosure, the image processing apparatus 200 may include:
an image acquisition module 2001 configured to acquire a target image containing a target makeup target portion;
a coordinate obtaining module 2002 configured to obtain, as a target coordinate value, a coordinate value of a contour feature point of the target cosmetic part in the target image;
a grid structure obtaining module 2003, configured to obtain the grid structure of the cosmetic part of the target according to the target coordinate value and a predetermined configuration file, so as to serve as a target grid structure;
an image drawing module 2004 configured to perform makeup processing on the target makeup-done part according to the target grid structure to obtain a makeup image;
the configuration file comprises preset triangles in a mesh structure of a part to be beautified and coordinate values of vertexes of the preset triangles, wherein the preset triangles comprise at least one first type of triangle and a second type of triangle corresponding to the first type of triangle, the vertex of one first type of triangle comprises two stable points and one first extension point, and the vertex of one second type of triangle comprises a first extension point, a switch point and a second extension point in the first type of triangle corresponding to the vertex of one second type of triangle;
the stable point and the switch point are respectively the point with the minimum motion amplitude and the point with the maximum motion amplitude in the contour characteristic points of the cosmetic part in the process of changing the cosmetic part from the first state to the second state, and the first expansion point and the second expansion point are points which are set in advance according to the contour of the cosmetic part.
Therefore, according to the embodiment of the disclosure, a first type triangle is formed by two stable points and a first expansion point, a second type triangle is formed by a first expansion point, a switch point and a second expansion point, that is, a triangle of a mesh structure of a cosmetic part is formed by a double similar triangle structure, so as to form a configuration file, thereby facilitating the configuration file and a coordinate value of a contour feature point of the cosmetic part of a target in a target image, calculating to obtain the target mesh structure of the cosmetic part of the target, and performing cosmetic treatment on the cosmetic part of the target according to the target mesh structure, so as to obtain a cosmetic image.
The first type of triangles comprise a stable point and a first expansion point, so that the state of the target makeup part is changed, the checking result of the first expansion point is not greatly influenced, and the second type of triangles comprise a first expansion point, a switch point and a second expansion point.
Therefore, the embodiment of the disclosure can generate different makeup effects in different states of the target makeup part, thereby solving the problem that the makeup effects are too thick or are bent irregularly to a certain extent.
Example four
Referring to fig. 15, illustrating an image processing apparatus provided by an embodiment of the present disclosure, the image processing apparatus 210 may include:
an image acquisition module 2101 configured to acquire a target image including a target makeup portion;
a coordinate acquiring module 2102 configured to acquire coordinate values of the contour feature point of the target makeup-treated part in the target image as target coordinate values;
a grid structure obtaining module 2103 configured to obtain a grid structure of the cosmetic part of the target as a target grid structure according to the target coordinate value and a predetermined configuration file;
an image drawing module 2104 configured to perform makeup processing on the target makeup-done part according to the target grid structure to obtain a makeup image;
the configuration file comprises preset triangles in a mesh structure of a part to be beautified and coordinate values of vertexes of the preset triangles, wherein the preset triangles comprise at least one first type of triangle and a second type of triangle corresponding to the first type of triangle, the vertex of one first type of triangle comprises two stable points and one first extension point, and the vertex of one second type of triangle comprises a first extension point, a switch point and a second extension point in the first type of triangle corresponding to the vertex of one second type of triangle;
the stable point and the switch point are respectively the point with the minimum motion amplitude and the point with the maximum motion amplitude in the contour characteristic points of the part to be beautified in the process of changing the part to be beautified from the first state to the second state, and the first spreading point and the second spreading point are points which are set in advance according to the contour of the part to be beautified.
Optionally, the apparatus further comprises:
a modification module 2105 configured to modify the predetermined coordinate value of one of the first extension points in the configuration file in response to a first operation of a user;
a saving module 2106 configured to save the modified configuration file;
the grid structure acquisition module 2103 is specifically configured to:
and obtaining the target grid structure according to the target coordinate value and the modified configuration file.
Optionally, the coordinate value of the switch point in the second triangle is a coordinate value of the position of the switch point when the cosmetic part is in the first state, where one second triangle has a target triangle corresponding to the second triangle, the vertex of the target triangle includes the first extension point in the second triangle corresponding to the second triangle, the point at the position of the switch point when the cosmetic part is in the second state, and the target point, and the second triangle is similar to the target triangle corresponding to the second triangle;
the device further comprises:
a first calculating module 2107, configured to calculate a coordinate value of the target point according to a similarity relationship between the second type triangle and the corresponding target triangle, and a coordinate value of a vertex of the second type triangle and a coordinate value of a point at a position where the switch point is located when the cosmetic part is in the second state;
a display module 2108 configured to display a direction pointing from the target point to a corresponding second extension point according to the coordinate values of the target point and the coordinate values of the second extension point;
and the second expansion point corresponding to the target point is a second expansion point in a second type of triangle corresponding to the target triangle to which the target point belongs.
Optionally, the coordinate value of the switch point in the second triangle is a coordinate value of the position of the switch point when the cosmetic part is in the first state, where one second triangle has a target triangle corresponding to the second triangle, the vertex of the target triangle includes the first extension point in the second triangle corresponding to the second triangle, the point at the position of the switch point when the cosmetic part is in the second state, and the target point, and the second triangle is similar to the target triangle corresponding to the second triangle;
the first operation is a modification operation of a coordinate value of a target point displayed on the target interface by a user;
the modification module 2105 comprises:
a first determining submodule 21051 configured to determine, according to the first operation, a coordinate value after modification of a reference point, where the reference point is a target point to which the first operation is directed;
a first calculating submodule 21052, configured to calculate, according to a target triangle to which a reference point belongs, a similarity relationship between the target triangle and a second triangle corresponding to the target triangle, and a target parameter, a coordinate value after modification of a first extension point of the second triangle corresponding to the target triangle to which the reference point belongs;
the target parameters comprise coordinate values after the reference point is modified, coordinate values of a point at the position of the switch point when the cosmetic part is in the first state, coordinate values of a point at the position of the switch point when the cosmetic part is in the second state, and coordinate values of a second expansion point of a second triangle corresponding to the target triangle to which the reference point belongs.
Optionally, the grid structure obtaining module 2103 includes:
a second calculating submodule 21031 configured to calculate, by using a similar triangle algorithm, a coordinate value of a first-class extension point according to a coordinate value of a stable point in a contour feature point of the cosmetic part in the target image and a coordinate value of a vertex of the first-class triangle in the configuration file;
a third computing submodule 21032 configured to calculate, by using a similar triangle algorithm, a coordinate value of a second-class extension point according to a coordinate value of a switch point in a contour feature point of the makeup-treated part in the target image, a coordinate value of the first-class extension point, and a coordinate value of a vertex of a second-class triangle in the configuration file;
a fourth calculating submodule 21033, configured to calculate a coordinate value of a third type extension point according to the coordinate value of the first type extension point, the coordinate value of the second type extension point and the target coordinate value;
a grid structure drawing submodule 21034 configured to obtain the target grid structure according to the coordinate values of the first type extension points, the second type extension points and the third type extension points;
wherein, the first-class extension points are points in the target mesh structure corresponding to the first extension points in the first-class triangles; the second type of extension point is a point in the target mesh structure corresponding to the second extension point in the second type of triangle, and the third type of extension point is other points in the target mesh structure except for the contour feature point of the makeup part in the target image, the first type of extension point and the second type of extension point.
Optionally, the coordinate values of at least some of the third type extension points are determined by using a smooth transition or interpolation method.
Optionally, the preset triangles further include at least one third type of triangle, where the vertex of one third type of triangle includes a third extension point and two points in a target set, the third extension point is a point set in advance according to the contour of the cosmetic part, the target set includes the vertex of the first type of triangle and the vertex of the second type of triangle, and other points excluding the stable point and the switch point in the contour feature points of the cosmetic part;
the fourth computation submodule 21033 is specifically configured to:
and calculating to obtain the coordinate value of the third type extension point by adopting a similar triangle algorithm according to the coordinate value of the first type extension point, the coordinate value of the second type extension point, the target coordinate value and the coordinate value of the vertex of the third type triangle in the configuration file.
Optionally, when the cosmetic part is an eye, the stable points are two eye corner points, and the switch point is a midpoint of an upper eyelid contour.
Therefore, according to the embodiment of the disclosure, a first-class triangle is formed by two stable points and a first extension point, a second-class triangle is formed by a first extension point, a switch point and a second extension point, that is, a triangle of a mesh structure of a part to be beautified is formed by a double-similar-triangle structure, so as to form a configuration file, so that the configuration file and coordinate values of contour feature points of the part to be beautified in a target image are facilitated, the target mesh structure of the part to be beautified is obtained by calculation, and then, the part to be beautified is beautified according to the target mesh structure, so as to obtain the beautified image.
The first type of triangles comprise a stable point and a first expansion point, so that the state of the target makeup part is changed, the checking result of the first expansion point is not greatly influenced, and the second type of triangles comprise a first expansion point, a switch point and a second expansion point.
Therefore, the embodiment of the disclosure can generate different makeup effects in different states of the target makeup part, thereby solving the problem that the makeup effects are too thick or are bent irregularly to a certain extent.
With regard to the apparatus in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be described in detail here.
EXAMPLE five
Referring to fig. 16, a block diagram of an electronic device provided in the present disclosure is shown.
The electronic device of the present disclosure may include: the image processing system comprises a memory, a processor and a program stored on the memory and capable of running on the processor, wherein the program is used for determining action execution and realizing the steps of any image processing method disclosed in the disclosure when the program is executed by the processor.
Fig. 16 is a block diagram illustrating an electronic device 2200 in accordance with an example embodiment. For example, the electronic device 2200 can be a mobile phone, a computer, digital broadcast electronics, messaging devices, game consoles, tablet devices, medical devices, exercise devices, personal digital assistants, and the like.
Referring to fig. 16, electronic device 2200 may include one or more of the following components: processing component 2202, memory 2204, power component 2206, multimedia component 2208, audio component 2210, interface to input/output (I/O) 2212, sensor component 2214, and communication component 2216.
The processing component 2202 generally controls overall operation of the apparatus 2200, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 2202 may include one or more processors 2220 to execute instructions to perform all or part of the steps of the method of image processing described above. Further, the processing component 2202 may include one or more modules that facilitate interaction between the processing component 2202 and other components. For example, the processing component 2202 can include a multimedia module to facilitate interaction between the multimedia component 2208 and the processing component 2202.
The memory 2204 is configured to store various types of data to support operations at the electronic device 2200. Examples of such data include instructions for any application or method operating on the electronic device 2200, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 2204 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The power component 2206 provides power to the various components of the electronic device 2200. The power components 2206 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the electronic device 2200.
The multimedia component 2208 includes a screen that provides an output interface between the electronic device 2200 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 2208 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the electronic device 2200 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
Audio component 2210 is configured to output and/or input audio signals. For example, audio component 2210 includes a Microphone (MIC) configured to receive external audio signals when electronic device 2200 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may further be stored in the memory 2204 or transmitted via the communication component 2216. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
The I/O interface 2212 provides an interface between the processing component 2202 and a peripheral interface module, which may be a keyboard, click wheel, buttons, and the like. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 2214 includes one or more sensors for providing various aspects of state assessment for the electronic device 2200. For example, the sensor assembly 2214 can detect the open/closed status of the electronic device 2200, the relative positioning of components, such as a display and keypad of the electronic device 2200, the sensor assembly 2214 can also detect a change in the position of the electronic device 2200 or a component of the electronic device 2200, the presence or absence of user contact with the electronic device 2200, the orientation or acceleration/deceleration of the apparatus 2200, and a change in the temperature of the electronic device 2200. The sensor assembly 2214 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 2214 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 2214 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 2216 is configured to facilitate wired or wireless communication between the electronic device 2200 and other devices. The electronic device 2200 may have access to a wireless network based on a communication standard, such as WiFi, 2G, or 3G, or a combination thereof. In one exemplary embodiment, the communication section 2216 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 2216 also includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 2200 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing any of the image processing methods described in the present disclosure.
In an exemplary embodiment, a computer-readable storage medium comprising instructions, such as the memory 2204 comprising instructions, executable by the processor 2220 of the electronic device 2200 to perform the image processing method described above is also provided. For example, the computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like. The instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the steps of any of the image processing methods described in the present disclosure.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
The information extraction schemes provided herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing a system incorporating aspects of the present disclosure will be apparent from the foregoing description. Moreover, this disclosure is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the disclosure as described herein, and any descriptions above of specific languages are provided for disclosure of enablement and best mode of the present disclosure.
In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the disclosure may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the disclosure, various features of the disclosure are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be construed to reflect the intent: that is, the claimed disclosure requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this disclosure.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Moreover, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the disclosure and form different embodiments. For example, in the claims, any of the claimed embodiments may be used in any combination.
Various component embodiments of the disclosure may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components in an information extraction scheme according to the present disclosure. The present disclosure may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present disclosure may be stored on a computer-readable medium or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the disclosure, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The disclosure may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.

Claims (18)

1. An image processing method, characterized by comprising:
acquiring a target image containing a part of a target to be beautified;
acquiring coordinate values of the contour feature points of the target makeup-treated part in the target image to serve as target coordinate values;
obtaining a grid structure of the target cosmetic part according to the target coordinate value and a predetermined configuration file to serve as a target grid structure;
performing makeup beautifying treatment on the makeup part of the target according to the target grid structure to obtain a makeup image;
the configuration file comprises preset triangles in a mesh structure of a part to be beautified and coordinate values of vertexes of the preset triangles, wherein the preset triangles comprise at least one first type of triangle and a second type of triangle corresponding to the first type of triangle, the vertex of one first type of triangle comprises two stable points and one first extension point, and the vertex of one second type of triangle comprises a first extension point, a switch point and a second extension point in the first type of triangle corresponding to the vertex of one second type of triangle;
the stable point and the switch point are respectively the point with the minimum motion amplitude and the point with the maximum motion amplitude in the contour characteristic points of the cosmetic part in the process of changing the cosmetic part from the first state to the second state, and the first expansion point and the second expansion point are points which are set in advance according to the contour of the cosmetic part.
2. The image processing method according to claim 1, wherein before the obtaining of the target image including the cosmetic portion of the target, the method further comprises:
in response to a first operation of a user, modifying the coordinate value of one of the predetermined first extension points in the configuration file;
saving the modified configuration file;
the obtaining of the grid structure of the cosmetic part of the target according to the target coordinate values and a predetermined configuration file comprises:
and obtaining the target grid structure according to the target coordinate value and the modified configuration file.
3. The image processing method according to claim 1, wherein the coordinate values of the switch point in the second triangle type are coordinate values of the position of the switch point when the cosmetic part is in the first state, wherein one second triangle type has a target triangle corresponding thereto, the vertex of the target triangle includes the first extension point in the second triangle type corresponding thereto, the point at which the switch point is located when the cosmetic part is in the second state, and the target point, and the second triangle type is similar to the target triangle corresponding thereto;
before the acquiring the target image containing the cosmetic part of the target, the method further comprises the following steps:
calculating the coordinate value of the target point according to the similarity relation between the second type of triangle and the corresponding target triangle, the coordinate value of the vertex of the second type of triangle and the coordinate value of the point at the position of the switch point when the cosmetic part is in the second state;
displaying the direction pointing from the target point to the corresponding second expansion point according to the coordinate value of the target point and the coordinate value of the second expansion point;
and the second expansion point corresponding to the target point is a second expansion point in a second type of triangle corresponding to the target triangle to which the target point belongs.
4. The image processing method according to claim 2, wherein the coordinate values of the switch point in the second triangle type are coordinate values of the position of the switch point when the cosmetic part is in the first state, wherein one second triangle type has a target triangle corresponding thereto, the vertex of the target triangle includes the first extension point in the second triangle type corresponding thereto, the point at which the switch point is located when the cosmetic part is in the second state, and the target point, and the second triangle type is similar to the target triangle corresponding thereto;
the first operation is modification operation of a coordinate value of a target point displayed on a target interface by a user;
the modifying the coordinate value of one of the predetermined first extension points in the configuration file in response to the first operation of the user comprises:
according to the first operation, determining a coordinate value of a modified reference point, wherein the reference point is a target point aimed at by the first operation;
calculating the coordinate value of the modified first extension point of the second triangle corresponding to the target triangle to which the reference point belongs according to the target triangle to which the reference point belongs, the similarity relation of the second triangle corresponding to the target triangle and the target parameter;
the target parameters comprise coordinate values after the reference point is modified, coordinate values of a point at the position of the switch point when the cosmetic part is in the first state, coordinate values of a point at the position of the switch point when the cosmetic part is in the second state, and coordinate values of a second expansion point of a second triangle corresponding to the target triangle to which the reference point belongs.
5. The image processing method according to claim 1, wherein obtaining the grid structure of the cosmetic part of the object according to the coordinate values of the object and a predetermined configuration file comprises:
calculating to obtain coordinate values of a first-class extension point according to the coordinate values of a stable point in the contour feature points of the cosmetic part in the target image and the coordinate values of the vertexes of the first-class triangles in the configuration file by adopting a similar triangle algorithm;
calculating to obtain coordinate values of a second type of extension points by adopting a similar triangle algorithm according to the coordinate values of a switch point in the contour feature points of the cosmetic part in the target image, the coordinate values of the first type of extension points and the coordinate values of the vertexes of the second type of triangle in the configuration file;
calculating to obtain a coordinate value of a third type extension point according to the coordinate value of the first type extension point, the coordinate value of the second type extension point and the target coordinate value;
obtaining the target grid structure according to the coordinate values of the first type of extension points, the second type of extension points and the third type of extension points;
wherein, the first-class extension points are points in the target mesh structure corresponding to the first extension points in the first-class triangles; the second type of extension point is a point in the target mesh structure corresponding to the second extension point in the second type of triangle, and the third type of extension point is other points in the target mesh structure except for the contour feature point of the makeup part in the target image, the first type of extension point and the second type of extension point.
6. The image processing method according to claim 5, wherein the coordinate values of at least some of the third-class extension points are determined by using a smooth transition or interpolation method.
7. The image processing method according to claim 5, wherein the preset triangles further include at least one triangle of a third type, wherein vertices of the triangle of the third type include a third expansion point and two points of a target set, the third expansion point is a point which is set in advance according to the contour of the cosmetic part, the target set includes vertices of the triangle of the first type and vertices of the triangle of the second type, and other points of the contour feature points of the cosmetic part excluding the stable point and the switch point;
the step of obtaining a coordinate value of a third type extension point by calculation according to the coordinate value of the first type extension point, the coordinate value of the second type extension point and the target coordinate value includes:
and calculating to obtain the coordinate value of the third type extension point by adopting a similar triangle algorithm according to the coordinate value of the first type extension point, the coordinate value of the second type extension point, the target coordinate value and the coordinate value of the vertex of the third type triangle in the configuration file.
8. The image processing method according to claim 1, wherein when the part to be made up is an eye, the stable points are two eye corner points, and the switch point is a midpoint of an upper eyelid contour.
9. An image processing apparatus characterized by comprising:
an image acquisition module configured to acquire a target image including a target makeup part;
a coordinate acquisition module configured to acquire coordinate values of the contour feature points of the cosmetic part of the target in the target image as target coordinate values;
the grid structure acquisition module is configured to obtain a grid structure of the cosmetic part of the target according to the target coordinate value and a predetermined configuration file to serve as a target grid structure;
the image drawing module is configured to perform makeup processing on the target makeup part according to the target grid structure to obtain a makeup image;
the configuration file comprises preset triangles in a grid structure of a cosmetic part and coordinate values of vertexes of the preset triangles, wherein the preset triangles comprise at least one first type of triangle and a second type of triangle corresponding to the first type of triangle, the vertex of one first type of triangle comprises two stable points and a first expansion point, and the vertex of one second type of triangle comprises a first expansion point, a switch point and a second expansion point in the first type of triangle corresponding to the vertex of the second type of triangle;
the stable point and the switch point are respectively the point with the minimum motion amplitude and the point with the maximum motion amplitude in the contour characteristic points of the cosmetic part in the process of changing the cosmetic part from the first state to the second state, and the first expansion point and the second expansion point are points which are set in advance according to the contour of the cosmetic part.
10. The image processing apparatus according to claim 9, characterized in that the apparatus further comprises:
the modification module is configured to modify a predetermined coordinate value of one first extension point in the configuration file in response to a first operation of a user;
a saving module configured to save the modified configuration file;
the grid structure acquisition module is specifically configured to:
and obtaining the target grid structure according to the target coordinate value and the modified configuration file.
11. The image processing apparatus according to claim 9, wherein the coordinate value of the switch point in the second triangle is a coordinate value of a position of the switch point when the cosmetic portion is in the first state, wherein a second triangle exists as a target triangle corresponding to the second triangle, and the vertex of the target triangle includes the first extension point in the second triangle, the point at which the switch point is located when the cosmetic portion is in the second state, and the target point, and the second triangle is similar to the target triangle corresponding to the second triangle;
the device further comprises:
the first calculation module is configured to calculate the coordinate value of the target point according to the similarity relation between the second type triangle and the corresponding target triangle, the coordinate value of the vertex of the second type triangle and the coordinate value of the point at the position of the switch point when the cosmetic part is in the second state;
the display module is configured to display the direction pointing from the target point to the corresponding second expansion point according to the coordinate values of the target point and the coordinate values of the second expansion point;
and the second expansion point corresponding to the target point is the second expansion point in the second type of triangle corresponding to the target triangle to which the target point belongs.
12. The image processing apparatus according to claim 10, wherein the coordinate value of the switch point in the second triangle is a coordinate value of a position of the switch point when the cosmetic portion is in the first state, wherein a second triangle exists as a target triangle corresponding to the second triangle, and the vertex of the target triangle includes the first extension point in the second triangle, the point at which the switch point is located when the cosmetic portion is in the second state, and the target point, and the second triangle is similar to the target triangle corresponding to the second triangle;
the first operation is modification operation of a coordinate value of a target point displayed on a target interface by a user;
the modification module comprises:
a first determining submodule configured to determine, according to the first operation, a coordinate value of a modified reference point, where the reference point is a target point to which the first operation is directed;
the first calculation submodule is configured to calculate a coordinate value after modification of a first extension point of a second type of triangle corresponding to a target triangle to which a reference point belongs according to the target triangle to which the reference point belongs, a similarity relation between the target triangle and the second type of triangle corresponding to the target triangle, and a target parameter;
the target parameters comprise coordinate values after the reference point is modified, coordinate values of a point at the position of the switch point when the cosmetic part is in the first state, coordinate values of a point at the position of the switch point when the cosmetic part is in the second state, and coordinate values of a second expansion point of a second triangle corresponding to the target triangle to which the reference point belongs.
13. The image processing apparatus according to claim 9, wherein the mesh structure acquisition module includes:
the second calculation submodule is configured to calculate a coordinate value of a first-class extension point according to a coordinate value of a stable point in a contour feature point of the makeup-treated part in the target image and a coordinate value of a vertex of a first-class triangle in the configuration file by adopting a similar triangle algorithm;
the third calculation submodule is configured to calculate and obtain a coordinate value of a second type of extension point according to a coordinate value of a switch point in a contour feature point of a makeup part in the target image, a coordinate value of the first type of extension point and a coordinate value of a vertex of a second type of triangle in the configuration file by adopting a similar triangle algorithm;
the fourth calculation submodule is configured to calculate a coordinate value of a third type extension point according to the coordinate value of the first type extension point, the coordinate value of the second type extension point and the target coordinate value;
the grid structure drawing submodule is configured to obtain the target grid structure according to the coordinate values of the first type of extension points, the second type of extension points and the third type of extension points;
wherein, the first-class extension points are points in the target mesh structure corresponding to the first extension points in the first-class triangles; the second type of extension point is a point in the target mesh structure corresponding to the second extension point in the second type of triangle, and the third type of extension point is other points in the target mesh structure except for the contour feature point of the makeup part in the target image, the first type of extension point and the second type of extension point.
14. The image processing apparatus according to claim 13, wherein the coordinate values of at least some of the third-class extension points are determined using a smooth transition or interpolation method.
15. The image processing apparatus according to claim 13, wherein the preset triangles further include at least one triangle of a third type, wherein vertices of the triangle of the third type include a third extension point and two points of a target set, the third extension point is a point that is set in advance according to the contour of the cosmetic part, the target set includes vertices of the triangle of the first type and vertices of the triangle of the second type, and other points of the contour feature points of the cosmetic part excluding the stable point and the switch point;
the fourth computing submodule is particularly configured to:
and calculating to obtain the coordinate value of the third type extension point by adopting a similar triangle algorithm according to the coordinate value of the first type extension point, the coordinate value of the second type extension point, the target coordinate value and the coordinate value of the vertex of the third type triangle in the configuration file.
16. The image processing apparatus according to claim 9, wherein when the cosmetic portion is an eye, the stable points are two eye corner points, and the switch point is a midpoint of an upper eyelid contour.
17. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to perform operations performed to implement the image processing method of any of claims 1 to 8.
18. A storage medium, wherein instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform operations performed by the image processing method of any one of claims 1 to 8.
CN202010859036.0A 2020-08-24 2020-08-24 Image processing method, image processing device, electronic equipment and storage medium Active CN114095646B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202010859036.0A CN114095646B (en) 2020-08-24 2020-08-24 Image processing method, image processing device, electronic equipment and storage medium
PCT/CN2021/114378 WO2022042570A1 (en) 2020-08-24 2021-08-24 Image processing method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010859036.0A CN114095646B (en) 2020-08-24 2020-08-24 Image processing method, image processing device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114095646A CN114095646A (en) 2022-02-25
CN114095646B true CN114095646B (en) 2022-08-26

Family

ID=80295631

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010859036.0A Active CN114095646B (en) 2020-08-24 2020-08-24 Image processing method, image processing device, electronic equipment and storage medium

Country Status (2)

Country Link
CN (1) CN114095646B (en)
WO (1) WO2022042570A1 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107977934A (en) * 2017-11-10 2018-05-01 北京小米移动软件有限公司 Image processing method and device
CN108986016A (en) * 2018-06-28 2018-12-11 北京微播视界科技有限公司 Image beautification method, device and electronic equipment
CN109063560A (en) * 2018-06-28 2018-12-21 北京微播视界科技有限公司 Image processing method, device, computer readable storage medium and terminal
US20200034979A1 (en) * 2015-12-28 2020-01-30 Andrew John-Haidukewych Hayduke System and method of analyzing features of the human face and breasts using one or more overlay grids
CN111047511A (en) * 2019-12-31 2020-04-21 维沃移动通信有限公司 Image processing method and electronic equipment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017149315A1 (en) * 2016-03-02 2017-09-08 Holition Limited Locating and augmenting object features in images
CN109584151B (en) * 2018-11-30 2022-12-13 腾讯科技(深圳)有限公司 Face beautifying method, device, terminal and storage medium
CN111489311B (en) * 2020-04-09 2023-08-08 北京百度网讯科技有限公司 Face beautifying method and device, electronic equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200034979A1 (en) * 2015-12-28 2020-01-30 Andrew John-Haidukewych Hayduke System and method of analyzing features of the human face and breasts using one or more overlay grids
CN107977934A (en) * 2017-11-10 2018-05-01 北京小米移动软件有限公司 Image processing method and device
CN108986016A (en) * 2018-06-28 2018-12-11 北京微播视界科技有限公司 Image beautification method, device and electronic equipment
CN109063560A (en) * 2018-06-28 2018-12-21 北京微播视界科技有限公司 Image processing method, device, computer readable storage medium and terminal
CN111047511A (en) * 2019-12-31 2020-04-21 维沃移动通信有限公司 Image processing method and electronic equipment

Also Published As

Publication number Publication date
CN114095646A (en) 2022-02-25
WO2022042570A1 (en) 2022-03-03

Similar Documents

Publication Publication Date Title
CN110675310B (en) Video processing method and device, electronic equipment and storage medium
CN107680033B (en) Picture processing method and device
CN107818543B (en) Image processing method and device
CN107330868B (en) Picture processing method and device
CN109242765B (en) Face image processing method and device and storage medium
CN107958439B (en) Image processing method and device
CN107977934B (en) Image processing method and device
CN107341777B (en) Picture processing method and device
CN107657590B (en) Picture processing method and device and storage medium
CN112767288B (en) Image processing method and device, electronic equipment and storage medium
CN109840939A (en) Three-dimensional rebuilding method, device, electronic equipment and storage medium
US20210118148A1 (en) Method and electronic device for changing faces of facial image
CN112669198A (en) Image special effect processing method and device, electronic equipment and storage medium
CN114387445A (en) Object key point identification method and device, electronic equipment and storage medium
CN110782532B (en) Image generation method, image generation device, electronic device, and storage medium
CN114095646B (en) Image processing method, image processing device, electronic equipment and storage medium
CN105635573B (en) Camera visual angle regulating method and device
CN111538451A (en) Weather element display method and device and storage medium
CN115379195A (en) Video generation method and device, electronic equipment and readable storage medium
CN112614227A (en) Method and device for realizing special effect of image, electronic equipment and storage medium
WO2022042160A1 (en) Image processing method and apparatus
CN112184540A (en) Image processing method, image processing device, electronic equipment and storage medium
US11948266B1 (en) Virtual object manipulation with gestures in a messaging system
US20240087245A1 (en) Gestures to enable menus using augmented reality content in a messaging system
US20240087244A1 (en) Cursor functionality for augmented reality content in messaging systems

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