WO2022042570A1 - Image processing method and apparatus - Google Patents

Image processing method and apparatus Download PDF

Info

Publication number
WO2022042570A1
WO2022042570A1 PCT/CN2021/114378 CN2021114378W WO2022042570A1 WO 2022042570 A1 WO2022042570 A1 WO 2022042570A1 CN 2021114378 W CN2021114378 W CN 2021114378W WO 2022042570 A1 WO2022042570 A1 WO 2022042570A1
Authority
WO
WIPO (PCT)
Prior art keywords
point
triangle
type
target
coordinate value
Prior art date
Application number
PCT/CN2021/114378
Other languages
French (fr)
Chinese (zh)
Inventor
王剑
汪洋
杨浩
Original Assignee
北京达佳互联信息技术有限公司
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 北京达佳互联信息技术有限公司 filed Critical 北京达佳互联信息技术有限公司
Publication of WO2022042570A1 publication Critical patent/WO2022042570A1/en

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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/04Context-preserving transformations, e.g. by using an importance map
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • 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

Definitions

  • the present disclosure relates to the field of computer technology, and in particular, to an image processing method and apparatus.
  • the present disclosure provides an image processing method and apparatus.
  • an image processing method comprising:
  • the grid structure of the part to be beautified is obtained as the target grid structure
  • beauty makeup processing is performed on the beauty makeup part to obtain a beauty makeup image
  • the configuration file includes a preset triangle in the mesh structure of the part to be beautified and coordinate values of vertices of the preset triangle, and the preset triangle includes at least one first-type triangle and a A triangle of the second type corresponds to a triangle of the first type, the vertex of a triangle of the first type includes two stable points and a first extension point, and the vertex of a triangle of the second type includes the first extension point of the corresponding triangle of the first type , a switch point and a second expansion point;
  • the stable point and the switch point are respectively the point with the smallest movement range and the one with the largest movement range among the contour feature points of the beautified part in the process of changing from the first state to the second state of the beautified part.
  • point, the first extension point and the second extension point are points set in advance according to the contour of the part to be beautified.
  • the method further includes:
  • the grid structure of the part to be beautified is obtained according to the target coordinate value and a predetermined configuration file, including:
  • the target grid structure is obtained.
  • the coordinate value of the switch point in the second type of triangle is the coordinate value of the position of the switch point when the cosmetic part is in the first state
  • a triangle of the second type is There is a target triangle corresponding to it, and the vertex of the target triangle includes the first expansion point in the corresponding second type of triangle, and the point on the position of the switch point when the cosmetic part is in the second state and the target point, the second type of triangle is similar to its corresponding target triangle;
  • the method also includes:
  • the point at the position of the switch point when the part to be beautified is in the second state
  • the coordinate value of calculate the coordinate value of the target point
  • the second extension point corresponding to the target point is the second extension point in the second type of triangle corresponding to the target triangle to which the target point belongs.
  • the coordinate value of the switch point in the second type of triangle is the coordinate value of the position of the switch point when the cosmetic part is in the first state
  • a triangle of the second type is There is a target triangle corresponding to it, and the vertex of the target triangle includes the first expansion point in the corresponding second type of triangle, and the point on the position of the switch point when the cosmetic part is in the second state and the target point, the second type of triangle is similar to its corresponding target triangle;
  • the first operation is a user's modification operation on the coordinate value of a target point displayed on the target interface
  • the modifying the predetermined coordinate value of one of the first extension points in the configuration file in response to the user's first operation includes:
  • the modified coordinate value of a reference point is determined, and the reference point is the target point targeted by the first operation;
  • the similarity relationship of the second type of triangle corresponding to the target triangle, and the target parameters calculate the modified first extension point of the second type of triangle corresponding to the target triangle to which the reference point belongs. coordinate value;
  • the target parameter includes the modified coordinate value of the reference point, the coordinate value of the point where the switch point is located when the cosmetic part is in the first state, and the cosmetic part is in the first state.
  • the second state the coordinate value of the point where the switch point is located, and the coordinate value of the second extension point of the second type of triangle corresponding to the target triangle to which the reference point belongs.
  • the grid structure of the part to be beautified is obtained, including:
  • the first type is calculated.
  • the coordinate value of the first type of extension point calculates the coordinate value of the third type of extension point
  • the first type of extension point is a point in the target grid structure that corresponds to the first extension point in the first type of triangle; the second type of extension point is in the target grid structure , the point corresponding to the second expansion point in the second type of triangle, and the third type of expansion point is the contour feature point of the makeup part in the target image except the contour feature point in the target image, all the Points other than the first type of extension point and the second type of extension point.
  • the coordinate values of at least some points in the third type of extension points are determined by using a smooth transition or interpolation method.
  • the preset triangle further includes at least one triangle of the third type, wherein the vertex of a triangle of the third type includes a third extension point and two of the points in the target set, and the third extension point is The points set in advance according to the contour of the part to be beautified, the target set includes the vertices of the first type of triangle and the vertex of the second type of triangle, as well as the contour feature points of the part to be beautified. points other than the stable point and the switching point;
  • the coordinate value of the first type of extension point is calculated and obtained, including:
  • the stable points are two corner points, and the switch point is the midpoint of the contour of the upper eyelid.
  • an image processing apparatus comprising:
  • an image acquisition module configured to acquire a target image containing the part to be beautified
  • a coordinate acquisition module configured to acquire the coordinate value of the contour feature point of the part to be beautified in the target image, as the target coordinate value;
  • a grid structure acquisition module configured to obtain the grid structure of the part to be beautified according to the target coordinate value and a predetermined configuration file, as a target grid structure
  • an image drawing module configured to perform beauty makeup processing on the beautified part according to the target grid structure to obtain a beauty makeup image
  • the configuration file includes a preset triangle in the mesh structure of the part to be beautified and coordinate values of vertices of the preset triangle, and the preset triangle includes at least one first-type triangle and a A triangle of the second type corresponds to a triangle of the first type, the vertex of a triangle of the first type includes two stable points and a first extension point, and the vertex of a triangle of the second type includes the first extension point of the corresponding triangle of the first type , a switch point and a second expansion point;
  • the stable point and the switch point are respectively the point with the smallest movement range and the one with the largest movement range among the contour feature points of the beautified part in the process of changing from the first state to the second state of the beautified part.
  • point, the first extension point and the second extension point are points set in advance according to the contour of the part to be beautified.
  • the device further includes:
  • a modification module configured to modify the predetermined coordinate value of one of the first extension points in the configuration file in response to the user's first operation
  • a saving module configured to save the modified configuration file
  • the grid structure acquisition module is specifically configured as:
  • the target grid structure is obtained.
  • the coordinate value of the switch point in the second type of triangle is the coordinate value of the position of the switch point when the cosmetic part is in the first state
  • a triangle of the second type is There is a target triangle corresponding to it, and the vertex of the target triangle includes the first expansion point in the corresponding second type of triangle, and the point on the position of the switch point when the cosmetic part is in the second state and the target point, the second type of triangle is similar to its corresponding target triangle;
  • the device also includes:
  • the first calculation module is configured to describe the second type of triangle according to the similarity relationship between the second type of triangle and its corresponding target triangle, as well as the coordinate value of the vertex of the second type of triangle, when the part to be beauty makeup is in the second state.
  • the coordinate value of the point at the position of the switch point, and the coordinate value of the target point is calculated;
  • a display module configured to display a direction from the target point to the corresponding second extension point according to the coordinate value of the target point and the coordinate value of the second extension point;
  • the second extension point corresponding to the target point is the second extension point in the second type of triangle corresponding to the target triangle to which the target point belongs.
  • the coordinate value of the switch point in the second type of triangle is the coordinate value of the position of the switch point when the cosmetic part is in the first state
  • a triangle of the second type is There is a target triangle corresponding to it, and the vertex of the target triangle includes the first expansion point in the corresponding second type of triangle, and the point on the position of the switch point when the cosmetic part is in the second state and the target point, the second type of triangle is similar to its corresponding target triangle;
  • the first operation is a user's modification operation on the coordinate value of a target point displayed on the target interface
  • the modification module includes:
  • a first determination submodule configured to determine, according to the first operation, a modified coordinate value of a reference point, where the reference point is a target point targeted by the first operation;
  • the first calculation sub-module is configured to calculate the second type of 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 relationship of the second type of triangle corresponding to the target triangle, and the target parameter.
  • the target parameter includes the modified coordinate value of the reference point, the coordinate value of the point where the switch point is located when the cosmetic part is in the first state, and the cosmetic part is in the first state.
  • the second state the coordinate value of the point where the switch point is located, and the coordinate value of the second extension point of the second type of triangle corresponding to the target triangle to which the reference point belongs.
  • the grid structure acquisition module includes:
  • the second calculation sub-module is configured to adopt a similar triangle algorithm, according to the coordinate value of the stable point in the contour feature points of the part to be beautified in the target image, and the vertices of the first type of triangle in the configuration file.
  • the coordinate value of calculate the coordinate value of the first type of extension point;
  • the third calculation sub-module is configured to adopt a similar triangle algorithm, according to the coordinate value of the switch point in the contour feature points of the part to be beautified in the target image, the coordinate value of the first type of extension point and the The coordinate value of the vertex of the second type of triangle in the configuration file is calculated to obtain the coordinate value of the second type of extension point;
  • the fourth calculation submodule is configured to calculate the coordinate value of the third type of expansion point according to the coordinate value of the first type of expansion point, the coordinate value of the second type of expansion point and the target coordinate value;
  • a grid structure drawing submodule configured to obtain the target grid according to the coordinate values of the first type of extension points, the coordinate values of the second type of extension points and the coordinate values of the third type of extension points structure;
  • the first type of extension point is a point in the target grid structure that corresponds to the first extension point in the first type of triangle; the second type of extension point is in the target grid structure , the point corresponding to the second expansion point in the second type of triangle, and the third type of expansion point is the contour feature point of the makeup part in the target image except the contour feature point in the target image, all the Points other than the first type of extension point and the second type of extension point.
  • the coordinate values of at least some points in the third type of extension points are determined by using a smooth transition or interpolation method.
  • the preset triangle further includes at least one triangle of the third type, wherein the vertex of a triangle of the third type includes a third extension point and two of the points in the target set, and the third extension point is The points set in advance according to the contour of the part to be beautified, the target set includes the vertices of the first type of triangle and the vertex of the second type of triangle, as well as the contour feature points of the part to be beautified. points other than the stable point and the switching point;
  • the fourth computing submodule is specifically configured as:
  • the stable points are two corner points, and the switch point is the midpoint of the contour of the upper eyelid.
  • an electronic device comprising:
  • a memory for storing the processor-executable instructions
  • the processor is configured to execute the operations performed by any one of the image processing methods described above.
  • a computer-readable storage medium wherein, when the instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute any one of the images described above. The action performed by the handler method.
  • a computer program product comprising one or more instructions, the one or more instructions can be executed by a processor of an electronic device when executed , so that the electronic device can perform an operation performed by the image processing method provided by the present disclosure.
  • two stable points and a first expansion point are used to form a first type of triangle
  • a first expansion point, a switching point and a second expansion point are used to form a second type of triangle, that is, a double similar triangle structure
  • the triangles that make up the mesh structure of the part to be beautified form a configuration file, so that the configuration file and the coordinate values of the contour feature points of the part to be beautified in the target image are calculated to obtain the target mesh of the part to be beautified.
  • beauty makeup processing is performed on the part to be beautified to obtain a beauty makeup image.
  • the first type of triangle includes a stable point and a first expansion point, so that the state change of the part to be beautified has little effect on the verification result of the first expansion point
  • the second type of triangle includes the first expansion point
  • the switch point and the second expansion point when the second expansion point is checked, when the cosmetic part is in a different state, the change of the verification result of the second expansion point depends on the different states of the switch point in the beautified part. It can be seen that the target grid structure generated according to the above configuration file can follow the change of the state of the part to be beautified to produce different changes, so as to produce different cosmetic effects in different states of the part to be beautified.
  • the embodiments of the present disclosure can produce different cosmetic effects in different states of the part to be beautified.
  • the points included in the configuration file have a one-to-one correspondence with the points in the target grid structure to be calculated, and then an extension point in the configuration file is checked and calculated, that is, the calculation configuration file.
  • the coordinates of the corresponding point in the target grid structure for this extension point in .
  • FIG. 1 is a schematic diagram showing the comparison of the display and beauty effects of the human eye in different states using the grid structure constructed in the prior art
  • FIG. 2 is a flowchart of an image processing method according to Embodiment 1 of the present disclosure
  • FIG. 3 is a flowchart of an image processing method according to Embodiment 2 of the present disclosure.
  • FIG. 4 is a schematic flowchart of a configuration file from design to use in an embodiment of the present disclosure
  • FIG. 5 is a schematic diagram of a design flow of a first-type triangle and a second-type triangle in an embodiment of the present disclosure
  • FIG. 6 is a schematic diagram of a point structure set for the cosmetic effect of the blinking eye corner extension in an embodiment of the present disclosure
  • FIG. 7 is a schematic diagram of a point structure set for the beauty effect of blinking the corner of the eye raised in an embodiment of the present disclosure
  • FIG. 8 is a schematic diagram of a first type of triangle formed in a configuration file in an embodiment of the present disclosure
  • FIG. 9 is a schematic diagram of a second type of triangle formed in a configuration file in an embodiment of the present disclosure.
  • FIG. 10 is one of the schematic diagrams of the third type of triangle formed in a configuration file in an embodiment of the present disclosure
  • FIG. 11 is a second schematic diagram of a third type of triangle formed in a configuration file in an embodiment of the present disclosure.
  • FIG. 12 is a schematic display diagram of a direction in which a target point points to its corresponding second expansion point in an embodiment of the present disclosure
  • FIG. 13 is a schematic diagram showing a grid structure obtained by using a configuration file in an embodiment of the present disclosure in different states of the human eye and comparison of beauty effects;
  • FIG. 14 is a structural block diagram of an image processing apparatus according to Embodiment 3 of the present disclosure.
  • FIG. 15 is a structural block diagram of an image processing apparatus according to Embodiment 4 of the present disclosure.
  • FIG. 16 is a structural block diagram of an electronic device according to Embodiment 5 of the present disclosure.
  • 17 is a schematic diagram of the principle of solving one of the angles of a triangle formed by the three points with the coordinates of known three points in an embodiment of the present disclosure
  • FIG. 18 is a schematic diagram of the principle of a similar triangle algorithm in an embodiment of the present disclosure.
  • an image processing method provided by an embodiment of the present disclosure is shown, and the image processing method may include the following steps:
  • Step 801 Acquire a target image including the part to be beautified.
  • the target image may be a locally stored image, an image captured in real time by an electronic device, or one of the images in a locally stored video file, or one of the video files captured in real time by an electronic device. frame image.
  • Step 802 Acquire the coordinate value of the contour feature point of the part to be beautified in the target image, as the target coordinate value.
  • contour feature points are points located on the contour of the part to be beautified.
  • Step 803 According to the target coordinate value and the predetermined configuration file, obtain the grid structure of the part to be beautified, as the target grid structure.
  • the configuration file includes a preset triangle in the mesh structure of the part to be beautified and coordinate values of vertices of the preset triangle, and the preset triangle includes at least one first-type triangle and a A triangle of the second type corresponds to a triangle of the first type.
  • the vertex of a triangle of the first type includes two stable points and a first extension point, and the vertex of a triangle of the second type includes the first extension point of the corresponding triangle of the first type. , a switch point and a second expansion point;
  • the stable point and the switch point are respectively the point with the smallest movement range and the one with the largest movement range among the contour feature points of the beautified part in the process of changing from the first state to the second state of the beautified part. point.
  • the stable point is the point at which the movement range is the smallest among the contour feature points of the part to be made-up during the process of changing from the first state to the second state of the part to be made-up;
  • the point with the largest movement range among the contour feature points of the beauty makeup part, the first extension point and the second extension point It is a point set in advance according to the contour of the part to be beautified.
  • the configuration file includes multiple points, and the multiple points include contour feature points of the part to be beautified and manually set points (ie, extension points).
  • the configuration file for eyes may include points 39-50, points 401-404, points 481-484, and points 423-478 as shown in FIG. 8, wherein points 39-50 in FIG. 8 are contour features Points, points 401 to 404, points 481 to 484, and points 423 to 478 are all extension points.
  • the multiple points included in the configuration file form multiple triangles according to certain rules. The rules for forming triangles are predetermined.
  • the configuration file is used as the basis for generating the grid structure in the process of beautifying the part to be beautified.
  • a known configuration file when beautifying the part to be beautified, it is first necessary to obtain an image of the part to be beautified, and then detect the contour feature points of the part to be beautified in the image, and then extract the contour features from these contour features.
  • the points corresponding to the contour feature points included in the configuration file are selected from the points as input parameters, and then the input parameters and configuration files are used to calculate the extension points that constitute the grid structure, and then all contour feature points included in the input parameters and All calculated extension points are drawn as a grid structure.
  • the pre-drawn beautification picture is drawn to the part to be beautified, so as to realize the beauty of the part to be beautified.
  • an intermediate point needs to be generated, which can be called a "leverage point (ie the first extension point)", which is also a manually set point.
  • the two AI points ie, contour feature points
  • the two AI points ie, contour feature points
  • the two AI points for checking and calculating it require special selection, that is, points with relatively stable positions during the blinking process need to be selected. This can ensure that the position of the lever point is stable during the entire movement process, which is convenient for subsequent processing.
  • the positions of the two points located at the corner of the eye are almost unchanged. Therefore, these two points are stable points, that is, the points A1 and A2 in Figure 5 are stable points, then the point A1 in Figure 5 is the stable point.
  • A2, and A form a triangle of the first kind.
  • the movement trajectory of this point can be called the "switching path".
  • the "switch point” of the eye is obviously the center point of the upper eyelid, which has the largest movement range in the blinking action in the real world.
  • it is hoped that the movement trajectory of the "final point (ie, the second expansion point)" is synchronized with the movement rhythm of the switch point in the switch trajectory.
  • the first extension point of a first type of triangle is also used as the vertex of the second type of triangle. Therefore, the embodiment of the present invention adopts double similar triangles.
  • first-type triangles and a second-type triangle corresponding to each first-type triangle can be obtained.
  • points 401 to 404 are all lever points (ie, the first expansion point)
  • points 481 to 484 are the final points (ie, the second expansion point)
  • point 42 is the switch point
  • the first type of triangles in this configuration file includes triangles connected by dashed lines as shown in FIG. 8
  • the second type of triangles includes triangles connected by dashed lines as shown in FIG. 9 .
  • the grid structure of the part to be beautified is obtained, including:
  • the first type of triangle is calculated.
  • the coordinate value of the first type of extension point calculates the coordinate value of the third type of extension point
  • the first type of extension point is a point in the target grid structure that corresponds to the first extension point in the first type of triangle; the second type of extension point is in the target grid structure , the point corresponding to the second expansion point in the second type of triangle, and the third type of expansion point is the contour feature point of the makeup part in the target image except the contour feature point in the target image, all the Points other than the first type of extension point and the second type of extension point.
  • the configuration file includes the first type of triangle and the second type of triangle, and the first extension point of the first type of triangle is also a vertex of the second type of triangle. Therefore, in the embodiment using the present disclosure configuration file, when calculating the expansion point of the target mesh structure, there is a calculation sequence, that is, the first expansion point of the first type of triangle is checked first, and then the second expansion point of the second type of triangle is checked. Specifically, for example, in the configuration file shown in Figure 8, it is necessary to first check the points 401 to 404 according to the triangle shown by the dotted line in Figure 8, and then check the points 481 to 484 according to the triangle shown by the dotted line in Figure 5, and then again , check other extension points in the static configuration file. Wherein, in the process of checking and calculating other extension points in the static configuration file, other extension points are checked and calculated based on the known points in the previous process (including the known contour feature points and the empirically calculated extension points).
  • the coordinate values of at least some points in the third type of extension points are determined by using a smooth transition or interpolation method.
  • the related extension points adjacent to them can be generated by means of smooth transition or difference interpolation, which can reduce the amount of calculation and improve the processing speed.
  • the preset triangle further includes at least one triangle of the third type, wherein the vertex of a triangle of the third type includes a third extension point and two of the points in the target set, and the third extension point is The points set in advance according to the contour of the part to be beautified, the target set includes the vertices of the first type of triangle and the vertex of the second type of triangle, as well as the contour feature points of the part to be beautified. points other than the stable point and the switching point;
  • the coordinate value of the first type of extension point is calculated and obtained, including:
  • a configuration file may also include a third extension point, and two points among the contour feature points of the part to be beauty makeup, the first extension point, and the second extension point. , such as the triangles shown in dashed lines in Figures 10 and 11.
  • the points included in the configuration file have a one-to-one correspondence with the points in the target grid structure to be calculated, and the preset triangles included in the configuration file are in a one-to-one relationship with the triangles included in the target grid structure.
  • One-to-one correspondence and similarity the above-mentioned similar triangle algorithm is used, according to the coordinate value of the stable point in the contour feature points of the part to be beautified in the target image, and the vertices of the first type of triangle in the configuration file. Coordinate value, the process of calculating the coordinate value of the first type of extension point is as follows:
  • the similarity relationship with the triangle corresponding to the first type of triangle in the target mesh structure, and the stable point in the contour feature points of the makeup part in the target image The coordinate value and the coordinate value of the vertex of the first type of triangle in the configuration file are calculated to obtain the coordinate value of the first type of extension point.
  • the above “adopting the similar triangle algorithm, according to the coordinate value of the switch point in the contour feature point of the part to be beautified in the target image, the coordinate value of the first type of extension point and the The process of calculating the coordinate values of the vertices of the second type of triangle to obtain the coordinate value of the second type of extension point" is the same as the above process of "using the similar triangle algorithm, according to the coordinate value of the first type of extension point, the second type of extension point".
  • A, B, C that is, A, B are AI points, C is an extension point.
  • the other two points are provided by the AI module, and their values are the values of screen coordinates, which are named A ⁇ and B ⁇ here.
  • a and A ⁇ , B and B ⁇ represent the same point.
  • the value of a point C ⁇ can be obtained through the knowledge of basic trigonometric functions, which satisfies ⁇ ABC ⁇ A ⁇ B ⁇ C ⁇ , where C ⁇ is an extension point of the grid structure to be constructed.
  • the preset triangle in the configuration file is similar to the triangle corresponding to the preset triangle in the above-mentioned target mesh structure, and the vertices of the two are in one-to-one correspondence, that is, the two are similar and have a unique direction, so the calculation The resulting extension point is unique.
  • Step 804 According to the target grid structure, perform beauty makeup processing on the part to be beautified to obtain a beauty makeup image.
  • two stable points and a first expansion point are used to form a first type of triangle
  • a first expansion point, a switching point and a second expansion point are used to form a second type of triangle
  • two Re-similar triangles construct the triangles that form the mesh structure of the part to be beautified to form a configuration file, so as to facilitate the configuration file and the coordinate values of the contour feature points of the part to be beautified in the target image, calculate and obtain the part to be beautified
  • the target grid structure is based on the target grid structure, and then according to the target grid structure, beauty makeup processing is performed on the part to be beautified, and a beauty makeup image is obtained.
  • the first type of triangle includes a stable point and a first expansion point, so that the state change of the part to be beautified has little effect on the verification result of the first expansion point
  • the second type of triangle includes the first expansion point
  • the switch point and the second expansion point when the second expansion point is checked, when the cosmetic part is in a different state, the change of the verification result of the second expansion point depends on the different states of the switch point in the beautified part. It can be seen that the target grid structure generated according to the above configuration file can follow the change of the state of the part to be beautified to produce different changes, so as to produce different cosmetic effects in different states of the part to be beautified.
  • the embodiments of the present disclosure can produce different cosmetic effects in different states of the part to be beautified.
  • a configuration file is first designed by the program developer in advance, and then provided to the beauty make-up staff, wherein the make-up staff can make the configuration file Modify to debug configuration files that can present different beauty effects, so that the beauty effects corresponding to the debugged configuration files can be released to experience users for use.
  • an image processing method provided by an embodiment of the present disclosure is shown, and the image processing method may include the following steps:
  • Step 901 In response to the user's first operation, modify the coordinate value of one of the first extension points in the predetermined configuration file.
  • the configuration file includes a preset triangle in the mesh structure of the part to be beautified and coordinate values of vertices of the preset triangle, and the preset triangle includes at least one first-type triangle and a A triangle of the second type corresponds to a triangle of the first type.
  • the vertex of a triangle of the first type includes two stable points and a first extension point, and the vertex of a triangle of the second type includes the first extension point of the corresponding triangle of the first type. , a switch point and a second expansion point;
  • the stable point and the switch point are respectively the point with the smallest movement range and the one with the largest movement range among the contour feature points of the beautified part in the process of changing from the first state to the second state of the beautified part.
  • point, the first extension point and the second extension point are points set in advance according to the contour of the part to be beautified.
  • a configuration file may include multiple first-type triangles, so a configuration file may include multiple first extension points, and each first extension point may be modified, so that the Adjust the beauty effect of different parts of the beauty part.
  • the points 401 to 404 shown in FIG. 8 are all the first expansion points, then the specific coordinate value of each point of the points 401 to 404 can be changed, so as to change the beauty effect of different parts, for example, the coordinates of the point 401 can be modified value to change the cosmetic effect at the corner of the eye indicated by the H arrow in Figure 8.
  • the generated grid structure is as shown in Figure 13.
  • the effect can be shown in Figure 13, wherein, when the eyes are open, the beauty makeup effect at the P position shown in Figure 13 has an upturned effect, and when the eyes are closed, the beauty makeup effect at the Q position shown in Figure 13 The makeup effect is adjusted to be upturned instead of downturned.
  • Step 902 Save the modified configuration file.
  • Step 903 Acquire a target image including the part to be beautified.
  • the target image may be a locally stored image, an image captured in real time by an electronic device, or one of the images in a locally stored video file, or one of the video files captured in real time by an electronic device. frame image.
  • Step 904 Acquire the coordinate value of the contour feature point of the part to be beautified in the target image as the target coordinate value.
  • contour feature points are points located on the contour of the part to be beautified.
  • Step 905 According to the target coordinate value and the modified configuration file, the grid structure of the part to be beautified is obtained as the target grid structure.
  • Step 906 According to the target grid structure, perform beauty makeup processing on the beauty makeup part to obtain a beauty makeup image.
  • the beauty producer can generate the configuration file corresponding to different beauty effects by modifying the coordinate value of the first extension point in the configuration file, and save it, so that the modification can be directly used in the future.
  • the configuration files of various makeup effects are created, the images containing the makeup parts are processed.
  • the coordinate value of the switch point in the second type of triangle is the coordinate value of the position of the switch point when the cosmetic part is in the first state
  • a triangle of the second type is There is a target triangle corresponding to it, and the vertex of the target triangle includes the first expansion point in the corresponding second type of triangle, and the point on the position of the switch point when the cosmetic part is in the second state and the target point, the second type of triangle is similar to its corresponding target triangle;
  • the method further includes:
  • the point at the position of the switch point when the part to be beautified is in the second state
  • the coordinate value of calculate the coordinate value of the target point
  • the second extension point corresponding to the target point is the second extension point in the second type of triangle corresponding to the target triangle to which the target point belongs.
  • the coordinate value of the target point is the coordinate value of the position of the second expansion point corresponding to the target point when the beauty makeup part is in the second state. That is, the beauty makeup part changes from the first state to the second state, the second expansion point moves from the first position to the second position following the switch point, and the point at the second position forms a target point.
  • the grid structure of the part to be beautified composed of the preset triangles included in the configuration file can match the first state of the part to be beautified, and the direction from the target point to the corresponding second expansion point , which is used to indicate the movement track or movement trend of the second expansion point during the process of changing the beauty makeup part from the first state to the second state.
  • the movement of the second expansion point depends on the movement of the switch point.
  • the movement end point of the switch point is the point S'
  • the movement end point F' of the second expansion point can be calculated, thus obtaining FF ⁇ is such a line segment, that is, the movement trajectory or movement trend of the second extension point.
  • a configuration file may include a plurality of second-type triangles, and when the second expansion point of each second-type triangle moves from the start position to the end position, will move accordingly, so that the movement direction or movement trend of the second expansion point of each second type of triangle can be obtained.
  • a configuration file shown in Figure 12 after modifying the coordinate value of point A (ie, the first expansion point), an arrow pointing from F to F' is displayed, which can indicate the position from point F to point S following the switch point The movement trend of the movement to the position of point S ⁇ .
  • the second expansion point in the configuration file can be displayed in real time, following the movement trend of the switch point.
  • the second extension point in the configuration file following the movement trend of the switch point, can represent the relationship between the second extension point in the grid structure and the second extension point in the configuration file.
  • the corresponding point follows the movement trend of the switch point, so that the beauty producers can timely understand the changes in the grid structure generated after modifying a first expansion point, and then the changes caused by modifying the first expansion point can be avoided.
  • There is a good estimate for the change of the beauty effect that is, the second extension point of the second type of triangle to which the modified first extension point belongs, following the display of the movement trend of the switch point, provides adjustment for beauty producers. The basis for different cosmetic effects.
  • a save button can be set on the interface showing the direction in which the above-mentioned target point points to the second extension point corresponding to it, and the beauty producer can point to the corresponding second extension point from the target point through the previously displayed target point. If it is estimated that the modified configuration file can achieve the desired beauty effect, you can click the save button to save the modified configuration file.
  • the first operation is a first drag operation performed by the user on a displayed first extension point
  • the modifying the predetermined coordinate value of one of the first extension points in the configuration file in response to the user's first operation includes:
  • each first extension point can be displayed, and the beauty producer 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 coordinate value of the modified first extension point, which greatly facilitates the makeup production staff to adjust the first extension point.
  • the coordinate value of the switch point in the second type of triangle is the coordinate value of the position of the switch point when the cosmetic part is in the first state
  • a triangle of the second type is There is a target triangle corresponding to it, and the vertex of the target triangle includes the first expansion point in the corresponding second type of triangle, and the point on the position of the switch point when the cosmetic part is in the second state and the target point, the second type of triangle is similar to its corresponding target triangle;
  • the first operation is a user's modification operation on the coordinate value of a target point displayed on the target interface
  • the modifying the predetermined coordinate value of one of the first extension points in the configuration file in response to the user's first operation includes:
  • the modified coordinate value of a reference point is determined, and the reference point is the target point targeted by the first operation;
  • the similarity relationship of the second type of triangle corresponding to the target triangle, and the target parameters calculate the modified first extension point of the second type of triangle corresponding to the target triangle to which the reference point belongs. coordinate value;
  • the target parameter includes the modified coordinate value of the reference point, the coordinate value of the point where the switch point is located when the cosmetic part is in the first state, and the cosmetic part is in the first state.
  • the second state the coordinate value of the point where the switch point is located, and the coordinate value of the second extension point of the second type of triangle corresponding to the target triangle to which the reference point belongs.
  • the ultimate purpose of modifying the coordinate value of the first extension point is to change the second extension point of the second type of triangle to which the first extension point belongs, following the movement trend of the switch point, as shown in FIG. 12 .
  • the purpose of modifying the coordinate value of point A is to change the direction that F points to F ⁇ , and point F is a point set in the configuration file, that is, it is a known point, so you want to change the direction of point F to point F', The position of the point F' can also be changed. Therefore, in the embodiment of the present disclosure, the point F' can also be displayed, so that the beauty producer can directly drag the point F' to make the point F point in the direction of the point F'. adjustment is more flexible.
  • a calculation formula can be derived as follows.
  • the stable points are two corner points, and the switch point is the midpoint of the contour of the upper eyelid. That is, the image processing method in the embodiment of the present disclosure can be applied to the beauty makeup of the eyes. It should be noted that the image processing method in the embodiment of the present disclosure is not limited to be applied to the beauty makeup of the eyes, but can also be applied to other parts of the human face. makeup.
  • the extension point of one triangle is also used as the vertex of another triangle. Therefore, the embodiment of the present invention adopts a double similar triangle.
  • the double similar triangle can be extended to more similar triangles, the principle is the same, and will not be repeated here.
  • the embodiments of the present disclosure provide a complete implementation scheme of the variable bending angle of beauty makeup by using multiple combinations of similar triangle algorithms, so as to make the beauty makeup effect more natural, and provide a set of efficient implementation of double similarity
  • the tool implementation scheme of triangle algorithm configuration can greatly reduce the difficulty of configuration.
  • the construction logic can be developed for a specific point through coding, the changes will be very flexible, and the performance of the performance is highly dependent on the code logic, which can achieve more peculiar and more natural effects.
  • this method has a large workload, and the effect is flexible but the production is not flexible.
  • this method can be mixed with the double similar triangle scheme and the common basic similar triangle scheme adopted in the embodiments of the present disclosure.
  • the image processing apparatus 200 may include:
  • the image acquisition module 2001 is configured to acquire a target image including the part to be beautified
  • the coordinate acquisition module 2002 is configured to acquire the coordinate value of the contour feature point of the part to be beautified in the target image, as the target coordinate value;
  • the grid structure acquisition module 2003 is configured to obtain the grid structure of the part to be beautified according to the target coordinate value and a predetermined configuration file, as the target grid structure;
  • the image drawing module 2004 is configured to, according to the target grid structure, perform beauty makeup processing on the beauty makeup part to obtain a beauty makeup image
  • the configuration file includes a preset triangle in the mesh structure of the part to be beautified and coordinate values of vertices of the preset triangle, and the preset triangle includes at least one first-type triangle and a A triangle of the second type corresponds to a triangle of the first type.
  • the vertex of a triangle of the first type includes two stable points and a first extension point, and the vertex of a triangle of the second type includes the first extension point of the corresponding triangle of the first type. , a switch point and a second expansion point;
  • the stable point and the switch point are respectively the point with the smallest movement range and the one with the largest movement range among the contour feature points of the beautified part in the process of changing from the first state to the second state of the beautified part.
  • point, the first extension point and the second extension point are points set in advance according to the contour of the part to be beautified.
  • two stable points and a first expansion point are used to form a first type of triangle
  • a first expansion point, a switching point and a second expansion point are used to form a second type of triangle
  • two Re-similar triangles construct the triangles that form the mesh structure of the part to be beautified to form a configuration file, so as to facilitate the configuration file and the coordinate values of the contour feature points of the part to be beautified in the target image, calculate and obtain the part to be beautified
  • the target grid structure is based on the target grid structure, and then according to the target grid structure, beauty makeup processing is performed on the part to be beautified, and a beauty makeup image is obtained.
  • the first type of triangle includes a stable point and a first expansion point, so that the state change of the part to be beautified has little effect on the verification result of the first expansion point
  • the second type of triangle includes the first expansion point
  • the switch point and the second expansion point when the second expansion point is checked, when the cosmetic part is in a different state, the change of the verification result of the second expansion point depends on the different states of the switch point in the beautified part. It can be seen that the target grid structure generated according to the above configuration file can follow the change of the state of the part to be beautified to produce different changes, so as to produce different cosmetic effects in different states of the part to be beautified.
  • the embodiments of the present disclosure can produce different cosmetic effects in different states of the part to be beautified.
  • the image processing apparatus 210 may include:
  • the image acquisition module 2101 is configured to acquire the target image including the part to be beautified
  • the coordinate obtaining module 2102 is configured to obtain the coordinate value of the contour feature point of the part to be beautified in the target image, as the target coordinate value;
  • the grid structure acquisition module 2103 is configured to obtain the grid structure of the part to be beautified according to the target coordinate value and a predetermined configuration file, as the target grid structure;
  • the image drawing module 2104 is configured to, according to the target grid structure, perform beauty makeup processing on the beautified part to obtain a beauty makeup image;
  • the configuration file includes a preset triangle in the mesh structure of the part to be beautified and coordinate values of vertices of the preset triangle, and the preset triangle includes at least one first-type triangle and a A triangle of the second type corresponds to a triangle of the first type.
  • the vertex of a triangle of the first type includes two stable points and a first extension point, and the vertex of a triangle of the second type includes the first extension point of the corresponding triangle of the first type. , a switch point and a second expansion point;
  • the stable point and the switch point are respectively the point with the smallest movement range and the one with the largest movement range among the contour feature points of the beautified part in the process of changing from the first state to the second state of the beautified part.
  • point, the first extension point and the second extension point are points set in advance according to the contour of the part to be beautified.
  • the device further includes:
  • 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 the first operation of the user;
  • a saving module 2106 configured to save the modified configuration file
  • the grid structure acquisition module 2103 is specifically configured as:
  • the target grid structure is obtained.
  • the coordinate value of the switch point in the second type of triangle is the coordinate value of the position of the switch point when the cosmetic part is in the first state
  • a triangle of the second type is There is a target triangle corresponding to it, and the vertex of the target triangle includes the first expansion point in the corresponding second type of triangle, and the point on the position of the switch point when the cosmetic part is in the second state and the target point, the second type of triangle is similar to its corresponding target triangle;
  • the device also includes:
  • the first calculation module 2107 is configured to be based on the similarity relationship between the second type of triangle and its corresponding target triangle, and the coordinate values of the vertexes of the second type of triangle, which are determined when the beauty makeup part is in the second state. The coordinate value of the point on the position where the switch point is located, and the coordinate value of the target point is calculated;
  • the display module 2108 is configured to display the direction from the target point to the corresponding second extension point according to the coordinate value of the target point and the coordinate value of the second extension point;
  • the second extension point corresponding to the target point is the second extension point in the second type of triangle corresponding to the target triangle to which the target point belongs.
  • the coordinate value of the switch point in the second type of triangle is the coordinate value of the position of the switch point when the cosmetic part is in the first state
  • a triangle of the second type is There is a target triangle corresponding to it, and the vertex of the target triangle includes the first expansion point in the corresponding second type of triangle, and the point on the position of the switch point when the cosmetic part is in the second state and the target point, the second type of triangle is similar to its corresponding target triangle;
  • the first operation is a user's modification operation on the coordinate value of a target point displayed on the target interface
  • the modification module 2105 includes:
  • the first determination sub-module 21051 is configured to determine, according to the first operation, a modified coordinate value of a reference point, where the reference point is the target point for the first operation;
  • the first calculation sub-module 21052 is configured to calculate the second corresponding to the target triangle to which the reference point belongs according to the target triangle to which the reference point belongs, the similarity relationship of the second type of triangle corresponding to the target triangle, and the target parameters.
  • the target parameter includes the modified coordinate value of the reference point, the coordinate value of the point where the switch point is located when the cosmetic part is in the first state, and the cosmetic part is in the first state.
  • the second state the coordinate value of the point where the switch point is located, and the coordinate value of the second extension point of the second type of triangle corresponding to the target triangle to which the reference point belongs.
  • the grid structure acquisition module 2103 includes:
  • the second calculation sub-module 21031 is configured to use a similar triangle algorithm, according to the coordinate value of the stable point in the contour feature points of the part to be beautified in the target image, and the first type of triangle in the configuration file.
  • the coordinate value of the vertex is calculated to obtain the coordinate value of the first type of extension point;
  • the third calculation sub-module 21032 is configured to use the similar triangle algorithm, according to the coordinate value of the switch point in the contour feature points of the makeup part in the target image, the coordinate value of the first type of extension point, and all The coordinate value of the vertex of the second type of triangle in the configuration file is calculated to obtain the coordinate value of the second type of extension point;
  • the fourth calculation sub-module 21033 is configured to calculate the coordinate value of the third type of extension point according to the coordinate value of the first type of extension point, the coordinate value of the second type of extension point and the target coordinate value;
  • the grid structure drawing sub-module 21034 is configured to obtain the target mesh according to the coordinate value of the first type of extension point, the coordinate value of the second type of extension point and the coordinate value of the third type of extension point lattice structure;
  • the first type of extension point is a point in the target grid structure that corresponds to the first extension point in the first type of triangle; the second type of extension point is in the target grid structure , the point corresponding to the second expansion point in the second type of triangle, and the third type of expansion point is the contour feature point of the makeup part in the target image except the contour feature point in the target image, all the Points other than the first type of extension point and the second type of extension point.
  • the coordinate values of at least some points in the third type of extension points are determined by using a smooth transition or interpolation method.
  • the preset triangle further includes at least one triangle of the third type, wherein the vertex of a triangle of the third type includes a third extension point and two of the points in the target set, and the third extension point is The points set in advance according to the contour of the part to be beautified, the target set includes the vertices of the first type of triangle and the vertex of the second type of triangle, as well as the contour feature points of the part to be beautified. points other than the stable point and the switching point;
  • the fourth calculation sub-module 21033 is specifically configured as:
  • the stable points are two corner points, and the switch point is the midpoint of the contour of the upper eyelid.
  • two stable points and a first expansion point are used to form a first type of triangle
  • a first expansion point, a switching point and a second expansion point are used to form a second type of triangle
  • two Re-similar triangles construct the triangles that form the mesh structure of the part to be beautified to form a configuration file, so as to facilitate the configuration file and the coordinate values of the contour feature points of the part to be beautified in the target image, calculate and obtain the part to be beautified
  • the target grid structure is based on the target grid structure, and then according to the target grid structure, beauty makeup processing is performed on the part to be beautified, and a beauty makeup image is obtained.
  • the first type of triangle includes a stable point and a first expansion point, so that the state change of the part to be beautified has little effect on the verification result of the first expansion point
  • the second type of triangle includes the first expansion point
  • the switch point and the second expansion point when the second expansion point is checked, when the cosmetic part is in a different state, the change of the verification result of the second expansion point depends on the different states of the switch point in the beautified part. It can be seen that the target grid structure generated according to the above configuration file can follow the change of the state of the part to be beautified to produce different changes, so as to produce different cosmetic effects in different states of the part to be beautified.
  • the embodiments of the present disclosure can produce different cosmetic effects in different states of the part to be beautified.
  • FIG. 16 a structural block diagram of an electronic device provided by the present disclosure is shown.
  • the electronic device of the present disclosure may include: a memory, a processor, and a program stored on the memory and executable on the processor for determining the execution of an action, for determining that the action execution program is executed by the processor to achieve the described in the present disclosure
  • a program stored on the memory and executable on the processor for determining the execution of an action, for determining that the action execution program is executed by the processor to achieve the described in the present disclosure
  • FIG. 16 is a block diagram of an electronic device 2200 according to an exemplary embodiment.
  • electronic device 2200 may be a mobile phone, computer, digital broadcast electronic device, messaging device, game console, tablet device, medical device, fitness device, personal digital assistant, and the like.
  • an electronic device 2200 may include one or more of the following components: a processing component 2202, a memory 2204, a power supply component 2206, a multimedia component 2208, an audio component 2210, an input/output (I/O) interface 2212, a sensor component 2214 , and the communication component 2216.
  • a processing component 2202 may include one or more of the following components: a processing component 2202, a memory 2204, a power supply component 2206, a multimedia component 2208, an audio component 2210, an input/output (I/O) interface 2212, a sensor component 2214 , and the communication component 2216.
  • the processing component 2202 generally controls the overall operation of the device 2200, such as operations associated with display, phone 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 above-described image processing method.
  • processing component 2202 may include one or more modules that facilitate interaction between processing component 2202 and other components.
  • processing component 2202 may include a multimedia module to facilitate interaction between multimedia component 2208 and processing component 2202.
  • the memory 2204 is configured to store various types of data to support operation at the electronic device 2200 . Examples of such data include instructions for any application or method operating on electronic device 2200, contact data, phonebook data, messages, pictures, videos, and the like.
  • Memory 2204 may be implemented by any type of volatile or non-volatile storage device or combination thereof, 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 Disk.
  • SRAM static random access memory
  • EEPROM electrically erasable programmable read only memory
  • EPROM erasable Programmable Read Only Memory
  • PROM Programmable Read Only Memory
  • ROM Read Only Memory
  • Magnetic Memory Flash Memory
  • Magnetic or Optical Disk Magnetic Disk
  • Power supply component 2206 provides power to various components of electronic device 2200.
  • Power supply components 2206 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 2200 .
  • Multimedia component 2208 includes a screen that provides an output interface between the electronic device 2200 and the user.
  • 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 input signals from a user.
  • the touch panel includes one or more touch sensors to sense touch, swipe, and gestures on the touch panel. The touch sensor may not only sense the boundaries of a touch or swipe action, but also detect the duration and pressure associated with the touch or swipe action.
  • the multimedia component 2208 includes a front-facing camera and/or a rear-facing camera. When the electronic device 2200 is in an operation mode, such as a shooting mode or a video mode, the front camera and/or the rear camera may receive external multimedia data. Each of the front and rear cameras can be a fixed optical lens system or have focal length and optical zoom capability.
  • Audio component 2210 is configured to output and/or input audio signals.
  • audio component 2210 includes a microphone (MIC) that is configured to receive external audio signals when electronic device 2200 is in operating modes, such as call mode, recording mode, and voice recognition mode.
  • the received audio signal may be further stored in memory 2204 or transmitted via communication component 2216.
  • 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, a click wheel, a button, and the like. These buttons may include, but are not limited to: home button, volume buttons, start button, and lock button.
  • Sensor assembly 2214 includes one or more sensors for providing status assessments of various aspects of electronic device 2200 .
  • the sensor component 2214 can detect the open/closed state of the electronic device 2200, the relative positioning of components, such as the display and the keypad of the electronic device 2200, the sensor component 2214 can also detect the electronic device 2200 or one of the electronic device 2200 The location of components changes, the presence or absence of user contact with the electronic device 2200, the orientation or acceleration/deceleration of the device 2200, and the temperature of the electronic device 2200 changes.
  • Sensor assembly 2214 may include a proximity sensor configured to detect the presence of nearby objects in the absence of any physical contact.
  • Sensor assembly 2214 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications.
  • the sensor component 2214 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
  • Communication component 2216 is configured to facilitate wired or wireless communication between electronic device 2200 and other devices.
  • Electronic device 2200 may access wireless networks based on communication standards, such as WiFi, 2G or 3G, or a combination thereof.
  • the communication component 2216 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel.
  • the communication component 2216 also includes a near field communication (NFC) module to facilitate short-range communication.
  • NFC near field communication
  • 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.
  • RFID radio frequency identification
  • IrDA infrared data association
  • UWB ultra-wideband
  • Bluetooth Bluetooth
  • 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 A programmed gate array (FPGA), controller, microcontroller, microprocessor or other electronic component implementation is used to perform any one of the image processing methods described in this disclosure.
  • ASICs application specific integrated circuits
  • DSPs digital signal processors
  • DSPDs digital signal processing devices
  • PLDs programmable logic devices
  • FPGA field programmable A programmed gate array
  • controller microcontroller, microprocessor or other electronic component implementation is used to perform any one of the image processing methods described in this disclosure.
  • a computer-readable storage medium including instructions such as a memory 2204 including instructions, is also provided, and the instructions can be executed by the processor 2220 of the electronic device 2200 to complete the image processing method described above.
  • the computer-readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, and the like.
  • the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is enabled to perform the steps of any one of the image processing methods described in the present disclosure.
  • the apparatus embodiment since it is basically similar to the method embodiment, the description is relatively simple, and reference may be made to the partial description of the method embodiment for related parts.
  • modules in the device in the embodiment can be adaptively changed and arranged in one or more devices different from the embodiment.
  • the modules or units or components in the embodiments may be combined into one module or unit or component, and further they may be divided into multiple sub-modules or sub-units or sub-assemblies. All features disclosed in this specification (including accompanying claims, abstract and drawings) and any method so disclosed may be employed in any combination unless at least some of such features and/or procedures or elements are mutually exclusive. All processes or units of equipment are combined.
  • Each feature disclosed in this specification may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
  • Various component embodiments of the present disclosure may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof.
  • a microprocessor or digital signal processor may be used in practice to implement some or all of the functions of some or all of the components in the information extraction scheme according to the present disclosure.
  • DSP digital signal processor
  • the present disclosure can also be implemented as apparatus or apparatus programs (eg, computer programs and computer program products) for performing some or all of the methods described herein.
  • Such a program implementing the present disclosure may be stored on a computer-readable medium, or may be in the form of one or more signals. Such signals may be downloaded from Internet sites, or provided on carrier signals, or in any other form.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Ophthalmology & Optometry (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)

Abstract

The present disclosure relates to the technical field of computers. Provided are an image processing method and apparatus. The method comprises: by means of acquiring a target image including a part to be beautified and acquiring a coordinate value of a contour feature point of said part in the target image, and in combination with a predetermined configuration file, obtaining a grid structure of said part, and beautifying said part to obtain a beautified image.

Description

图像处理方法及装置Image processing method and device
相关申请的交叉引用CROSS-REFERENCE TO RELATED APPLICATIONS
本公开要求于2020年8月24日提交的专利申请号为“202010859036.0”的中国专利申请的优先权,其全部内容通过引用结合在本公开中。The present disclosure claims priority to Chinese patent application No. "202010859036.0" filed on Aug. 24, 2020, the entire contents of which are incorporated herein by reference.
技术领域technical field
本公开涉及计算机技术领域,尤其涉及一种图像处理方法及装置。The present disclosure relates to the field of computer technology, and in particular, to an image processing method and apparatus.
背景技术Background technique
伴随智能手机发展,手机运算拍照性能大幅提升。尤其是近年更先进的AI处理功能,使得手机终端可以进行实时运算,从而诞生了大批带有特效功能的摄像录像应用程序。With the development of smart phones, the performance of mobile phone computing and photography has been greatly improved. Especially in recent years, the more advanced AI processing functions have enabled mobile terminals to perform real-time operations, resulting in the birth of a large number of video recording applications with special effects.
在各种特效中,美妆是最常见的特效之一。针对眼睛的美妆,现实世界眼妆会有平滑曲线,闭眼时会适当的向上弯折,睁眼时平直或向下。然而,目前构造的网格结构过于稳定,导致利用其进行美妆时,效果并不理想。如图1所示,整体网格结构无法跟随眼睛灵活运动,导致在闭眼时眼角位置结构异常。其中,图1中M标记展示了闭眼时,网格结构外眼角部分依然和睁眼时相差不大,但是眼皮部分已经整体跟随向下移动,从而导致该部分图像产生较大幅度的错位,即如图1中M标记所指效果。Among all kinds of special effects, beauty is one of the most common special effects. For eye makeup, the real world eye makeup will have a smooth curve, which will bend upward when the eyes are closed, and straight or downward when the eyes are open. However, the grid structure currently constructed is too stable, resulting in unsatisfactory effects when using it for beauty. As shown in Figure 1, the overall grid structure cannot follow the flexible movement of the eyes, resulting in abnormal structure of the corners of the eyes when the eyes are closed. Among them, the M mark in Figure 1 shows that when the eyes are closed, the outer corner of the grid structure is still similar to that when the eyes are opened, but the eyelid part has moved downward as a whole, resulting in a large dislocation of this part of the image. That is, the effect indicated by the M mark in Figure 1.
发明内容SUMMARY OF THE INVENTION
本公开提供一种图像处理方法及装置。The present disclosure provides an image processing method and apparatus.
根据本公开的第一方面,提供一种图像处理方法,包括:According to a first aspect of the present disclosure, an image processing method is provided, comprising:
获取包含被美妆部位的目标图像;Get the target image that contains the makeup part;
获取所述被美妆部位的轮廓特征点在所述目标图像中的坐标值,以作为目标坐标值;Obtain the coordinate value of the contour feature point of the part to be beautified in the target image, as the target coordinate value;
根据所述目标坐标值,以及预先确定的配置文件,得到所述被美妆部位的网格结构,以作为目标网格结构;According to the target coordinate value and the predetermined configuration file, the grid structure of the part to be beautified is obtained as the target grid structure;
根据所述目标网格结构,对所述被美妆部位进行美妆处理,得到美妆图像;According to the target grid structure, beauty makeup processing is performed on the beauty makeup part to obtain a beauty makeup image;
其中,所述配置文件中包括被美妆部位的网格结构中的预设三角形以及所述预设三角形的顶点的坐标值,所述预设三角形包括至少一个第一类三角形和与所述第一类三角形对应的第二类三角形,一个第一类三角形的顶点包括两个稳定点和一个第一扩展点,一个第二类三角形的顶点包括与其对应的第一类三角形中的第一扩展点、一个开关点和一个第二扩展点;Wherein, the configuration file includes a preset triangle in the mesh structure of the part to be beautified and coordinate values of vertices of the preset triangle, and the preset triangle includes at least one first-type triangle and a A triangle of the second type corresponds to a triangle of the first type, the vertex of a triangle of the first type includes two stable points and a first extension point, and the vertex of a triangle of the second type includes the first extension point of the corresponding triangle of the first type , a switch point and a second expansion point;
所述稳定点和所述开关点分别为在被美妆部位从第一状态变化至第二状态的过程中,所述被美妆部位的轮廓特征点中运动幅度最小的一点和运动幅度最大的点,所述第一扩展点和所述第二扩展点为预先根据所述被美妆部位的轮廓设置的点。The stable point and the switch point are respectively the point with the smallest movement range and the one with the largest movement range among the contour feature points of the beautified part in the process of changing from the first state to the second state of the beautified part. point, the first extension point and the second extension point are points set in advance according to the contour of the part to be beautified.
可选的,所述方法还包括:Optionally, the method further includes:
响应于用户的第一操作,修改预先确定的所述配置文件中的其中一个第一扩展点的坐标值;In response to the user's first operation, modifying the predetermined coordinate value of one of the first extension points in the configuration file;
保存修改后的所述配置文件;save the modified configuration file;
所述根据所述目标坐标值,以及预先确定的配置文件,得到所述被美妆部位的网格结构,包括:The grid structure of the part to be beautified is obtained according to the target coordinate value and a predetermined configuration file, including:
根据所述目标坐标值,以及修改后的所述配置文件,得到所述目标网格结构。According to the target coordinate value and the modified configuration file, the target grid structure is obtained.
可选的,所述第二类三角形中的开关点的坐标值为,被美妆部位处于所述第一状态时,所述开关点所处位置处的坐标值,其中,一个第二类三角形存在一个与其对应的目标三角形,所述目标三角形的顶点包括与其对应的第二类三角形中的第一扩展点、被美妆部位处于所述第二状态时所述开关点所处位置上的点和目标点,所述第二类三角形与其对应的所述目标三角形相似;Optionally, the coordinate value of the switch point in the second type of triangle is the coordinate value of the position of the switch point when the cosmetic part is in the first state, wherein a triangle of the second type is There is a target triangle corresponding to it, and the vertex of the target triangle includes the first expansion point in the corresponding second type of triangle, and the point on the position of the switch point when the cosmetic part is in the second state and the target point, the second type of triangle is similar to its corresponding target triangle;
所述方法还包括:The method also includes:
根据所述第二类三角形与其对应的目标三角形的相似关系,以及所述第二类三角形的顶点的坐标值、被美妆部位处于所述第二状态时所述开关点所处位置上的点的坐标值,计算所述目标点的坐标值;According to the similar relationship between the second type of triangle and its corresponding target triangle, as well as the coordinate value of the vertex of the second type of triangle, the point at the position of the switch point when the part to be beautified is in the second state The coordinate value of , calculate the coordinate value of the target point;
根据所述目标点的坐标值以及所述第二扩展点的坐标值,显示从所述目标点指向与其对应的第二扩展点的方向;According to the coordinate value of the target point and the coordinate value of the second extension point, displaying the direction from the target point to the corresponding second extension point;
其中,与目标点对应的第二扩展点,为与目标点所属目标三角形对应的第二类三角形中的第二扩展点。The second extension point corresponding to the target point is the second extension 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 type of triangle is the coordinate value of the position of the switch point when the cosmetic part is in the first state, wherein a triangle of the second type is There is a target triangle corresponding to it, and the vertex of the target triangle includes the first expansion point in the corresponding second type of triangle, and the point on the position of the switch point when the cosmetic part is in the second state and the target point, the second type of triangle is similar to its corresponding target triangle;
所述第一操作为用户对目标界面上显示的一个目标点的坐标值的修改操作;The first operation is a user's modification operation on the coordinate value of a target point displayed on the target interface;
所述响应于用户的第一操作,修改预先确定的所述配置文件中的其中一个第一扩展点的坐标值,包括:The modifying the predetermined coordinate value of one of the first extension points in the configuration file in response to the user's first operation includes:
根据所述第一操作,确定参考点修改后的坐标值,所述参考点为所述第一操作针对的目标点;According to the first operation, the modified coordinate value of a reference point is determined, and the reference point is the target point targeted by the first operation;
根据参考点所属的目标三角形,与该目标三角形对应的第二类三角形的相似关系,以及目标参数,计算与所述参考点所属的目标三角形对应的第二类三角形的第一扩展点修改后的坐标值;According to the target triangle to which the reference point belongs, the similarity relationship of the second type of triangle corresponding to the target triangle, and the target parameters, calculate the modified first extension point of the second type of triangle corresponding to the target triangle to which the reference point belongs. coordinate value;
其中,所述目标参数包括所述参考点修改后的坐标值、被美妆部位处于所述第一状态时所述开关点所处位置上的点的坐标值、被美妆部位处于所述第二状态时所述开关点所处位置上的点的坐标值、与所述参考点所属目标三角形对应的第二类三角形的第二扩展点的坐标值。Wherein, the target parameter includes the modified coordinate value of the reference point, the coordinate value of the point where the switch point is located when the cosmetic part is in the first state, and the cosmetic part is in the first state. In the second state, the coordinate value of the point where the switch point is located, and the coordinate value of the second extension point of the second type of triangle corresponding to the target triangle to which the reference point belongs.
可选的,所述根据所述目标坐标值,以及预先确定的配置文件,得到所述被美妆部位的网格结构,包括:Optionally, according to the target coordinate value and a predetermined configuration file, the grid structure of the part to be beautified is obtained, including:
采用相似三角形算法,根据所述目标图像中的被美妆部位的轮廓特征点中的稳定点的坐标值,以及所述配置文件中的第一类三角形的顶点的坐标值,计算得到第一类扩展点的坐标值;Using the similar triangle algorithm, according to the coordinate value of the stable point in the contour feature points of the part to be beautified in the target image, and the coordinate value of the vertex of the first type triangle in the configuration file, the first type is calculated. The coordinate value of the extension point;
采用相似三角形算法,根据所述目标图像中的被美妆部位的轮廓特征点中的开关点的坐标值、所述第一类扩展点的坐标值以及所述配置文件中的第二类三角形的顶点的坐标值,计算得到第二类扩展点的坐标值;Using the similar triangle algorithm, according to the coordinate value of the switch point in the contour feature point of the part to be beautified in the target image, the coordinate value of the first type of extension point and the second type of triangle in the configuration file The coordinate value of the vertex is calculated to obtain the coordinate value of the second type of extension point;
根据所述第一类扩展点的坐标值、所述第二类扩展点的坐标值和所述目标坐标值,计算得到第三类扩展点的坐标值;According to the coordinate value of the first type of extension point, the coordinate value of the second type of extension point and the target coordinate value, calculate the coordinate value of the third type of extension point;
根据所述第一类扩展点的坐标值、所述第二类扩展点的坐标值和所述第三类扩展点的坐标值,得到所述目标网格结构;Obtain the target grid structure according to the coordinate value of the first type of extension point, the coordinate value of the second type of extension point and the coordinate value of the third type of extension point;
其中,所述第一类扩展点为所述目标网格结构中,与所述第一类三角形中的第一扩展点对应的点;所述第二类扩展点为所述目标网格结构中,与所述第二类三角形中的第二扩展点对应的点,所述第三类扩展点为所述目标网格结构中除所述目标图像中的被美妆部位的轮廓特征点、所述第一类扩展点和所述第二类扩展点之外的其他点。The first type of extension point is a point in the target grid structure that corresponds to the first extension point in the first type of triangle; the second type of extension point is in the target grid structure , the point corresponding to the second expansion point in the second type of triangle, and the third type of expansion point is the contour feature point of the makeup part in the target image except the contour feature point in the target image, all the Points other than the first type of extension point and the second type of extension point.
可选的,所述第三类扩展点中的至少部分点的坐标值是采用平滑过渡或插值方法确定的。Optionally, the coordinate values of at least some points in the third type of extension points are determined by using a smooth transition or interpolation method.
可选的,所述预设三角形还包括至少一个第三类三角形,其中,一个第三类三角形的顶点包括一个第三扩展点和目标集合中的其中两个点,所述第三扩展点为预先根据所述被美妆部位的轮廓设置的点,所述目标集合中包括所述第一类三角形的顶点和所述第二类三角形的顶点,以及所述被美妆部位的轮廓特征点中除去所述稳定点和所述开关点之外的其他点;Optionally, the preset triangle further includes at least one triangle of the third type, wherein the vertex of a triangle of the third type includes a third extension point and two of the points in the target set, and the third extension point is The points set in advance according to the contour of the part to be beautified, the target set includes the vertices of the first type of triangle and the vertex of the second type of triangle, as well as the contour feature points of the part to be beautified. points other than the stable point and the switching point;
所述根据所述第一类扩展点的坐标值、所述第二类扩展点的坐标值和所述目标坐标值,计算得到第三类扩展点的坐标值,包括:According to the coordinate value of the first type of extension point, the coordinate value of the second type of extension point and the target coordinate value, the coordinate value of the third type of extension point is calculated and obtained, including:
采用相似三角形算法,根据所述第一类扩展点的坐标值、所述第二类扩展点的坐标值和所述目标坐标值,以及所述配置文件中的第三类三角形的顶点的坐标值,计算得到所述第三类扩展点的坐标值。Using the similar triangle algorithm, according to the coordinate value of the first type of extension point, the coordinate value of the second type of extension point and the target coordinate value, and the coordinate value of the vertex of the third type of triangle in the configuration file , and calculate the coordinate value of the third type of extension point.
可选的,在所述美妆部位为眼睛的情况下,所述稳定点为两个眼角点,所述开关点为上眼皮轮廓的中点。Optionally, in the case where the cosmetic parts are eyes, the stable points are two corner points, and the switch point is the midpoint 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 containing the part to be beautified;
坐标获取模块,被配置为获取所述被美妆部位的轮廓特征点在所述目标图像中的坐标值,以作为目标坐标值;A coordinate acquisition module, configured to acquire the coordinate value of the contour feature point of the part to be beautified in the target image, as the target coordinate value;
网格结构获取模块,被配置为根据所述目标坐标值,以及预先确定的配置文件,得到所述被美妆部位的网格结构,以作为目标网格结构;a grid structure acquisition module, configured to obtain the grid structure of the part to be beautified according to the target coordinate value and a predetermined configuration file, as a target grid structure;
图像绘制模块,被配置为根据所述目标网格结构,对所述被美妆部位进行美妆处理,得到美妆图像;an image drawing module, configured to perform beauty makeup processing on the beautified part according to the target grid structure to obtain a beauty makeup image;
其中,所述配置文件中包括被美妆部位的网格结构中的预设三角形以及所述预设三角形的顶点的坐标值,所述预设三角形包括至少一个第一类三角形和与所述第一类三角形对应的第二类三角形,一个第一类三角形的顶点包括两个稳定点和一个第一扩展点,一个第二类三角形的顶点包括与其对应的第一类三角形中的第一扩展点、一个开关点和一个第二扩展点;Wherein, the configuration file includes a preset triangle in the mesh structure of the part to be beautified and coordinate values of vertices of the preset triangle, and the preset triangle includes at least one first-type triangle and a A triangle of the second type corresponds to a triangle of the first type, the vertex of a triangle of the first type includes two stable points and a first extension point, and the vertex of a triangle of the second type includes the first extension point of the corresponding triangle of the first type , a switch point and a second expansion point;
所述稳定点和所述开关点分别为在被美妆部位从第一状态变化至第二状态的过程中,所述被美妆部位的轮廓特征点中运动幅度最小的一点和运动幅度最大的点,所述第一扩展点和所述第二扩展点为预先根据所述被美妆部位的轮廓设置的点。The stable point and the switch point are respectively the point with the smallest movement range and the one with the largest movement range among the contour feature points of the beautified part in the process of changing from the first state to the second state of the beautified part. point, the first extension point and the second extension point are points set in advance according to the contour of the part to be beautified.
可选的,所述装置还包括:Optionally, the device further includes:
修改模块,被配置为响应于用户的第一操作,修改预先确定的所述配置文件中的其中一个第一扩展点的坐标值;a modification module, configured to modify the predetermined coordinate value of one of the first extension points in the configuration file in response to the user's first operation;
保存模块,被配置为保存修改后的所述配置文件;a saving module configured to save the modified configuration file;
所述网格结构获取模块具体被配置为:The grid structure acquisition module is specifically configured as:
根据所述目标坐标值,以及修改后的所述配置文件,得到所述目标网格结构。According to the target coordinate value and the modified configuration file, the target grid structure is obtained.
可选的,所述第二类三角形中的开关点的坐标值为,被美妆部位处于所述第一状态时,所述开关点所处位置处的坐标值,其中,一个第二类三角形存在一个与其对应的目标三角形,所述目标三角形的顶点包括与其对应的第二类三角形中的第一扩展点、被美妆部位处于所述第二状态时所述开关点所处位置上的点和目标点,所述第二类三角形与其对应的所述目标三角形相似;Optionally, the coordinate value of the switch point in the second type of triangle is the coordinate value of the position of the switch point when the cosmetic part is in the first state, wherein a triangle of the second type is There is a target triangle corresponding to it, and the vertex of the target triangle includes the first expansion point in the corresponding second type of triangle, and the point on the position of the switch point when the cosmetic part is in the second state and the target point, the second type of triangle is similar to its corresponding target triangle;
所述装置还包括:The device also includes:
第一计算模块,被配置为根据所述第二类三角形与其对应的目标三角形的相似关系,以及所述第二类三角形的顶点的坐标值、被美妆部位处于所述第二状态时所述开关点所处位置上的点的坐标值,计算所述目标点的坐标值;The first calculation module is configured to describe the second type of triangle according to the similarity relationship between the second type of triangle and its corresponding target triangle, as well as the coordinate value of the vertex of the second type of triangle, when the part to be beauty makeup is in the second state. The coordinate value of the point at the position of the switch point, and the coordinate value of the target point is calculated;
显示模块,被配置为根据所述目标点的坐标值以及所述第二扩展点的坐标值,显示从所述目标点指向与其对应的第二扩展点的方向;a display module, configured to display a direction from the target point to the corresponding second extension point according to the coordinate value of the target point and the coordinate value of the second extension point;
其中,与目标点对应的第二扩展点,为与目标点所属目标三角形对应的第二类三角形中的第二扩展点。The second extension point corresponding to the target point is the second extension 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 type of triangle is the coordinate value of the position of the switch point when the cosmetic part is in the first state, wherein a triangle of the second type is There is a target triangle corresponding to it, and the vertex of the target triangle includes the first expansion point in the corresponding second type of triangle, and the point on the position of the switch point when the cosmetic part is in the second state and the target point, the second type of triangle is similar to its corresponding target triangle;
所述第一操作为用户对目标界面上显示的一个目标点的坐标值的修改操作;The first operation is a user's modification operation on the coordinate value of a target point displayed on the target interface;
所述修改模块包括:The modification module includes:
第一确定子模块,被配置为根据所述第一操作,确定参考点修改后的坐标值,所述参考点为所述第一操作针对的目标点;a first determination submodule, configured to determine, according to the first operation, a modified coordinate value of a reference point, where the reference point is a target point targeted by the first operation;
第一计算子模块,被配置为根据参考点所属的目标三角形,与该目标三角形对应的第二类三角形的相似关系,以及目标参数,计算与所述参考点所属的目标三角形对应的第二类三角形的第一扩展点修改后的坐标值;The first calculation sub-module is configured to calculate the second type of 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 relationship of the second type of triangle corresponding to the target triangle, and the target parameter. The modified coordinate value of the first extension point of the triangle;
其中,所述目标参数包括所述参考点修改后的坐标值、被美妆部位处于所述第一状态时所述开关点所处位置上的点的坐标值、被美妆部位处于所述第二状态时所述开关点所处位置上的点的坐标值、与所述参考点所属目标三角形对应的第二类三角形的第二扩展点的坐标值。Wherein, the target parameter includes the modified coordinate value of the reference point, the coordinate value of the point where the switch point is located when the cosmetic part is in the first state, and the cosmetic part is in the first state. In the second state, the coordinate value of the point where the switch point is located, and the coordinate value of the second extension point of the second type of triangle corresponding to the target triangle to which the reference point belongs.
可选的,所述网格结构获取模块包括:Optionally, the grid structure acquisition module includes:
第二计算子模块,被配置为采用相似三角形算法,根据所述目标图像中的被美妆部位的轮廓特征点中的稳定点的坐标值,以及所述配置文件中的第一类三角形的顶点的坐标值,计算得到第一类扩展点的坐标值;The second calculation sub-module is configured to adopt a similar triangle algorithm, according to the coordinate value of the stable point in the contour feature points of the part to be beautified in the target image, and the vertices of the first type of triangle in the configuration file. The coordinate value of , calculate the coordinate value of the first type of extension point;
第三计算子模块,被配置为采用相似三角形算法,根据所述目标图像中的被美妆部位的轮廓特征点中的开关点的坐标值、所述第一类扩展点的坐标值以及所述配置文件中的第二类三角形的顶点的坐标值,计算得到第二类扩展点的坐标值;The third calculation sub-module is configured to adopt a similar triangle algorithm, according to the coordinate value of the switch point in the contour feature points of the part to be beautified in the target image, the coordinate value of the first type of extension point and the The coordinate value of the vertex of the second type of triangle in the configuration file is calculated to obtain the coordinate value of the second type of extension point;
第四计算子模块,被配置为根据所述第一类扩展点的坐标值、所述第二类扩展点的坐标值和所述目标坐标值,计算得到第三类扩展点的坐标值;The fourth calculation submodule is configured to calculate the coordinate value of the third type of expansion point according to the coordinate value of the first type of expansion point, the coordinate value of the second type of expansion point and the target coordinate value;
网格结构绘制子模块,被配置为根据所述第一类扩展点的坐标值、所述第二类扩展点的坐标值和所述第三类扩展点的坐标值,得到所述目标网格结构;A grid structure drawing submodule, configured to obtain the target grid according to the coordinate values of the first type of extension points, the coordinate values of the second type of extension points and the coordinate values of the third type of extension points structure;
其中,所述第一类扩展点为所述目标网格结构中,与所述第一类三角形中的第一扩展点对应的点;所述第二类扩展点为所述目标网格结构中,与所述第二类三角形中的第二扩展点对应的点,所述第三类扩展点为所述目标网格结构中除所述目标图像中的被美妆部位的轮廓特征点、所述第一类扩展点和所述第二类扩展点之外的其他点。The first type of extension point is a point in the target grid structure that corresponds to the first extension point in the first type of triangle; the second type of extension point is in the target grid structure , the point corresponding to the second expansion point in the second type of triangle, and the third type of expansion point is the contour feature point of the makeup part in the target image except the contour feature point in the target image, all the Points other than the first type of extension point and the second type of extension point.
可选的,所述第三类扩展点中的至少部分点的坐标值是采用平滑过渡或插值方法确定的。Optionally, the coordinate values of at least some points in the third type of extension points are determined by using a smooth transition or interpolation method.
可选的,所述预设三角形还包括至少一个第三类三角形,其中,一个第三类三角形的顶点包括一个第三扩展点和目标集合中的其中两个点,所述第三扩展点为预先根据所述被美妆部位的轮廓设置的点,所述目标集合中包括所述第一类三角形的顶点和所述第二类三角形的顶点,以及所述被美妆部位的轮廓特征点中除去所述稳定点和所述开关点之外的其他点;Optionally, the preset triangle further includes at least one triangle of the third type, wherein the vertex of a triangle of the third type includes a third extension point and two of the points in the target set, and the third extension point is The points set in advance according to the contour of the part to be beautified, the target set includes the vertices of the first type of triangle and the vertex of the second type of triangle, as well as the contour feature points of the part to be beautified. points other than the stable point and the switching point;
所述第四计算子模块具体被配置为:The fourth computing submodule is specifically configured as:
采用相似三角形算法,根据所述第一类扩展点的坐标值、所述第二类扩展点的坐标值和所述目标坐标值,以及所述配置文件中的第三类三角形的顶点的坐标值,计算得到所述第三类扩展点的坐标值。Using the similar triangle algorithm, according to the coordinate value of the first type of extension point, the coordinate value of the second type of extension point and the target coordinate value, and the coordinate value of the vertex of the third type of triangle in the configuration file , and calculate the coordinate value of the third type of extension point.
可选的,在所述美妆部位为眼睛的情况下,所述稳定点为两个眼角点,所述开关点为上眼皮轮廓的中点。Optionally, in the case where the cosmetic parts are eyes, the stable points are two corner points, and the switch point is the midpoint of the contour of the upper eyelid.
根据本公开的第三方面,提供一种电子设备,包括:According to a third aspect of the present disclosure, there is provided an electronic device, comprising:
处理器;processor;
用于存储所述处理器可执行指令的存储器;a memory for storing the processor-executable instructions;
其中,所述处理器被配置为执行以实现上述任一种所述的图像处理方法所执行的操作。Wherein, the processor is configured to execute the operations performed by any one of the image processing methods described above.
根据本公开的第四方面,提供一种计算机可读存储介质,其中,所述存储介质中的指令由电子设备的处理器执行时,使得所述电子设备能够执行上述任一种所述的图像处理方法所执行的操作。According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, wherein, when the instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute any one of the images described above. The action performed by the handler method.
根据本公开实施例的第五方面,提供根据本公开实施例的第五方面,提供一种计算机程序产品,包括一条或多条指令,该一条或多条指令可以由电子设备的处理器执行时,使得电子设备能够执行一种以实现如本公开提供的图像处理方法所执行的操作。According to a fifth aspect of the embodiments of the present disclosure, there is provided According to the fifth aspect of the embodiments of the present disclosure, there is provided a computer program product, comprising one or more instructions, the one or more instructions can be executed by a processor of an electronic device when executed , so that the electronic device can perform an operation performed by the image processing method provided by the present disclosure.
本公开的实施例,采用两个稳定点、一个第一扩展点组成第一类三角形,一个第一扩展点、开关点和一个第二扩展点组成第二类三角形,即采用二重相似三角形构造组成被美妆部位的网格结构的三角形,形成配置文件,从而利于该配置文件,以及被美妆部位的轮廓特征点在目标图像中的坐标值,计算获得该被美妆部位的目标网格结构,进而根据该目标网格结构,对被美妆部位进行美妆处理,得到美妆图像。In the embodiment of the present disclosure, two stable points and a first expansion point are used to form a first type of triangle, and a first expansion point, a switching point and a second expansion point are used to form a second type of triangle, that is, a double similar triangle structure is used The triangles that make up the mesh structure of the part to be beautified form a configuration file, so that the configuration file and the coordinate values of the contour feature points of the part to be beautified in the target image are calculated to obtain the target mesh of the part to be beautified. According to the target grid structure, beauty makeup processing is performed on the part to be beautified to obtain a beauty makeup image.
其中,第一类三角形中包括稳定点和第一扩展点,从而使得被美妆部位的状态变化,对第一扩展点的验算结果影响不大,而第二类三角形中包括第一扩展点、开关点和第二扩展点,则在对第二扩展点进行验算时,被美妆部位处于不同状态时,第二扩展点的验算结果的改变,取决于开关点在被美妆部位的不同状态的位置,由此可见,根据上述配置文件生成的目标网格结构,可以跟随被美妆部位状态的变化产生不同的变化,从而在被美妆部位的不同状态产生不同的美妆效果。Among them, the first type of triangle includes a stable point and a first expansion point, so that the state change of the part to be beautified has little effect on the verification result of the first expansion point, while the second type of triangle includes the first expansion point, The switch point and the second expansion point, when the second expansion point is checked, when the cosmetic part is in a different state, the change of the verification result of the second expansion point depends on the different states of the switch point in the beautified part. It can be seen that the target grid structure generated according to the above configuration file can follow the change of the state of the part to be beautified to produce different changes, so as to produce different cosmetic effects in different states of the part to be beautified.
由此可见,本公开的实施例,可以在被美妆部位的不同状态下产生不同的美妆效果。It can be seen that, the embodiments of the present disclosure can produce different cosmetic effects in different states of the part to be beautified.
此处需要说明的是,配置文件中包括的点,与所要计算的上述目标网格结构中的点是一一对应的关系,则对配置文件中的一个扩展点进行验算,即为计算配置文件中的这个扩展点在目标网格结构中对应的点的坐标。It should be noted here that the points included in the configuration file have a one-to-one correspondence with the points in the target grid structure to be calculated, and then an extension point in the configuration file is checked and calculated, that is, the calculation configuration file. The coordinates of the corresponding point in the target grid structure for this extension point in .
上述说明仅是本公开技术方案的概述,为了能够更清楚了解本公开的技术手段,而可依照说明书的内容予以实施,并且为了让本公开的上述和其它目的、特征和优点能够更明显易懂,以下特举本公开的具体实施方式。The above description is only an overview of the technical solutions of the present disclosure. In order to understand the technical means of the present disclosure more clearly, it can be implemented according to the contents of the description, and in order to make the above-mentioned and other purposes, features and advantages of the present disclosure more obvious and easy to understand , the following specific embodiments of the present disclosure are given.
附图说明Description of 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 for illustrating preferred embodiments only and are not to be considered limiting of the present disclosure. Also, the same components are denoted by the same reference numerals throughout the drawings. In the attached image:
图1是利用现有技术中构造的网格结构在人眼不同状态的显示及美妆效果对比示意图;FIG. 1 is a schematic diagram showing the comparison of the display and beauty effects of the human eye in different states using the grid structure constructed in the prior art;
图2是本公开实施例一的图像处理方法的流程图;2 is a flowchart of an image processing method according to Embodiment 1 of the present disclosure;
图3是本公开实施例二的图像处理方法的流程图;3 is a flowchart of an image processing method according to Embodiment 2 of the present disclosure;
图4是本公开实施例中一个配置文件从设计到使用的流程示意图;4 is a schematic flowchart of a configuration file from design to use in an embodiment of the present disclosure;
图5是本公开实施例中一个第一类三角形和第二类三角形的设计流程示意图;5 is a schematic diagram of a design flow of a first-type triangle and a second-type triangle in an embodiment of the present disclosure;
图6是本公开实施例中针对眨眼眼角外伸的美妆效果设置的点位结构示意图;FIG. 6 is a schematic diagram of a point structure set for the cosmetic effect of the blinking eye corner extension in an embodiment of the present disclosure;
图7是本公开实施例中针对眨眼眼角上扬的美妆效果设置的点位结构示意图;FIG. 7 is a schematic diagram of a point structure set for the beauty effect of blinking the corner of the eye raised in an embodiment of the present disclosure;
图8是本公开实施例中一个配置文件中所形成的第一类三角形的示意图;8 is a schematic diagram of a first type of triangle formed in a configuration file in an embodiment of the present disclosure;
图9是本公开实施例中一个配置文件中所形成的第二类三角形的示意图;9 is a schematic diagram of a second type of triangle formed in a configuration file in an embodiment of the present disclosure;
图10是本公开实施例中一个配置文件中所形成的第三类三角形的示意图之一;10 is one of the schematic diagrams of the third type of triangle formed in a configuration file in an embodiment of the present disclosure;
图11是本公开实施例中一个配置文件中所形成的第三类三角形的示意图之二;11 is a second schematic diagram of a third type of triangle formed in a configuration file in an embodiment of the present disclosure;
图12是本公开实施例中一个目标点指向与其对应的第二扩展点的方向的显示示意图;12 is a schematic display diagram of a direction in which a target point points to its corresponding second expansion point in an embodiment of the present disclosure;
图13是利用本公开实施例中的配置文件得到的网格结构在人眼不同状态的显示及美妆效果对比示意图;FIG. 13 is a schematic diagram showing a grid structure obtained by using a configuration file in an embodiment of the present disclosure in different states of the human eye and comparison of beauty effects;
图14是本公开实施例三的图像处理装置的结构框图;14 is a structural block diagram of an image processing apparatus according to Embodiment 3 of the present disclosure;
图15是本公开实施例四的图像处理装置的结构框图;15 is a structural block diagram of an image processing apparatus according to Embodiment 4 of the present disclosure;
图16是本公开实施例五的电子设备的结构框图;16 is a structural block diagram of an electronic device according to Embodiment 5 of the present disclosure;
图17是本公开实施例中已知三点坐标求解该三点组成三角形其中一个角的原理示意图;17 is a schematic diagram of the principle of solving one of the angles of a triangle formed by the three points with the coordinates of known three points in an embodiment of the present disclosure;
图18是本公开实施例中相似三角形算法原理示意图。FIG. 18 is a schematic diagram of the principle of a similar triangle algorithm in an embodiment of the present disclosure.
具体实施方式detailed description
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本公开相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本公开的一些方面相一致的装置和方法的例子。Exemplary embodiments will be described in detail herein, examples of which are illustrated in the accompanying drawings. Where the following description refers to the drawings, the same numerals in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the illustrative examples below are not intended to represent all implementations consistent with this disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as recited 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 the present disclosure will be more thoroughly understood, and will fully convey the scope of the present disclosure to those skilled in the art.
实施例一Example 1
参照图2,示出了本公开实施例提供的一种图像处理方法,该图像处理方法可以包括以下步骤:Referring to FIG. 2, an image processing method provided by an embodiment of the present disclosure is shown, and the image processing method may include the following steps:
步骤801:获取包含被美妆部位的目标图像。Step 801: Acquire a target image including the part to be beautified.
其中,目标图像可以为本地存储的图像,也可以为电子设备实时拍摄的图像,也可以为本地存储的视频文件中的其中一帧图像,也可以为电子设备实时拍摄的视频文件中的其中一帧图像。The target image may be a locally stored image, an image captured in real time by an electronic device, or one of the images in a locally stored video file, or one of the video files captured in real time by an electronic device. frame image.
步骤802:获取所述被美妆部位的轮廓特征点在所述目标图像中的坐标值,以作为目标坐标值。Step 802: Acquire the coordinate value of the contour feature point of the part to be beautified in the target image, as the target coordinate value.
其中,上述轮廓特征点为位于被美妆部位的轮廓上的点。Wherein, the above-mentioned contour feature points are points located on the contour of the part to be beautified.
步骤803:根据所述目标坐标值,以及预先确定的配置文件,得到所述被美妆部位的网格结构,以作为目标网格结构。Step 803: According to the target coordinate value and the predetermined configuration file, obtain the grid structure of the part to be beautified, as the target grid structure.
其中,所述配置文件中包括被美妆部位的网格结构中的预设三角形以及所述预设三角形的顶点的坐标值,所述预设三角形包括至少一个第一类三角形和与所述第一类三角形对应的第二类三角形,一个第一类三角形的顶点包括两个稳定点和一个第一扩展点,一个第二类三角形的顶点包括与其对应的第一类三角形中的第一扩展点、一个开关点和一个第二扩展点;Wherein, the configuration file includes a preset triangle in the mesh structure of the part to be beautified and coordinate values of vertices of the preset triangle, and the preset triangle includes at least one first-type triangle and a A triangle of the second type corresponds to a triangle of the first type. The vertex of a triangle of the first type includes two stable points and a first extension point, and the vertex of a triangle of the second type includes the first extension point of the corresponding triangle of the first type. , a switch point and a second expansion point;
所述稳定点和所述开关点分别为在被美妆部位从第一状态变化至第二状态的过程中,所述被美妆部位的轮廓特征点中运动幅度最小的一点和运动幅度最大的点。The stable point and the switch point are respectively the point with the smallest movement range and the one with the largest movement range among the contour feature points of the beautified part in the process of changing from the first state to the second state of the beautified part. point.
即所述稳定点为在被美妆部位从第一状态变化至第二状态的过程中,所述被美妆部位的轮廓特征点中运动幅度最小的一点;所述开关点为在所述被美妆部位从所述第一状态变化至所述第二状态的过程中,所述被美妆部位的轮廓特征点中运动幅度最大的点,所述第一扩展点和所述第二扩展点为预先根据所述被美妆部位的轮廓设置的点。That is, the stable point is the point at which the movement range is the smallest among the contour feature points of the part to be made-up during the process of changing from the first state to the second state of the part to be made-up; During the process of the beauty makeup part changing from the first state to the second state, the point with the largest movement range among the contour feature points of the beauty makeup part, the first extension point and the second extension point It is a point set in advance according to the contour of the part to be beautified.
由此可知,本公开的实施例中,配置文件中包括多个点,这多个点中包括被美妆部位的轮廓特征点,以及人工设置的点(即为扩展点)。例如,针对眼睛的配置文件中可包括如图8中所示的点39~50、点401~404、点481~484、点423~478,其中,图8中的点39~50为轮廓特征点,点401~404、点481~484、点423~478均为扩展点。其中,配置文件中包括的多个点按照一定的规则组成多个三角形。而组成三角形的规则,是预先确定的。It can be seen from this that, in the embodiment of the present disclosure, the configuration file includes multiple points, and the multiple points include contour feature points of the part to be beautified and manually set points (ie, extension points). For example, the configuration file for eyes may include points 39-50, points 401-404, points 481-484, and points 423-478 as shown in FIG. 8, wherein points 39-50 in FIG. 8 are contour features Points, points 401 to 404, points 481 to 484, and points 423 to 478 are all extension points. The multiple points included in the configuration file form multiple triangles according to certain rules. The rules for forming triangles are predetermined.
其中,配置文件,在对被美妆部位进行美妆的过程中,作为生成网格结构的依据。具体的,利用一个已知的配置文件,对被美妆部位进行美妆时,首先需要获取被美妆部位的图像,然后检测该图像中被美妆部位的轮廓特征点,然后从这些轮廓特征点中选取与配置文件中包括的轮廓特征点对应的点,作为输入参数,进而利用该输入参数和配置 文件,计算构成网格结构的扩展点,进而由输入参数所包括的所有轮廓特征点以及计算出的所有扩展点,绘制成网格结构。最后,利用绘制而成的网格结构,将预先绘制好的美化图片绘制到被美妆部位,从而实现对被美妆部位的美妆。Among them, the configuration file is used as the basis for generating the grid structure in the process of beautifying the part to be beautified. Specifically, using a known configuration file, when beautifying the part to be beautified, it is first necessary to obtain an image of the part to be beautified, and then detect the contour feature points of the part to be beautified in the image, and then extract the contour features from these contour features. The points corresponding to the contour feature points included in the configuration file are selected from the points as input parameters, and then the input parameters and configuration files are used to calculate the extension points that constitute the grid structure, and then all contour feature points included in the input parameters and All calculated extension points are drawn as a grid structure. Finally, using the drawn grid structure, the pre-drawn beautification picture is drawn to the part to be beautified, so as to realize the beauty of the part to be beautified.
其中,确定配置文件中的多个点组成三角形的规则的具体过程可如下所述:Wherein, the specific process of determining the rule that multiple points in the configuration file form a triangle can be described as follows:
首先,确认应用场景,例如针对眼睛的美妆,在眨眼的情况下,外眼角存在弯折角度的问题。在此问题中,运动场景是“眨眼”,要控制的区域是“外眼角”,则目标是得到一个随眨眼合理运动的点,可以称其为“最终点(即第二扩展点)”(即图5中的点F)。First of all, confirm the application scene, such as eye makeup, in the case of blinking, the outer corner of the eye has a problem of bending angle. In this problem, the motion scene is the "blink" and the area to be controlled is the "outer corner of the eye", then the goal is to get a point that moves reasonably with the blink, which can be called the "final point (ie, the second extension point)" ( That is, point F) in FIG. 5 .
其次,为了得到最终点(即第二扩展点),需要生成一个中间点,可以称其为“杠杆点(即第一扩展点)”,该杠杆点也是人工设置的点。其中,遵循相似三角形的计算规则,但验算它的两个AI点(即轮廓特征点)需要特殊选择,即需要选择在眨眼过程中位置相对稳定的点。这样可保证在整个运动过程中,杠杆点的位置是稳固的,便于进行后续处理。而在眨眼过程中,位于眼角的两个点的位置几乎不变,因而,这两个点是稳定点,即如图5中的点A1和A2即为稳定点,则图5中的点A1、A2、A组成一个第一类三角形。Secondly, in order to get the final point (ie the second extension point), an intermediate point needs to be generated, which can be called a "leverage point (ie the first extension point)", which is also a manually set point. Among them, the calculation rules of similar triangles are followed, but the two AI points (ie, contour feature points) for checking and calculating it require special selection, that is, points with relatively stable positions during the blinking process need to be selected. This can ensure that the position of the lever point is stable during the entire movement process, which is convenient for subsequent processing. During the blinking process, the positions of the two points located at the corner of the eye are almost unchanged. Therefore, these two points are stable points, that is, the points A1 and A2 in Figure 5 are stable points, then the point A1 in Figure 5 is the stable point. , A2, and A form a triangle of the first kind.
再次,还需要寻找到整个眨眼过程中,变化最明显的点(或结构),通常也是在轮廓特征点中寻找,该点的运动轨迹,可以称之为“开关路径”。其中,在眨眼过程中,眼部的“开关点”显然为上眼皮的中心点,该点在现实世界眨眼动作中,运动幅度最大。其中,希望“最终点(即第二扩展点)”的运动轨迹与开关点在开关轨迹中运动节奏同步。Thirdly, it is also necessary to find the point (or structure) with the most obvious change in the whole blinking process, which is usually also found in the contour feature point. The movement trajectory of this point can be called the "switching path". Among them, during the blinking process, the "switch point" of the eye is obviously the center point of the upper eyelid, which has the largest movement range in the blinking action in the real world. Wherein, it is hoped that the movement trajectory of the "final point (ie, the second expansion point)" is synchronized with the movement rhythm of the switch point in the switch trajectory.
最后,找到杠杆点和开关点之后,可以这两个作为相似三角形的输入参数,来生成最终点(即第二扩展点),如图5所示,点A、S、F组成一个三角形(即图5中的点A、S、F组成一个第二类三角形)。此时这三个点,将类似于一个杠杆(此处是类比,并非完全等价),一端运动另一端也做出相应的运动。最终点因此也具备了动态位置变化的特性,它将随开关点同步运动,如图5中,开关点从点S所处位置运动至点S`所处位置后,最终点(即第二扩展点)则从点F所处位置移动到点F`所处位置。Finally, after finding the lever point and the switch point, these two can be used as input parameters for similar triangles to generate the final point (ie the second extension point), as shown in Figure 5, points A, S, F form a triangle (ie Points A, S, and F in Figure 5 form a second type of triangle). At this time, these three points will be similar to a lever (here is an analogy, not a complete equivalent), one end moves and the other end also makes corresponding movements. Therefore, the final point also has the characteristics of dynamic position change, and it will move synchronously with the switch point. point) is moved from the position of point F to the position of point F`.
由上述可知,本公开的实施例中的配置文件,一个第一类三角形的第一扩展点,又作为了第二类三角形的顶点,因而,本发的实施例采用的是二重相似三角形。It can be seen from the above that in the configuration file of the embodiment of the present disclosure, the first extension point of a first type of triangle is also used as the vertex of the second type of triangle. Therefore, the embodiment of the present invention adopts double similar triangles.
此外,需要说明的是,上述只是介绍了组成一个第一类三角形和与其对应的第二类三角形的过程。而采用上述相同的方法,可以得到多个第一类三角形,和与每一个第一类三角形对应的第二类三角形。例如,图8所示的针对眼睛的配置文件中,点401~404均为杠杆点(即第一扩展点)、点481~484均为最终点(即第二扩展点),点42为开关点,则这个配置文件中的第一类三角形包括如图8中所示的虚线所连接的三角形,第二类三角形包括如图9中所示的虚线所连接的三角形。In addition, it should be noted that the above only describes the process of forming a first-type triangle and its corresponding second-type triangle. Using the same method as above, a plurality of first-type triangles and a second-type triangle corresponding to each first-type triangle can be obtained. For example, in the configuration file for eyes shown in FIG. 8 , points 401 to 404 are all lever points (ie, the first expansion point), points 481 to 484 are the final points (ie, the second expansion point), and point 42 is the switch point, the first type of triangles in this configuration file includes triangles connected by dashed lines as shown in FIG. 8 , and the second type of triangles includes triangles connected by dashed lines as shown in FIG. 9 .
可选的,所述根据所述目标坐标值,以及预先确定的配置文件,得到所述被美妆部位的网格结构,包括:Optionally, according to the target coordinate value and a predetermined configuration file, the grid structure of the part to be beautified is obtained, including:
采用相似三角形算法,根据所述目标图像中的被美妆部位的轮廓特征点中的稳定点的坐标值,以及所述配置文件中的第一类三角形的顶点的坐标值,计算得到第一类扩展点的坐标值;Using the similar triangle algorithm, according to the coordinate value of the stable point in the contour feature points of the part to be beautified in the target image, and the coordinate value of the vertex of the first type of triangle in the configuration file, the first type of triangle is calculated. The coordinate value of the extension point;
采用相似三角形算法,根据所述目标图像中的被美妆部位的轮廓特征点中的开关点的坐标值、所述第一类扩展点的坐标值以及所述配置文件中的第二类三角形的顶点的坐标值,计算得到第二类扩展点的坐标值;Using the similar triangle algorithm, according to the coordinate value of the switch point in the contour feature point of the part to be beautified in the target image, the coordinate value of the first type of extension point and the second type of triangle in the configuration file The coordinate value of the vertex is calculated to obtain the coordinate value of the second type of extension point;
根据所述第一类扩展点的坐标值、所述第二类扩展点的坐标值和所述目标坐标值,计算得到第三类扩展点的坐标值;According to the coordinate value of the first type of extension point, the coordinate value of the second type of extension point and the target coordinate value, calculate the coordinate value of the third type of extension point;
根据所述第一类扩展点的坐标值、所述第二类扩展点的坐标值和所述第三类扩展点的坐标值,得到所述目标网格结构;Obtain the target grid structure according to the coordinate value of the first type of extension point, the coordinate value of the second type of extension point and the coordinate value of the third type of extension point;
其中,所述第一类扩展点为所述目标网格结构中,与所述第一类三角形中的第一扩展点对应的点;所述第二类扩展点为所述目标网格结构中,与所述第二类三角形中的第二扩展点对应的点,所述第三类扩展点为所述目标网格结构中除所述目标图像中的被美妆部位的轮廓特征点、所述第一类扩展点和所述第二类扩展点之外的其他点。The first type of extension point is a point in the target grid structure that corresponds to the first extension point in the first type of triangle; the second type of extension point is in the target grid structure , the point corresponding to the second expansion point in the second type of triangle, and the third type of expansion point is the contour feature point of the makeup part in the target image except the contour feature point in the target image, all the Points other than the first type of extension point and the second type of extension point.
本公开的实施例中,配置文件中包括第一类三角形和第二类三角形,且第一类三角形的第一扩展点也是第二类三角形的一个顶点,因而,在利用本公开的实施例中的配置文件,计算目标网格结构的扩展点时,存在一个计算顺序,即首先验算第一类三角形的第一扩展点,其次验算第二类三角形的第二扩展点。具体的,例如图8所示的配置文件,则需要首先根据图8中虚线所示的三角形,验算点401~404,其次,根据图5中虚线所示的三角形,验算点481~484,再次,验算静态配置文件中的其他扩展点。其中,在验算静态配置文件中的其他扩展点的过程中,是基于前面过程中已知的点(包括已知的轮廓特征点和已经验算过的扩展点),来验算其他的扩展点。In the embodiment of the present disclosure, the configuration file includes the first type of triangle and the second type of triangle, and the first extension point of the first type of triangle is also a vertex of the second type of triangle. Therefore, in the embodiment using the present disclosure configuration file, when calculating the expansion point of the target mesh structure, there is a calculation sequence, that is, the first expansion point of the first type of triangle is checked first, and then the second expansion point of the second type of triangle is checked. Specifically, for example, in the configuration file shown in Figure 8, it is necessary to first check the points 401 to 404 according to the triangle shown by the dotted line in Figure 8, and then check the points 481 to 484 according to the triangle shown by the dotted line in Figure 5, and then again , check other extension points in the static configuration file. Wherein, in the process of checking and calculating other extension points in the static configuration file, other extension points are checked and calculated based on the known points in the previous process (including the known contour feature points and the empirically calculated extension points).
可选的,所述第三类扩展点中的至少部分点的坐标值是采用平滑过渡或插值方法确定的。Optionally, the coordinate values of at least some points in the third type of extension points are determined by using a smooth transition or interpolation method.
其中,在对配置文件中的部分扩展点验算完毕之后,与之临近的相关扩展点,可以利用平滑过渡或差插值的方式生成,从而可以减少运算量,进而提升处理速度。Among them, after the verification of some extension points in the configuration file is completed, the related extension points adjacent to them can be generated by means of smooth transition or difference interpolation, which can reduce the amount of calculation and improve the processing speed.
可选的,所述预设三角形还包括至少一个第三类三角形,其中,一个第三类三角形的顶点包括一个第三扩展点和目标集合中的其中两个点,所述第三扩展点为预先根据所述被美妆部位的轮廓设置的点,所述目标集合中包括所述第一类三角形的顶点和所述第二类三角形的顶点,以及所述被美妆部位的轮廓特征点中除去所述稳定点和所述开关点之外的其他点;Optionally, the preset triangle further includes at least one triangle of the third type, wherein the vertex of a triangle of the third type includes a third extension point and two of the points in the target set, and the third extension point is The points set in advance according to the contour of the part to be beautified, the target set includes the vertices of the first type of triangle and the vertex of the second type of triangle, as well as the contour feature points of the part to be beautified. points other than the stable point and the switching point;
所述根据所述第一类扩展点的坐标值、所述第二类扩展点的坐标值和所述目标坐标值,计算得到第三类扩展点的坐标值,包括:According to the coordinate value of the first type of extension point, the coordinate value of the second type of extension point and the target coordinate value, the coordinate value of the third type of extension point is calculated and obtained, including:
采用相似三角形算法,根据所述第一类扩展点的坐标值、所述第二类扩展点的坐标值和所述目标坐标值,以及所述配置文件中的第三类三角形的顶点的坐标值,计算得到所述第三类扩展点的坐标值。Using the similar triangle algorithm, according to the coordinate value of the first type of extension point, the coordinate value of the second type of extension point and the target coordinate value, and the coordinate value of the vertex of the third type of triangle in the configuration file , and calculate the coordinate value of the third type of extension point.
由此可知,本公开的实施例中,一个配置文件中还可以包括由第三扩展点,以及被美妆部位的轮廓特征点、第一扩展点以及第二扩展点中其中的两个点组成的第三类三角形,例如图10和图11中虚线所示的三角形。It can be seen from this that, in the embodiment of the present disclosure, a configuration file may also include a third extension point, and two points among the contour feature points of the part to be beauty makeup, the first extension point, and the second extension point. , such as the triangles shown in dashed lines in Figures 10 and 11.
具体的,配置文件中包括的点,与所要计算的上述目标网格结构中的点是一一对应的关系,且配置文件中包括的预设三角形,与所上述目标网格结构中包括的三角形一一对应且相似,则上述采用相似三角形算法,根据所述目标图像中的被美妆部位的轮廓特征点中的稳定点的坐标值,以及所述配置文件中的第一类三角形的顶点的坐标值,计算得到第一类扩展点的坐标值的过程,具体如下所述:Specifically, the points included in the configuration file have a one-to-one correspondence with the points in the target grid structure to be calculated, and the preset triangles included in the configuration file are in a one-to-one relationship with the triangles included in the target grid structure. One-to-one correspondence and similarity, the above-mentioned similar triangle algorithm is used, according to the coordinate value of the stable point in the contour feature points of the part to be beautified in the target image, and the vertices of the first type of triangle in the configuration file. Coordinate value, the process of calculating the coordinate value of the first type of extension point is as follows:
根据所述第一类三角形,与所述目标网格结构中与所述第一类三角形对应的三角形的相似关系,以及所述目标图像中的被美妆部位的轮廓特征点中的稳定点的坐标值、所述配置文件中的第一类三角形的顶点的坐标值,计算得到所述第一类扩展点的坐标值。According to the first type of triangle, the similarity relationship with the triangle corresponding to the first type of triangle in the target mesh structure, and the stable point in the contour feature points of the makeup part in the target image The coordinate value and the coordinate value of the vertex of the first type of triangle in the configuration file are calculated to obtain the coordinate value of the first type of extension point.
同理,上述“采用相似三角形算法,根据所述目标图像中的被美妆部位的轮廓特征点中的开关点的坐标值、所述第一类扩展点的坐标值以及所述配置文件中的第二类三角形的顶点的坐标值,计算得到第二类扩展点的坐标值”的过程,与上述“采用相似三角形算法,根据所述第一类扩展点的坐标值、所述第二类扩展点的坐标值和所述目标坐标值,以及所述配置文件中的第三类三角形的顶点的坐标值,计算得到所述第三类扩展点的坐标值”的过程,与此处计算得到第一类扩展点的具体过程相似,此处不再赘述。In the same way, the above "adopting the similar triangle algorithm, according to the coordinate value of the switch point in the contour feature point of the part to be beautified in the target image, the coordinate value of the first type of extension point and the The process of calculating the coordinate values of the vertices of the second type of triangle to obtain the coordinate value of the second type of extension point" is the same as the above process of "using the similar triangle algorithm, according to the coordinate value of the first type of extension point, the second type of extension point". The coordinate value of the point and the target coordinate value, as well as the coordinate value of the vertex of the third type of triangle in the configuration file, the process of calculating the coordinate value of the third type of extension point” is the same as the calculation here to obtain the first The specific process of a class of extension points is similar and will not be repeated here.
总之,如图18所示,对于相似三角形算法,需要使用5个已知点,其中三个点是前述配置文件中的点(通常是两个AI点,一个扩展点),此处我们将其命名为A、B,C(即A、B为AI点,C为扩展点)。另外两个点是由AI模块提供,其值为屏幕坐标的值,此处将其命名A`、B`。A与A`、B与B`在网格结构中,表示同一个点。通过基本三角函数相关知识即可求出一点C`的值,满足△ABC∽△A`B`C`,其中,C`即为所要构建的网格结构的一个扩展点。In summary, as shown in Figure 18, for the similar triangle 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), here we use it as Named as A, B, C (that is, A, B are AI points, C is an extension point). The other two points are provided by the AI module, and their values are the values of screen coordinates, which are named A` and B` here. In the grid structure, A and A`, B and B` represent the same point. The value of a point C` can be obtained through the knowledge of basic trigonometric functions, which satisfies △ABC∽△A`B`C`, where C` is an extension point of the grid structure to be constructed.
其中,本公开的实施例中,配置文件中的预设三角形与上述目标网格结构中与预设三角形对应的三角形相似,二者顶点一一对应,即二者相似存在唯一的方向,因而计算得到的扩展点是唯一的。Among them, 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 above-mentioned target mesh structure, and the vertices of the two are in one-to-one correspondence, that is, the two are similar and have a unique direction, so the calculation The resulting extension point is unique.
步骤804:根据所述目标网格结构,对所述被美妆部位进行美妆处理,得到美妆图像。Step 804 : According to the target grid structure, perform beauty makeup processing on the part to be beautified to obtain a beauty makeup image.
由上述可知,本公开的实施例,采用两个稳定点、一个第一扩展点组成第一类三角形,一个第一扩展点、开关点和一个第二扩展点组成第二类三角形,即采用二重相似三角形构造组成被美妆部位的网格结构的三角形,形成配置文件,从而利于该配置文件,以及被美妆部位的轮廓特征点在目标图像中的坐标值,计算获得该被美妆部位的目标网格结构,进而根据该目标网格结构,对被美妆部位进行美妆处理,得到美妆图像。It can be seen from the above that in the embodiment of the present disclosure, two stable points and a first expansion point are used to form a first type of triangle, and a first expansion point, a switching point and a second expansion point are used to form a second type of triangle, that is, two Re-similar triangles construct the triangles that form the mesh structure of the part to be beautified to form a configuration file, so as to facilitate the configuration file and the coordinate values of the contour feature points of the part to be beautified in the target image, calculate and obtain the part to be beautified The target grid structure is based on the target grid structure, and then according to the target grid structure, beauty makeup processing is performed on the part to be beautified, and a beauty makeup image is obtained.
其中,第一类三角形中包括稳定点和第一扩展点,从而使得被美妆部位的状态变化,对第一扩展点的验算结果影响不大,而第二类三角形中包括第一扩展点、开关点和第二扩展点,则在对第二扩展点进行验算时,被美妆部位处于不同状态时,第二扩展点的验算结果的改变,取决于开关点在被美妆部位的不同状态的位置,由此可见,根据上述配置文件生成的目标网格结构,可以跟随被美妆部位状态的变化产生不同的变化,从而在被美妆部位的不同状态产生不同的美妆效果。Among them, the first type of triangle includes a stable point and a first expansion point, so that the state change of the part to be beautified has little effect on the verification result of the first expansion point, while the second type of triangle includes the first expansion point, The switch point and the second expansion point, when the second expansion point is checked, when the cosmetic part is in a different state, the change of the verification result of the second expansion point depends on the different states of the switch point in the beautified part. It can be seen that the target grid structure generated according to the above configuration file can follow the change of the state of the part to be beautified to produce different changes, so as to produce different cosmetic effects in different states of the part to be beautified.
由此可见,本公开的实施例,可以在被美妆部位的不同状态下产生不同的美妆效果。It can be seen that, the embodiments of the present disclosure can produce different cosmetic effects in different states of the part to be beautified.
实施例二 Embodiment 2
在该实施例中,需要提前说明的是,如图4所示,一个配置文件首先由程序开发人员预先设计完成,然后提供给美妆制作人员,其中,美妆制作人员可以对该配置文件进行修改,以调试出可以呈现不同美妆效果的配置文件,进而使得调试好的配置文件对应的美妆效果可以发布给体验用户进行使用。In this embodiment, it should be noted in advance that, as shown in FIG. 4 , a configuration file is first designed by the program developer in advance, and then provided to the beauty make-up staff, wherein the make-up staff can make the configuration file Modify to debug configuration files that can present different beauty effects, so that the beauty effects corresponding to the debugged configuration files can be released to experience users for use.
参照图3,示出了本公开实施例提供的一种图像处理方法,该图像处理方法可以包括以下步骤:Referring to FIG. 3, an image processing method provided by an embodiment of the present disclosure is shown, and the image processing method may include the following steps:
步骤901:响应于用户的第一操作,修改预先确定的配置文件中的其中一个第一扩展点的坐标值。Step 901: In response to the user's first operation, modify the coordinate value of one of the first extension points in the predetermined configuration file.
其中,所述配置文件中包括被美妆部位的网格结构中的预设三角形以及所述预设三角形的顶点的坐标值,所述预设三角形包括至少一个第一类三角形和与所述第一类三角形对应的第二类三角形,一个第一类三角形的顶点包括两个稳定点和一个第一扩展点,一个第二类三角形的顶点包括与其对应的第一类三角形中的第一扩展点、一个开关点和一个第二扩展点;Wherein, the configuration file includes a preset triangle in the mesh structure of the part to be beautified and coordinate values of vertices of the preset triangle, and the preset triangle includes at least one first-type triangle and a A triangle of the second type corresponds to a triangle of the first type. The vertex of a triangle of the first type includes two stable points and a first extension point, and the vertex of a triangle of the second type includes the first extension point of the corresponding triangle of the first type. , a switch point and a second expansion point;
所述稳定点和所述开关点分别为在被美妆部位从第一状态变化至第二状态的过程中,所述被美妆部位的轮廓特征点中运动幅度最小的一点和运动幅度最大的点,所述第一扩展点和所述第二扩展点为预先根据所述被美妆部位的轮廓设置的点。The stable point and the switch point are respectively the point with the smallest movement range and the one with the largest movement range among the contour feature points of the beautified part in the process of changing from the first state to the second state of the beautified part. point, the first extension point and the second extension point are points set in advance according to the contour of the part to be beautified.
对于配置文件的相关说明,以及确定配置文件中的多个点组成三角形的规则的具体过程,可参见实施例一的相关描述,此处不再赘述。For the relevant description of the configuration file, and the specific process of determining the rule that multiple points in the configuration file form a triangle, reference may be made to the relevant description of Embodiment 1, and details are not repeated here.
另外,第一操作用于修改预先确定的配置文件中的其中一个第一扩展点。而本公开的实施例中,一个配置文件中可以包括多个第一类三角形,因而一个配置文件中可以包括多个第一扩展点,而每一个第一扩展点都可以进行修改,从而可以针对被美妆部位的不同部分的美妆效果进行调整。例如图8中所示的点401~404均是第一扩展点,则可以改变点401~404的每一个点的具体坐标值,从而改变不同部分的美妆效果,例如可以修改点401的坐标值,以改变图8中H箭头指示的眼角处的美妆效果。Additionally, the first operation is for modifying one of the first extension points in the predetermined configuration file. In the embodiment of the present disclosure, a configuration file may include multiple first-type triangles, so a configuration file may include multiple first extension points, and each first extension point may be modified, so that the Adjust the beauty effect of different parts of the beauty part. For example, the points 401 to 404 shown in FIG. 8 are all the first expansion points, then the specific coordinate value of each point of the points 401 to 404 can be changed, so as to change the beauty effect of different parts, for example, the coordinates of the point 401 can be modified value to change the cosmetic effect at the corner of the eye indicated by the H arrow in Figure 8.
例如修改点401的坐标值后得到的配置文件,在眼睛睁开和闭合的两种状态下,生成的网格结构如图13所示, 则这两个网格结构对眼睛所产生的美妆效果可如图13所示,其中,睁眼时,图13中所示的P位置处的美妆效果有一个上翘的效果,且闭眼时,图13中所示的Q位置处的美妆效果则调整为上翘,而不再向下弯折。For example, in the configuration file obtained by modifying the coordinate value of point 401, in the two states of open and closed eyes, the generated grid structure is as shown in Figure 13. The effect can be shown in Figure 13, wherein, when the eyes are open, the beauty makeup effect at the P position shown in Figure 13 has an upturned effect, and when the eyes are closed, the beauty makeup effect at the Q position shown in Figure 13 The makeup effect is adjusted to be upturned instead of downturned.
即通过图1与图13的对比可知,现有技术的美妆效果在闭眼时眼角弯折问题十分明显,而采用本公开实施例的图像处理方法,整体更加平滑,弯折效果较好。13 , it can be seen from the comparison of FIG. 1 and FIG. 13 , that the corners of the eyes are bent obviously when the eyes are closed in the prior art makeup effect, but the image processing method according to the embodiment of the present disclosure is smoother overall and has a better bending effect.
步骤902:保存修改后的所述配置文件。Step 902: Save the modified configuration file.
步骤903:获取包含被美妆部位的目标图像。Step 903: Acquire a target image including the part to be beautified.
其中,目标图像可以为本地存储的图像,也可以为电子设备实时拍摄的图像,也可以为本地存储的视频文件中的其中一帧图像,也可以为电子设备实时拍摄的视频文件中的其中一帧图像。The target image may be a locally stored image, an image captured in real time by an electronic device, or one of the images in a locally stored video file, or one of the video files captured in real time by an electronic device. frame image.
步骤904:获取所述被美妆部位的轮廓特征点在所述目标图像中的坐标值,以作为目标坐标值。Step 904: Acquire the coordinate value of the contour feature point of the part to be beautified in the target image as the target coordinate value.
其中,上述轮廓特征点为位于被美妆部位的轮廓上的点。Wherein, the above-mentioned contour feature points are points located on the contour of the part to be beautified.
步骤905:根据所述目标坐标值,以及修改后的所述配置文件,得到所述被美妆部位的网格结构,以作为目标网格结构。Step 905: According to the target coordinate value and the modified configuration file, the grid structure of the part to be beautified is obtained as the target grid structure.
步骤906:根据所述目标网格结构,对所述被美妆部位进行美妆处理,得到美妆图像。Step 906: According to the target grid structure, perform beauty makeup processing on the beauty makeup part to obtain a beauty makeup image.
由上述可知,在确定出配置文件之后,美妆制作人员可以通过修改配置文件中的第一扩展点的坐标值,产生对应不同美妆效果的配置文件,并进行保存,从而后续可以直接利用修改后的各种不同美妆效果的配置文件,对包含被美妆部位的图像进行处理。It can be seen from the above that after the configuration file is determined, the beauty producer can generate the configuration file corresponding to different beauty effects by modifying the coordinate value of the first extension point in the configuration file, and save it, so that the modification can be directly used in the future. After the configuration files of various makeup effects are created, the images containing the makeup parts are processed.
可选的,所述第二类三角形中的开关点的坐标值为,被美妆部位处于所述第一状态时,所述开关点所处位置处的坐标值,其中,一个第二类三角形存在一个与其对应的目标三角形,所述目标三角形的顶点包括与其对应的第二类三角形中的第一扩展点、被美妆部位处于所述第二状态时所述开关点所处位置上的点和目标点,所述第二类三角形与其对应的所述目标三角形相似;Optionally, the coordinate value of the switch point in the second type of triangle is the coordinate value of the position of the switch point when the cosmetic part is in the first state, wherein a triangle of the second type is There is a target triangle corresponding to it, and the vertex of the target triangle includes the first expansion point in the corresponding second type of triangle, and the point on the position of the switch point when the cosmetic part is in the second state and the target point, the second type of triangle is similar to its corresponding target triangle;
所述获取包含被美妆部位的目标图像之前,所述方法还包括:Before the acquiring the target image including the part to be beautified, the method further includes:
根据所述第二类三角形与其对应的目标三角形的相似关系,以及所述第二类三角形的顶点的坐标值、被美妆部位处于所述第二状态时所述开关点所处位置上的点的坐标值,计算所述目标点的坐标值;According to the similar relationship between the second type of triangle and its corresponding target triangle, as well as the coordinate value of the vertex of the second type of triangle, the point at the position of the switch point when the part to be beautified is in the second state The coordinate value of , calculate the coordinate value of the target point;
根据所述目标点的坐标值以及所述第二扩展点的坐标值,显示从所述目标点指向与其对应的第二扩展点的方向;According to the coordinate value of the target point and the coordinate value of the second extension point, displaying the direction from the target point to the corresponding second extension point;
其中,与目标点对应的第二扩展点,为与目标点所属目标三角形对应的第二类三角形中的第二扩展点。The second extension point corresponding to the target point is the second extension point in the second type of triangle corresponding to the target triangle to which the target point belongs.
此处需要说明的是,目标点的坐标值为,被美妆部位处于第二状态时,与该目标点对应的第二扩展点所处位置的坐标值。即被美妆部位由第一状态变化为第二状态,则第二扩展点跟随开关点由第一位置移动到第二位置,处于第二位置上的点即形成一个目标点。It should be noted here that the coordinate value of the target point is the coordinate value of the position of the second expansion point corresponding to the target point when the beauty makeup part is in the second state. That is, the beauty makeup part changes from the first state to the second state, the second expansion point moves from the first position to the second position following the switch point, and the point at the second position forms a target point.
由此可知,配置文件中包括的预设三角形组成的被美妆部位的网格结构,可以与被美妆部位的第一状态相匹配,则从目标点指向与其对应的第二扩展点的方向,用于表示被美妆部位由第一状态变化为第二状态的过程中,第二扩展点的运动轨迹或者运动趋势。It can be seen from this that the grid structure of the part to be beautified composed of the preset triangles included in the configuration file can match the first state of the part to be beautified, and the direction from the target point to the corresponding second expansion point , which is used to indicate the movement track or movement trend of the second expansion point during the process of changing the beauty makeup part from the first state to the second state.
其中,由于即第一扩展点是相对稳定的,基本不需要考虑被美妆部位的状态变化时它的微弱运动。因此第二扩展点的运动则取决于开关点的运动,如图6所示,可以预先设想出开关点的运动终点为点S`,则可以计算第二扩展点的运动终点F`,从而得到FF`这样一条线段,即第二扩展点运动轨迹或者运动趋势。Among them, since the first expansion point is relatively stable, there is basically no need to consider its weak movement when the state of the cosmetic part changes. Therefore, the movement of the second expansion point depends on the movement of the switch point. As shown in Figure 6, it can be presumed that the movement end point of the switch point is the point S', then the movement end point F' of the second expansion point can be calculated, thus obtaining FF` is such a line segment, that is, the movement trajectory or movement trend of the second extension point.
另外,通过调节第一扩展点的位置,可以实现出第二扩展点的不同运动趋势。例如,针对眨眼的应用场景,通过修改第一扩展点的坐标值(即图6和图7中的A点的坐标值),可以得到如图6和图7所示的两个点位结构,分别对应了“眨眼眼角外伸”(图6)、“眨眼眼角上扬”(图7)两种效果。其中眼角上扬效果是符合现实世界中的眼角运动效果的,有很重要的实用意义。另外,一些与现世界不符的效果,也可以做出特殊效果,例如眼角下坠会产生一种很“弱势”的感觉。在特定需求中也具有实用意义。In addition, by adjusting the position of the first expansion point, different motion trends of the second expansion point can be realized. For example, for the application scenario of blinking, by modifying the coordinate value of the first extension point (that is, the coordinate value of point A in Figure 6 and Figure 7 ), the two point structures shown in Figure 6 and Figure 7 can be obtained, Corresponding to the two effects of "blinking out the corner of the eye" (Figure 6) and "blinking the corner of the eye up" (Figure 7). The lifting effect of the corner of the eye is in line with the movement effect of the corner of the eye in the real world, and has very important practical significance. In addition, some effects that are not in line with the current world can also make special effects. For example, the falling of the corners of the eyes will create a very "weak" feeling. It also has practical significance in specific needs.
综上所述,本公开的实施例中,一个配置文件中可以包括多个第二类三角形,而每一个第二类三角形的第二扩展点在开关点从起始位置运动至终止位置时,都会随之运动,从而可以得到每一个第二类三角形的第二扩展点的运动方向,或运动趋势。例如图12所示的配置文件中,可以修改A点(即第一扩展点)的坐标值之后,显示出F指向F`的箭头,则可以表示出由点F跟随开关点从点S的位置运动到点S`的位置的运动趋势。To sum up, in the embodiment of the present disclosure, a configuration file may include a plurality of second-type triangles, and when the second expansion point of each second-type triangle moves from the start position to the end position, will move accordingly, so that the movement direction or movement trend of the second expansion point of each second type of triangle can be obtained. For example, in the configuration file shown in Figure 12, after modifying the coordinate value of point A (ie, the first expansion point), an arrow pointing from F to F' is displayed, which can indicate the position from point F to point S following the switch point The movement trend of the movement to the position of point S`.
即本公开的实施例,可以实时显示配置文件中的第二扩展点,跟随开关点的运动趋势。其中,配置文件中的点与网格结构中的点是一一对应的关系,因而,配置文件中的第二扩展点,跟随开关点的运动趋势,可以表示网格结构中与第二扩展点对应的点,跟随开关点的运动趋势,从而可以使得美妆制作人员能够及时了解到修改一个第一扩展点之后,对应生成的网格结构的变化情况,进而对修改这个第一扩展点所引起的美妆效果的变化有一个较好的预估,即修改后的第一扩展点所属第二类三角形的第二扩展点,跟随开关点的运动趋势的显示,为美妆制作人员提供了调整不同美妆效果的依据。That is, in the embodiment of the present disclosure, the second expansion point in the configuration file can be displayed in real time, following the movement trend of the switch point. There is a one-to-one correspondence between the points in the configuration file and the points in the grid structure. Therefore, the second extension point in the configuration file, following the movement trend of the switch point, can represent the relationship between the second extension point in the grid structure and the second extension point in the configuration file. The corresponding point follows the movement trend of the switch point, so that the beauty producers can timely understand the changes in the grid structure generated after modifying a first expansion point, and then the changes caused by modifying the first expansion point can be avoided. There is a good estimate for the change of the beauty effect, that is, the second extension point of the second type of triangle to which the modified first extension point belongs, following the display of the movement trend of the switch point, provides adjustment for beauty producers. The basis for different cosmetic effects.
可选的,可以在显示上述目标点指向与其对应的第二扩展点的方向的界面上,设置一个保存按钮,在美妆制作人员,通过前面显示的从目标点指向与其对应的第二扩展点的方向,预估修改后的配置文件可以达到所要的美妆效果的情况下,可以点击该保存按钮,从而可以将修改后的配置文件保存下来。Optionally, a save button can be set on the interface showing the direction in which the above-mentioned target point points to the second extension point corresponding to it, and the beauty producer can point to the corresponding second extension point from the target point through the previously displayed target point. If it is estimated that the modified configuration file can achieve the desired beauty effect, you can click the save button to save the modified configuration file.
可选的,所述第一操作为用户对显示的一个第一扩展点的第一拖动操作;Optionally, the first operation is a first drag operation performed by the user on a displayed first extension point;
所述响应于用户的第一操作,修改预先确定的所述配置文件中的其中一个第一扩展点的坐标值,包括:The modifying the predetermined coordinate value of one of the first extension points in the configuration file in response to the user's first operation includes:
获取所述第一拖动操作的终止位置的坐标值;obtaining the coordinate value of the termination position of the first drag operation;
将所述拖动操作的终止位置的坐标值,确定为被拖动的第一扩展点修改后的坐标值。Determine the coordinate value of the end position of the drag operation as the modified coordinate value of the dragged first extension point.
由此可知,本公开的实施例中,可以显示出每一个第一扩展点,则美妆制作人员可以拖动其中任何一个第一扩展点,来实现对该第一扩展点的坐标值的修改,即所显示的第一扩展点被拖动到哪个位置,哪个位置处的坐标值即为修改后的第一扩展点的坐标值,极大的方便了美妆制作人员对第一扩展点的修改。It can be seen from this that, in the embodiment of the present disclosure, each first extension point can be displayed, and the beauty producer 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 coordinate value of the modified first extension point, which greatly facilitates the makeup production staff to adjust the first extension point. Revise.
可选的,所述第二类三角形中的开关点的坐标值为,被美妆部位处于所述第一状态时,所述开关点所处位置处的坐标值,其中,一个第二类三角形存在一个与其对应的目标三角形,所述目标三角形的顶点包括与其对应的第二类三角形中的第一扩展点、被美妆部位处于所述第二状态时所述开关点所处位置上的点和目标点,所述第二类三角形与其对应的所述目标三角形相似;Optionally, the coordinate value of the switch point in the second type of triangle is the coordinate value of the position of the switch point when the cosmetic part is in the first state, wherein a triangle of the second type is There is a target triangle corresponding to it, and the vertex of the target triangle includes the first expansion point in the corresponding second type of triangle, and the point on the position of the switch point when the cosmetic part is in the second state and the target point, the second type of triangle is similar to its corresponding target triangle;
所述第一操作为用户对目标界面上显示的一个目标点的坐标值的修改操作;The first operation is a user's modification operation on the coordinate value of a target point displayed on the target interface;
所述响应于用户的第一操作,修改预先确定的所述配置文件中的其中一个第一扩展点的坐标值,包括:The modifying the predetermined coordinate value of one of the first extension points in the configuration file in response to the user's first operation includes:
根据所述第一操作,确定参考点修改后的坐标值,所述参考点为所述第一操作针对的目标点;According to the first operation, the modified coordinate value of a reference point is determined, and the reference point is the target point targeted by the first operation;
根据参考点所属的目标三角形,与该目标三角形对应的第二类三角形的相似关系,以及目标参数,计算与所述参考点所属的目标三角形对应的第二类三角形的第一扩展点修改后的坐标值;According to the target triangle to which the reference point belongs, the similarity relationship of the second type of triangle corresponding to the target triangle, and the target parameters, calculate the modified first extension point of the second type of triangle corresponding to the target triangle to which the reference point belongs. coordinate value;
其中,所述目标参数包括所述参考点修改后的坐标值、被美妆部位处于所述第一状态时所述开关点所处位置上的点的坐标值、被美妆部位处于所述第二状态时所述开关点所处位置上的点的坐标值、与所述参考点所属目标三角形对应的第二类三角形的第二扩展点的坐标值。Wherein, the target parameter includes the modified coordinate value of the reference point, the coordinate value of the point where the switch point is located when the cosmetic part is in the first state, and the cosmetic part is in the first state. In the second state, the coordinate value of the point where the switch point is located, and the coordinate value of the second extension point of the second type of triangle corresponding to the target triangle to which the reference point belongs.
本公开的实施例中,修改第一扩展点的坐标值的最终目的是改变这个第一扩展点所属第二类三角形的第二扩展点,跟随开关点的运动趋势,即如图12所示,修改点A的坐标值的目的就是改变F指向F`的方向,而点F是配置文件中设置好的一个点,即其为已知点,因而想要改变点F指向点F’的方向,还可以改变点F`的位置,因而,本公开的实施例中,还可以显示出点F’,使得美妆制作人员可以直接拖动点F`点,使得对点F指向点F’的方向的调整更加灵活。In the embodiment of the present disclosure, the ultimate purpose of modifying the coordinate value of the first extension point is to change the second extension point of the second type of triangle to which the first extension point belongs, following the movement trend of the switch point, as shown in FIG. 12 , The purpose of modifying the coordinate value of point A is to change the direction that F points to F`, and point F is a point set in the configuration file, that is, it is a known point, so you want to change the direction of point F to point F', The position of the point F' can also be changed. Therefore, in the embodiment of the present disclosure, the point F' can also be displayed, so that the beauty producer can directly drag the point F' to make the point F point in the direction of the point F'. adjustment is more flexible.
然而,此种方式需要基于点F`反推第一扩展点A的位置,需要注意的是这种逆向求解的方程组是二元二次方程组,存在无解的情况,需要合理处理。However, this method needs to infer the position of the first expansion point A based on the point F`. It should be noted that the equation system to be solved in reverse is a binary quadratic equation system, and there is no solution, which needs to be handled reasonably.
在一些实施例中,在点F`反推第一扩展点A的位置的情况下,可按如下过程推导一个计算公式。如图17所示,已知三点坐标:D(X1,Y1)、B(X2,Y2)、C(X3,Y3),则在求解夹角∠BDC时,首先,基于D点,做X轴的平行线,并在其正向远端取点E,从而得到∠BDC=∠EDB-∠EDC;其次,分别基于B、C两点做DE的垂线,得到B`、C`两点,其中B`的坐标为(x2,y1),C`的坐标为(x3,y1);再次则可以根据图17以及前面已知点的坐标进行如下计算:In some embodiments, when the position of the first expansion point A is inferred from the point F', a calculation formula can be derived as follows. As shown in Figure 17, the coordinates of three points are known: D(X1,Y1), B(X2,Y2), C(X3,Y3), then when solving the angle ∠BDC, first, based on D point, make X The parallel line of the axis, and take point E at its positive distal end, so as to obtain ∠BDC=∠EDB-∠EDC; secondly, make the vertical line of DE based on the two points B and C respectively, and obtain the two points B` and C` , where the coordinates of B` are (x2, y1), and the coordinates of C` are (x3, y1); again, the following calculations can be performed according to Figure 17 and the coordinates of the known points above:
cos∠BDC=cos(∠EDB-∠EDC)cos∠BDC=cos(∠EDB-∠EDC)
=cos∠EDB*cos∠EDC+sin∠EDB*sin∠EDC=cos∠EDB*cos∠EDC+sin∠EDB*sin∠EDC
=|DB`|/|DB|*|DC`|/|DC|+|BB`|/|DB|*|CC`|/|DC|=|DB`|/|DB|*|DC`|/|DC|+|BB`|/|DB|*|CC`|/|DC|
=[(x2-x1)(x3-x1)+(y2-y1)(y3-y1)]/|DB||DC|=[(x2-x1)(x3-x1)+(y2-y1)(y3-y1)]/|DB||DC|
经过上述分析,则可以得到目标公式:After the above analysis, the target formula can be obtained:
cos∠BDC=[(x2-x1)(x3-x1)+(y2-y1)(y3-y1)]/|DB||DC|。cos∠BDC=[(x2-x1)(x3-x1)+(y2-y1)(y3-y1)]/|DB||DC|.
此时,则可以利用上述公式基于点F`反推第一扩展点A的位置。即如图12所示,由于△F`AS`∽△FAS,则有∠F`AS`=∠FAS,∠F`S`A=∠FSA,从而可以得到cos∠F`AS`=cos∠FAS,cos∠F`S`A=cos∠FSA,则其中点A的坐标未知,设其为(x,y),而F、F`、S、S`的坐标均为已知,则可以依据cos∠F`AS`=cos∠FAS,cos∠F`S`A=cos∠FSA,以及上述目标公式得到关于x、y的二元二次方程组,则可以基于该二元二次方程组求解得到点A的坐标。At this time, the position of the first expansion point A can be reversely deduced based on the point F' by using the above formula. That is, as shown in Figure 12, due to △F`AS`∽△FAS, there are ∠F`AS`=∠FAS, ∠F`S`A=∠FSA, so that cos∠F`AS`=cos∠ FAS, cos∠F`S`A=cos∠FSA, then the coordinates of point A are unknown, let it be (x, y), and the coordinates of F, F`, S, S` are all known, then you can According to cos∠F`AS`=cos∠FAS, cos∠F`S`A=cos∠FSA, and the above target formula to obtain the binary quadratic equation system about x and y, then the binary quadratic equation can be obtained based on the The group solves to get the coordinates of point A.
其中,需要说明的是,基于二元二次方程组的特性,在不同判别式情况下其解的个数可能存在0个、1个、2个、无穷多个解的情况。因此,基于点F`反推杠杆点A的位置时,可能存在无解的情况。Among them, it should be noted that, based on the characteristics of the binary quadratic equation system, there may be 0, 1, 2, and infinitely many solutions in the number of solutions under different discriminants. Therefore, when the position of the lever point A is reversed based on the point F', there may be no solution.
可选的,在所述美妆部位为眼睛的情况下,所述稳定点为两个眼角点,所述开关点为上眼皮轮廓的中点。即本公开实施例中的图像处理方法可以应用于眼睛的美妆,其中需要说明的是,本公开实施例中的图像处理方法并不限于只应用于眼睛的美妆,还可是人脸其他部位的美妆。Optionally, in the case where the cosmetic parts are eyes, the stable points are two corner points, and the switch point is the midpoint of the contour of the upper eyelid. That is, the image processing method in the embodiment of the present disclosure can be applied to the beauty makeup of the eyes. It should be noted that the image processing method in the embodiment of the present disclosure is not limited to be applied to the beauty makeup of the eyes, but can also be applied to other parts of the human face. makeup.
此外需要说明的是,本公开实施例中的配置文件,一个三角形的扩展点,又作为了另一个三角形的顶点,因而,本发的实施例采用的是二重相似三角形。而二重相似三角形可扩展为更多重的相似三角形,其原理一致,此处不再赘述。In addition, it should be noted that, in the configuration file in the embodiment of the present disclosure, the extension point of one triangle is also used as the vertex of another triangle. Therefore, the embodiment of the present invention adopts a double similar triangle. The double similar triangle can be extended to more similar triangles, the principle is the same, and will not be repeated here.
综上所述,本公开的实施例,使用相似三角形算法的多重组合,提供了美妆可变弯折角度的完整实现方案,使美妆效果更自然,并且提供了一套高效实现二重相似三角形算法配置的工具实现方案,可大幅减轻配置难度。To sum up, the embodiments of the present disclosure provide a complete implementation scheme of the variable bending angle of beauty makeup by using multiple combinations of similar triangle algorithms, so as to make the beauty makeup effect more natural, and provide a set of efficient implementation of double similarity The tool implementation scheme of triangle algorithm configuration can greatly reduce the difficulty of configuration.
此外,针对扩展点的设置,可以通过编码方式为特定的点开发构建逻辑,变化会非常灵活,且能效果表现高度依赖代码逻辑,可以得到更奇特、更自然的效果。但此种方式工作量较大,效果灵活但制作不灵活。但此种方式可以 与本公开实施例中所采用的二重相似三角形方案及常见的基本相似三角形方案混合使用。In addition, for the setting of extension points, the construction logic can be developed for a specific point through coding, the changes will be very flexible, and the performance of the performance is highly dependent on the code logic, which can achieve more peculiar and more natural effects. However, this method has a large workload, and the effect is flexible but the production is not flexible. However, this method can be mixed with the double similar triangle scheme and the common basic similar triangle scheme adopted in the embodiments of the present disclosure.
实施例三Embodiment 3
参照图14,示出了本公开实施例提供的一种图像处理装置,该图像处理装置200可以包括:Referring to FIG. 14 , an image processing apparatus provided by an embodiment of the present disclosure is shown. The image processing apparatus 200 may include:
图像获取模块2001,被配置为获取包含被美妆部位的目标图像;The image acquisition module 2001 is configured to acquire a target image including the part to be beautified;
坐标获取模块2002,被配置为获取所述被美妆部位的轮廓特征点在所述目标图像中的坐标值,以作为目标坐标值;The coordinate acquisition module 2002 is configured to acquire the coordinate value of the contour feature point of the part to be beautified in the target image, as the target coordinate value;
网格结构获取模块2003,被配置为根据所述目标坐标值,以及预先确定的配置文件,得到所述被美妆部位的网格结构,以作为目标网格结构;The grid structure acquisition module 2003 is configured to obtain the grid structure of the part to be beautified according to the target coordinate value and a predetermined configuration file, as the target grid structure;
图像绘制模块2004,被配置为根据所述目标网格结构,对所述被美妆部位进行美妆处理,得到美妆图像;The image drawing module 2004 is configured to, according to the target grid structure, perform beauty makeup processing on the beauty makeup part to obtain a beauty makeup image;
其中,所述配置文件中包括被美妆部位的网格结构中的预设三角形以及所述预设三角形的顶点的坐标值,所述预设三角形包括至少一个第一类三角形和与所述第一类三角形对应的第二类三角形,一个第一类三角形的顶点包括两个稳定点和一个第一扩展点,一个第二类三角形的顶点包括与其对应的第一类三角形中的第一扩展点、一个开关点和一个第二扩展点;Wherein, the configuration file includes a preset triangle in the mesh structure of the part to be beautified and coordinate values of vertices of the preset triangle, and the preset triangle includes at least one first-type triangle and a A triangle of the second type corresponds to a triangle of the first type. The vertex of a triangle of the first type includes two stable points and a first extension point, and the vertex of a triangle of the second type includes the first extension point of the corresponding triangle of the first type. , a switch point and a second expansion point;
所述稳定点和所述开关点分别为在被美妆部位从第一状态变化至第二状态的过程中,所述被美妆部位的轮廓特征点中运动幅度最小的一点和运动幅度最大的点,所述第一扩展点和所述第二扩展点为预先根据所述被美妆部位的轮廓设置的点。The stable point and the switch point are respectively the point with the smallest movement range and the one with the largest movement range among the contour feature points of the beautified part in the process of changing from the first state to the second state of the beautified part. point, the first extension point and the second extension point are points set in advance according to the contour of the part to be beautified.
由上述可知,本公开的实施例,采用两个稳定点、一个第一扩展点组成第一类三角形,一个第一扩展点、开关点和一个第二扩展点组成第二类三角形,即采用二重相似三角形构造组成被美妆部位的网格结构的三角形,形成配置文件,从而利于该配置文件,以及被美妆部位的轮廓特征点在目标图像中的坐标值,计算获得该被美妆部位的目标网格结构,进而根据该目标网格结构,对被美妆部位进行美妆处理,得到美妆图像。It can be seen from the above that in the embodiment of the present disclosure, two stable points and a first expansion point are used to form a first type of triangle, and a first expansion point, a switching point and a second expansion point are used to form a second type of triangle, that is, two Re-similar triangles construct the triangles that form the mesh structure of the part to be beautified to form a configuration file, so as to facilitate the configuration file and the coordinate values of the contour feature points of the part to be beautified in the target image, calculate and obtain the part to be beautified The target grid structure is based on the target grid structure, and then according to the target grid structure, beauty makeup processing is performed on the part to be beautified, and a beauty makeup image is obtained.
其中,第一类三角形中包括稳定点和第一扩展点,从而使得被美妆部位的状态变化,对第一扩展点的验算结果影响不大,而第二类三角形中包括第一扩展点、开关点和第二扩展点,则在对第二扩展点进行验算时,被美妆部位处于不同状态时,第二扩展点的验算结果的改变,取决于开关点在被美妆部位的不同状态的位置,由此可见,根据上述配置文件生成的目标网格结构,可以跟随被美妆部位状态的变化产生不同的变化,从而在被美妆部位的不同状态产生不同的美妆效果。Among them, the first type of triangle includes a stable point and a first expansion point, so that the state change of the part to be beautified has little effect on the verification result of the first expansion point, while the second type of triangle includes the first expansion point, The switch point and the second expansion point, when the second expansion point is checked, when the cosmetic part is in a different state, the change of the verification result of the second expansion point depends on the different states of the switch point in the beautified part. It can be seen that the target grid structure generated according to the above configuration file can follow the change of the state of the part to be beautified to produce different changes, so as to produce different cosmetic effects in different states of the part to be beautified.
由此可见,本公开的实施例,可以在被美妆部位的不同状态下产生不同的美妆效果。It can be seen that, the embodiments of the present disclosure can produce different cosmetic effects in different states of the part to be beautified.
实施例四Embodiment 4
参照图15,示出了本公开实施例提供的一种图像处理装置,该图像处理装置210可以包括:Referring to FIG. 15 , an image processing apparatus provided by an embodiment of the present disclosure is shown. The image processing apparatus 210 may include:
图像获取模块2101,被配置为获取包含被美妆部位的目标图像;The image acquisition module 2101 is configured to acquire the target image including the part to be beautified;
坐标获取模块2102,被配置为获取所述被美妆部位的轮廓特征点在所述目标图像中的坐标值,以作为目标坐标值;The coordinate obtaining module 2102 is configured to obtain the coordinate value of the contour feature point of the part to be beautified in the target image, as the target coordinate value;
网格结构获取模块2103,被配置为根据所述目标坐标值,以及预先确定的配置文件,得到所述被美妆部位的网格结构,以作为目标网格结构;The grid structure acquisition module 2103 is configured to obtain the grid structure of the part to be beautified according to the target coordinate value and a predetermined configuration file, as the target grid structure;
图像绘制模块2104,被配置为根据所述目标网格结构,对所述被美妆部位进行美妆处理,得到美妆图像;The image drawing module 2104 is configured to, according to the target grid structure, perform beauty makeup processing on the beautified part to obtain a beauty makeup image;
其中,所述配置文件中包括被美妆部位的网格结构中的预设三角形以及所述预设三角形的顶点的坐标值,所述预设三角形包括至少一个第一类三角形和与所述第一类三角形对应的第二类三角形,一个第一类三角形的顶点包括两个稳定点和一个第一扩展点,一个第二类三角形的顶点包括与其对应的第一类三角形中的第一扩展点、一个开关点和一个第二扩展点;Wherein, the configuration file includes a preset triangle in the mesh structure of the part to be beautified and coordinate values of vertices of the preset triangle, and the preset triangle includes at least one first-type triangle and a A triangle of the second type corresponds to a triangle of the first type. The vertex of a triangle of the first type includes two stable points and a first extension point, and the vertex of a triangle of the second type includes the first extension point of the corresponding triangle of the first type. , a switch point and a second expansion point;
所述稳定点和所述开关点分别为在被美妆部位从第一状态变化至第二状态的过程中,所述被美妆部位的轮廓特征点中运动幅度最小的一点和运动幅度最大的点,所述第一扩展点和所述第二扩展点为预先根据所述被美妆部位的轮廓设置的点。The stable point and the switch point are respectively the point with the smallest movement range and the one with the largest movement range among the contour feature points of the beautified part in the process of changing from the first state to the second state of the beautified part. point, the first extension point and the second extension point are points set in advance according to the contour of the part to be beautified.
可选的,所述装置还包括:Optionally, the device further includes:
修改模块2105,被配置为响应于用户的第一操作,修改预先确定的所述配置文件中的其中一个第一扩展点的坐标值;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 the first operation of the user;
保存模块2106,被配置为保存修改后的所述配置文件;A saving module 2106, configured to save the modified configuration file;
所述网格结构获取模块2103具体被配置为:The grid structure acquisition module 2103 is specifically configured as:
根据所述目标坐标值,以及修改后的所述配置文件,得到所述目标网格结构。According to the target coordinate value and the modified configuration file, the target grid structure is obtained.
可选的,所述第二类三角形中的开关点的坐标值为,被美妆部位处于所述第一状态时,所述开关点所处位置处的坐标值,其中,一个第二类三角形存在一个与其对应的目标三角形,所述目标三角形的顶点包括与其对应的第二类三角形中的第一扩展点、被美妆部位处于所述第二状态时所述开关点所处位置上的点和目标点,所述第二类三角形与其对应的所述目标三角形相似;Optionally, the coordinate value of the switch point in the second type of triangle is the coordinate value of the position of the switch point when the cosmetic part is in the first state, wherein a triangle of the second type is There is a target triangle corresponding to it, and the vertex of the target triangle includes the first expansion point in the corresponding second type of triangle, and the point on the position of the switch point when the cosmetic part is in the second state and the target point, the second type of triangle is similar to its corresponding target triangle;
所述装置还包括:The device also includes:
第一计算模块2107,被配置为根据所述第二类三角形与其对应的目标三角形的相似关系,以及所述第二类三角形的顶点的坐标值、被美妆部位处于所述第二状态时所述开关点所处位置上的点的坐标值,计算所述目标点的坐标值;The first calculation module 2107 is configured to be based on the similarity relationship between the second type of triangle and its corresponding target triangle, and the coordinate values of the vertexes of the second type of triangle, which are determined when the beauty makeup part is in the second state. The coordinate value of the point on the position where the switch point is located, and the coordinate value of the target point is calculated;
显示模块2108,被配置为根据所述目标点的坐标值以及所述第二扩展点的坐标值,显示从所述目标点指向与其对应的第二扩展点的方向;The display module 2108 is configured to display the direction from the target point to the corresponding second extension point according to the coordinate value of the target point and the coordinate value of the second extension point;
其中,与目标点对应的第二扩展点,为与目标点所属目标三角形对应的第二类三角形中的第二扩展点。The second extension point corresponding to the target point is the second extension 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 type of triangle is the coordinate value of the position of the switch point when the cosmetic part is in the first state, wherein a triangle of the second type is There is a target triangle corresponding to it, and the vertex of the target triangle includes the first expansion point in the corresponding second type of triangle, and the point on the position of the switch point when the cosmetic part is in the second state and the target point, the second type of triangle is similar to its corresponding target triangle;
所述第一操作为用户对目标界面上显示的一个目标点的坐标值的修改操作;The first operation is a user's modification operation on the coordinate value of a target point displayed on the target interface;
所述修改模块2105包括:The modification module 2105 includes:
第一确定子模块21051,被配置为根据所述第一操作,确定参考点修改后的坐标值,所述参考点为所述第一操作针对的目标点;The first determination sub-module 21051 is configured to determine, according to the first operation, a modified coordinate value of a reference point, where the reference point is the target point for the first operation;
第一计算子模块21052,被配置为根据参考点所属的目标三角形,与该目标三角形对应的第二类三角形的相似关系,以及目标参数,计算与所述参考点所属的目标三角形对应的第二类三角形的第一扩展点修改后的坐标值;The first calculation sub-module 21052 is configured to calculate the second corresponding to the target triangle to which the reference point belongs according to the target triangle to which the reference point belongs, the similarity relationship of the second type of triangle corresponding to the target triangle, and the target parameters. The modified coordinate value of the first extension point of the quasi-triangle;
其中,所述目标参数包括所述参考点修改后的坐标值、被美妆部位处于所述第一状态时所述开关点所处位置上的点的坐标值、被美妆部位处于所述第二状态时所述开关点所处位置上的点的坐标值、与所述参考点所属目标三角形对应的第二类三角形的第二扩展点的坐标值。Wherein, the target parameter includes the modified coordinate value of the reference point, the coordinate value of the point where the switch point is located when the cosmetic part is in the first state, and the cosmetic part is in the first state. In the second state, the coordinate value of the point where the switch point is located, and the coordinate value of the second extension point of the second type of triangle corresponding to the target triangle to which the reference point belongs.
可选的,所述网格结构获取模块2103包括:Optionally, the grid structure acquisition module 2103 includes:
第二计算子模块21031,被配置为采用相似三角形算法,根据所述目标图像中的被美妆部位的轮廓特征点中的稳定点的坐标值,以及所述配置文件中的第一类三角形的顶点的坐标值,计算得到第一类扩展点的坐标值;The second calculation sub-module 21031 is configured to use a similar triangle algorithm, according to the coordinate value of the stable point in the contour feature points of the part to be beautified in the target image, and the first type of triangle in the configuration file. The coordinate value of the vertex is calculated to obtain the coordinate value of the first type of extension point;
第三计算子模块21032,被配置为采用相似三角形算法,根据所述目标图像中的被美妆部位的轮廓特征点中的开关点的坐标值、所述第一类扩展点的坐标值以及所述配置文件中的第二类三角形的顶点的坐标值,计算得到第二类扩展点的坐标值;The third calculation sub-module 21032 is configured to use the similar triangle algorithm, according to the coordinate value of the switch point in the contour feature points of the makeup part in the target image, the coordinate value of the first type of extension point, and all The coordinate value of the vertex of the second type of triangle in the configuration file is calculated to obtain the coordinate value of the second type of extension point;
第四计算子模块21033,被配置为根据所述第一类扩展点的坐标值、所述第二类扩展点的坐标值和所述目标坐标值,计算得到第三类扩展点的坐标值;The fourth calculation sub-module 21033 is configured to calculate the coordinate value of the third type of extension point according to the coordinate value of the first type of extension point, the coordinate value of the second type of extension point and the target coordinate value;
网格结构绘制子模块21034,被配置为根据所述第一类扩展点的坐标值、所述第二类扩展点的坐标值和所述第三类扩展点的坐标值,得到所述目标网格结构;The grid structure drawing sub-module 21034 is configured to obtain the target mesh according to the coordinate value of the first type of extension point, the coordinate value of the second type of extension point and the coordinate value of the third type of extension point lattice structure;
其中,所述第一类扩展点为所述目标网格结构中,与所述第一类三角形中的第一扩展点对应的点;所述第二类扩展点为所述目标网格结构中,与所述第二类三角形中的第二扩展点对应的点,所述第三类扩展点为所述目标网格结构中除所述目标图像中的被美妆部位的轮廓特征点、所述第一类扩展点和所述第二类扩展点之外的其他点。The first type of extension point is a point in the target grid structure that corresponds to the first extension point in the first type of triangle; the second type of extension point is in the target grid structure , the point corresponding to the second expansion point in the second type of triangle, and the third type of expansion point is the contour feature point of the makeup part in the target image except the contour feature point in the target image, all the Points other than the first type of extension point and the second type of extension point.
可选的,所述第三类扩展点中的至少部分点的坐标值是采用平滑过渡或插值方法确定的。Optionally, the coordinate values of at least some points in the third type of extension points are determined by using a smooth transition or interpolation method.
可选的,所述预设三角形还包括至少一个第三类三角形,其中,一个第三类三角形的顶点包括一个第三扩展点和目标集合中的其中两个点,所述第三扩展点为预先根据所述被美妆部位的轮廓设置的点,所述目标集合中包括所述第一类三角形的顶点和所述第二类三角形的顶点,以及所述被美妆部位的轮廓特征点中除去所述稳定点和所述开关点之外的其他点;Optionally, the preset triangle further includes at least one triangle of the third type, wherein the vertex of a triangle of the third type includes a third extension point and two of the points in the target set, and the third extension point is The points set in advance according to the contour of the part to be beautified, the target set includes the vertices of the first type of triangle and the vertex of the second type of triangle, as well as the contour feature points of the part to be beautified. points other than the stable point and the switching point;
所述第四计算子模块21033具体被配置为:The fourth calculation sub-module 21033 is specifically configured as:
采用相似三角形算法,根据所述第一类扩展点的坐标值、所述第二类扩展点的坐标值和所述目标坐标值,以及所述配置文件中的第三类三角形的顶点的坐标值,计算得到所述第三类扩展点的坐标值。Using the similar triangle algorithm, according to the coordinate value of the first type of extension point, the coordinate value of the second type of extension point and the target coordinate value, and the coordinate value of the vertex of the third type of triangle in the configuration file , and calculate the coordinate value of the third type of extension point.
可选的,在所述美妆部位为眼睛的情况下,所述稳定点为两个眼角点,所述开关点为上眼皮轮廓的中点。Optionally, in the case where the cosmetic parts are eyes, the stable points are two corner points, and the switch point is the midpoint of the contour of the upper eyelid.
由上述可知,本公开的实施例,采用两个稳定点、一个第一扩展点组成第一类三角形,一个第一扩展点、开关点和一个第二扩展点组成第二类三角形,即采用二重相似三角形构造组成被美妆部位的网格结构的三角形,形成配置文件,从而利于该配置文件,以及被美妆部位的轮廓特征点在目标图像中的坐标值,计算获得该被美妆部位的目标网格结构,进而根据该目标网格结构,对被美妆部位进行美妆处理,得到美妆图像。It can be seen from the above that in the embodiment of the present disclosure, two stable points and a first expansion point are used to form a first type of triangle, and a first expansion point, a switching point and a second expansion point are used to form a second type of triangle, that is, two Re-similar triangles construct the triangles that form the mesh structure of the part to be beautified to form a configuration file, so as to facilitate the configuration file and the coordinate values of the contour feature points of the part to be beautified in the target image, calculate and obtain the part to be beautified The target grid structure is based on the target grid structure, and then according to the target grid structure, beauty makeup processing is performed on the part to be beautified, and a beauty makeup image is obtained.
其中,第一类三角形中包括稳定点和第一扩展点,从而使得被美妆部位的状态变化,对第一扩展点的验算结果影响不大,而第二类三角形中包括第一扩展点、开关点和第二扩展点,则在对第二扩展点进行验算时,被美妆部位处于不同状态时,第二扩展点的验算结果的改变,取决于开关点在被美妆部位的不同状态的位置,由此可见,根据上述配置文件生成的目标网格结构,可以跟随被美妆部位状态的变化产生不同的变化,从而在被美妆部位的不同状态产生不同的美妆效果。Among them, the first type of triangle includes a stable point and a first expansion point, so that the state change of the part to be beautified has little effect on the verification result of the first expansion point, while the second type of triangle includes the first expansion point, The switch point and the second expansion point, when the second expansion point is checked, when the cosmetic part is in a different state, the change of the verification result of the second expansion point depends on the different states of the switch point in the beautified part. It can be seen that the target grid structure generated according to the above configuration file can follow the change of the state of the part to be beautified to produce different changes, so as to produce different cosmetic effects in different states of the part to be beautified.
由此可见,本公开的实施例,可以在被美妆部位的不同状态下产生不同的美妆效果。It can be seen that, the embodiments of the present disclosure can produce different cosmetic effects in different states of the part to be beautified.
关于上述实施例中的装置,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。Regarding the apparatus in the above-mentioned embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be described in detail here.
实施例五Embodiment 5
参照图16,示出了本公开提供的一种电子设备的结构框图。Referring to FIG. 16 , a structural block diagram of an electronic device provided by the present disclosure is shown.
本公开的电子设备可以包括:存储器、处理器及存储在存储器上并可在处理器上运行的用于确定动作执行的程序,用于确定动作执行程序被处理器执行时实现本公开中所述的任意一种图像处理方法的步骤。The electronic device of the present disclosure may include: a memory, a processor, and a program stored on the memory and executable on the processor for determining the execution of an action, for determining that the action execution program is executed by the processor to achieve the described in the present disclosure The steps of any image processing method.
图16是根据一示例性实施例示出的一种电子设备2200的框图。例如,电子设备2200可以是移动电话,计算机,数字广播电子设备,消息收发设备,游戏控制台,平板设备,医疗设备,健身设备,个人数字助理等。FIG. 16 is a block diagram of an electronic device 2200 according to an exemplary embodiment. For example, electronic device 2200 may be a mobile phone, computer, digital broadcast electronic device, messaging device, game console, tablet device, medical device, fitness device, personal digital assistant, and the like.
参照图16,电子设备2200可以包括以下一个或多个组件:处理组件2202,存储器2204,电源组件2206,多媒体组件2208,音频组件2210,输入/输出(I/O)的接口2212,传感器组件2214,以及通信组件2216。16, an electronic device 2200 may include one or more of the following components: a processing component 2202, a memory 2204, a power supply component 2206, a multimedia component 2208, an audio component 2210, an input/output (I/O) interface 2212, a sensor component 2214 , and the communication component 2216.
处理组件2202通常控制装置2200的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件2202可以包括一个或多个处理器2220来执行指令,以完成上述图像处理的方法的全部或部分步骤。此外,处理组件2202可以包括一个或多个模块,便于处理组件2202和其他组件之间的交互。例如,处理部件2202可以包括多媒体模块,以方便多媒体组件2208和处理组件2202之间的交互。The processing component 2202 generally controls the overall operation of the device 2200, such as operations associated with display, phone 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 above-described image processing method. Additionally, processing component 2202 may include one or more modules that facilitate interaction between processing component 2202 and other components. For example, processing component 2202 may include a multimedia module to facilitate interaction between multimedia component 2208 and processing component 2202.
存储器2204被配置为存储各种类型的数据以支持在电子设备2200的操作。这些数据的示例包括用于在电子设备2200上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。存储器2204可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。The memory 2204 is configured to store various types of data to support operation at the electronic device 2200 . Examples of such data include instructions for any application or method operating on electronic device 2200, contact data, phonebook data, messages, pictures, videos, and the like. Memory 2204 may be implemented by any type of volatile or non-volatile storage device or combination thereof, 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 Disk.
电源组件2206为电子设备2200的各种组件提供电力。电源组件2206可以包括电源管理系统,一个或多个电源,及其他与为电子设备2200生成、管理和分配电力相关联的组件。 Power supply component 2206 provides power to various components of electronic device 2200. Power supply components 2206 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 2200 .
多媒体组件2208包括在所述电子设备2200和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶显示器(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。所述触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与所述触摸或滑动操作相关的持续时间和压力。在一些实施例中,多媒体组件2208包括一个前置摄像头和/或后置摄像头。当电子设备2200处于操作模式,如拍摄模式或视频模式时,前置摄像头和/或后置摄像头可以接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜系统或具有焦距和光学变焦能力。 Multimedia component 2208 includes a screen that provides an output interface between the electronic device 2200 and the 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 input signals from a user. The touch panel includes one or more touch sensors to sense touch, swipe, and gestures on the touch panel. The touch sensor may not only sense the boundaries of a touch or swipe action, but also detect the duration and pressure associated with the touch or swipe action. In some embodiments, the multimedia component 2208 includes a front-facing camera and/or a rear-facing camera. When the electronic device 2200 is in an operation mode, such as a shooting mode or a video mode, the front camera and/or the rear camera may receive external multimedia data. Each of the front and rear cameras can be a fixed optical lens system or have focal length and optical zoom capability.
音频组件2210被配置为输出和/或输入音频信号。例如,音频组件2210包括一个麦克风(MIC),当电子设备2200处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器2204或经由通信组件2216发送。在一些实施例中,音频组件810还包括一个扬声器,用于输出音频信号。 Audio component 2210 is configured to output and/or input audio signals. For example, audio component 2210 includes a microphone (MIC) that is configured to receive external audio signals when electronic device 2200 is in operating modes, such as call mode, recording mode, and voice recognition mode. The received audio signal may be further stored in memory 2204 or transmitted via communication component 2216. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
I/O接口2212为处理组件2202和外围接口模块之间提供接口,上述外围接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。The I/O interface 2212 provides an interface between the processing component 2202 and a peripheral interface module, which may be a keyboard, a click wheel, a button, and the like. These buttons may include, but are not limited to: home button, volume buttons, start button, and lock button.
传感器组件2214包括一个或多个传感器,用于为电子设备2200提供各个方面的状态评估。例如,传感器组件2214可以检测到电子设备2200的打开/关闭状态,组件的相对定位,例如所述组件为电子设备2200的显示器和小键盘,传感器组件2214还可以检测电子设备2200或电子设备2200一个组件的位置改变,用户与电子设备2200接触的存在或不存在,装置2200方位或加速/减速和电子设备2200的温度变化。传感器组件2214可以包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组件2214还可以包括光传感器,如CMOS或CCD图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件2214还可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。 Sensor assembly 2214 includes one or more sensors for providing status assessments of various aspects of electronic device 2200 . For example, the sensor component 2214 can detect the open/closed state of the electronic device 2200, the relative positioning of components, such as the display and the keypad of the electronic device 2200, the sensor component 2214 can also detect the electronic device 2200 or one of the electronic device 2200 The location of components changes, the presence or absence of user contact with the electronic device 2200, the orientation or acceleration/deceleration of the device 2200, and the temperature of the electronic device 2200 changes. Sensor assembly 2214 may include a proximity sensor configured to detect the presence of nearby objects in the absence of any physical contact. 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 component 2214 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
通信组件2216被配置为便于电子设备2200和其他设备之间有线或无线方式的通信。电子设备2200可以接入基于通信标准的无线网络,如WiFi,2G或3G,或它们的组合。在一个示例性实施例中,通信部件2216经由广播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个示例性实施例中,所述通信部件2216还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。 Communication component 2216 is configured to facilitate wired or wireless communication between electronic device 2200 and other devices. Electronic device 2200 may access wireless networks based on communication standards, such as WiFi, 2G or 3G, or a combination thereof. In one exemplary embodiment, the communication component 2216 receives broadcast signals 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 communication. 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.
在示例性实施例中,电子设备2200可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行本公开中所述的任意一种图像处理方法。In an exemplary embodiment, 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 A programmed gate array (FPGA), controller, microcontroller, microprocessor or other electronic component implementation is used to perform any one of the image processing methods described in this disclosure.
在示例性实施例中,还提供了一种包括指令的计算机可读存储介质,例如包括指令的存储器2204,上述指令可由电子设备2200的处理器2220执行以完成上述图像处理方法。例如,所述计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。当存储介质中的指令由电子设备的处理器执行时,使得电子设备能够执行本公开中所述的任意一种图像处理方法的步骤。对于装置实施例而言,由于其与方法实施例基本相似,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。In an exemplary embodiment, a computer-readable storage medium including instructions, such as a memory 2204 including instructions, is also provided, and the instructions can be executed by the processor 2220 of the electronic device 2200 to complete the image processing method described above. For example, the computer-readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, and the like. When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is enabled to perform the steps of any one of the image processing methods described in the present disclosure. As for the apparatus embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and reference may be made to the partial description of the method embodiment for related parts.
本公开所有实施例均为单独被执行,也可以与其他实施例相结合被执行,均视为本公开要求的保护范围。All the embodiments of the present disclosure are implemented independently, and may also be implemented in combination with other embodiments, which are all regarded as the protection scope required by the present disclosure.
在此提供的信息提取方案不与任何特定计算机、虚拟系统或者其它设备固有相关。各种通用系统也可以与基于在此的示教一起使用。根据上面的描述,构造具有本公开方案的系统所要求的结构是显而易见的。此外,本公开也不针对任何特定编程语言。应当明白,可以利用各种编程语言实现在此描述的本公开的内容,并且上面对特定语言所做 的描述是为了披露本公开的最佳实施方式。The information extraction schemes presented herein are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used with teaching based on this. From the above description, the structure required to construct a system having the present disclosure is apparent. Furthermore, this disclosure is not directed to any particular programming language. It should be understood that various programming languages may be used to implement the disclosures described herein and that the descriptions of specific languages above are intended to disclose the best mode of the disclosure.
在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本公开的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。In the description provided herein, numerous specific details are set forth. It will be understood, however, that embodiments of the present 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 will be appreciated that in the above description of exemplary embodiments of the present disclosure, various features of the present disclosure are sometimes grouped together into a single embodiment, figure, or its description. However, this method of disclosure should not be interpreted as reflecting an intention that 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 the present disclosure.
本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。Those skilled in the art will understand that the modules in the device in the embodiment can be adaptively changed and arranged in one or more devices different from the embodiment. The modules or units or components in the embodiments may be combined into one module or unit or component, and further they may be divided into multiple sub-modules or sub-units or sub-assemblies. All features disclosed in this specification (including accompanying claims, abstract and drawings) and any method so disclosed may be employed in any combination unless at least some of such features and/or procedures or elements are mutually exclusive. All processes or units of equipment are combined. Each feature disclosed in this specification (including accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本公开的范围之内并且形成不同的实施例。例如,在权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。Furthermore, those skilled in the art will appreciate that although some of the embodiments described herein include certain features, but not others, included in other embodiments, that combinations of features of different embodiments are intended to be within the scope of the present disclosure within and form different embodiments. For example, in the claims, any of the claimed embodiments may be used in any combination.
本公开的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本公开的信息提取方案中的一些或者全部部件的一些或者全部功能。本公开还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本公开的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。Various component embodiments of the present 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 the information extraction scheme according to the present disclosure. The present disclosure can also be implemented as apparatus or apparatus programs (eg, computer programs and computer program products) for performing some or all of the methods described herein. Such a program implementing the present disclosure may be stored on a computer-readable medium, or may be in the form of one or more signals. Such signals may be downloaded from Internet sites, or provided on carrier signals, or in any other form.
应该注意的是上述实施例对本公开进行说明而不是对本公开进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本公开可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。It should be noted that the above-described embodiments illustrate rather than limit the disclosure, and that alternative embodiments may be devised by those skilled in the art 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 present disclosure may be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, and third, etc. do not denote any order. These words can be interpreted as names.

Claims (25)

  1. 一种图像处理方法,其中,包括:An image processing method, comprising:
    获取包含被美妆部位的目标图像;Get the target image that contains the makeup part;
    获取所述被美妆部位的轮廓特征点在所述目标图像中的坐标值,以作为目标坐标值;Obtain the coordinate value of the contour feature point of the part to be beautified in the target image, as the target coordinate value;
    根据所述目标坐标值,以及预先确定的配置文件,得到所述被美妆部位的网格结构,以作为目标网格结构;According to the target coordinate value and the predetermined configuration file, the grid structure of the part to be beautified is obtained as the target grid structure;
    根据所述目标网格结构,对所述被美妆部位进行美妆处理,得到美妆图像;According to the target grid structure, beauty makeup processing is performed on the beauty makeup part to obtain a beauty makeup image;
    其中,所述配置文件中包括被美妆部位的网格结构中的预设三角形以及所述预设三角形的顶点的坐标值,所述预设三角形包括至少一个第一类三角形和与所述第一类三角形对应的第二类三角形,一个第一类三角形的顶点包括两个稳定点和一个第一扩展点,一个第二类三角形的顶点包括与其对应的第一类三角形中的第一扩展点、一个开关点和一个第二扩展点;Wherein, the configuration file includes a preset triangle in the mesh structure of the part to be beautified and coordinate values of vertices of the preset triangle, and the preset triangle includes at least one first-type triangle and a A triangle of the second type corresponds to a triangle of the first type. The vertex of a triangle of the first type includes two stable points and a first extension point, and the vertex of a triangle of the second type includes the first extension point of the corresponding triangle of the first type. , a switch point and a second expansion point;
    所述稳定点和所述开关点分别为在被美妆部位从第一状态变化至第二状态的过程中,所述被美妆部位的轮廓特征点中运动幅度最小的一点和运动幅度最大的点,所述第一扩展点和所述第二扩展点为预先根据所述被美妆部位的轮廓设置的点。The stable point and the switch point are respectively the point with the smallest movement range and the one with the largest movement range among the contour feature points of the beautified part in the process of changing from the first state to the second state of the beautified part. point, the first extension point and the second extension point are points set in advance according to the contour of the part to be beautified.
  2. 根据权利要求1所述的图像处理方法,其中,所述方法还包括:The image processing method according to claim 1, wherein the method further comprises:
    响应于用户的第一操作,修改预先确定的所述配置文件中的其中一个第一扩展点的坐标值;In response to the user's first operation, modifying the predetermined coordinate value of one of the first extension points in the configuration file;
    保存修改后的所述配置文件;save the modified configuration file;
    所述根据所述目标坐标值,以及预先确定的配置文件,得到所述被美妆部位的网格结构,包括:The grid structure of the part to be beautified is obtained according to the target coordinate value and a predetermined configuration file, including:
    根据所述目标坐标值,以及修改后的所述配置文件,得到所述目标网格结构。According to the target coordinate value and the modified configuration file, the target grid structure is obtained.
  3. 根据权利要求1所述的图像处理方法,其中,所述第二类三角形中的开关点的坐标值为,被美妆部位处于所述第一状态时,所述开关点所处位置处的坐标值,其中,一个第二类三角形存在一个与其对应的目标三角形,所述目标三角形的顶点包括与其对应的第二类三角形中的第一扩展点、被美妆部位处于所述第二状态时所述开关点所处位置上的点和目标点,所述第二类三角形与其对应的所述目标三角形相似;The image processing method according to claim 1, wherein the coordinate value of the switch point in the second type of triangle is the coordinate value of the position of the switch point when the part to be beautified is in the first state value, wherein, a second-type triangle has a corresponding target triangle, and the vertex of the target triangle includes the first extension point in the corresponding second-type triangle, and the value of the target triangle when the makeup part is in the second state. The point on the position where the switch point is located and the target point, the second type of triangle is similar to its corresponding target triangle;
    所述方法还包括:The method also includes:
    根据所述第二类三角形与其对应的目标三角形的相似关系,以及所述第二类三角形的顶点的坐标值、被美妆部位处于所述第二状态时所述开关点所处位置上的点的坐标值,计算所述目标点的坐标值;According to the similar relationship between the second type of triangle and its corresponding target triangle, as well as the coordinate value of the vertex of the second type of triangle, the point at the position of the switch point when the part to be beautified is in the second state The coordinate value of , calculate the coordinate value of the target point;
    根据所述目标点的坐标值以及所述第二扩展点的坐标值,显示从所述目标点指向与其对应的第二扩展点的方向;According to the coordinate value of the target point and the coordinate value of the second extension point, displaying the direction from the target point to the corresponding second extension point;
    其中,与目标点对应的第二扩展点,为与目标点所属目标三角形对应的第二类三角形中的第二扩展点。The second extension point corresponding to the target point is the second extension point in the second type of triangle corresponding to the target triangle to which the target point belongs.
  4. 根据权利要求2所述的图像处理方法,其中,所述第二类三角形中的开关点的坐标值为,被美妆部位处于所述第一状态时,所述开关点所处位置处的坐标值,其中,一个第二类三角形存在一个与其对应的目标三角形,所述目标三角形的顶点包括与其对应的第二类三角形中的第一扩展点、被美妆部位处于所述第二状态时所述开关点所处位置上的点和目标点,所述第二类三角形与其对应的所述目标三角形相似;The image processing method according to claim 2, wherein the coordinate value of the switch point in the second type of triangle is the coordinate value of the position of the switch point when the part to be beautified is in the first state value, wherein, a second-type triangle has a corresponding target triangle, and the vertex of the target triangle includes the first extension point in the corresponding second-type triangle, and the value of the target triangle when the makeup part is in the second state. The point on the position where the switch point is located and the target point, the second type of triangle is similar to its corresponding target triangle;
    所述第一操作为用户对目标界面上显示的一个目标点的坐标值的修改操作;The first operation is a user's modification operation on the coordinate value of a target point displayed on the target interface;
    所述响应于用户的第一操作,修改预先确定的所述配置文件中的其中一个第一扩展点的坐标值,包括:The modifying the predetermined coordinate value of one of the first extension points in the configuration file in response to the user's first operation includes:
    根据所述第一操作,确定参考点修改后的坐标值,所述参考点为所述第一操作针对的目标点;According to the first operation, the modified coordinate value of a reference point is determined, and the reference point is the target point targeted by the first operation;
    根据参考点所属的目标三角形,与该目标三角形对应的第二类三角形的相似关系,以及目标参数,计算与所述参考点所属的目标三角形对应的第二类三角形的第一扩展点修改后的坐标值;According to the target triangle to which the reference point belongs, the similarity relationship of the second type of triangle corresponding to the target triangle, and the target parameters, calculate the modified first extension point of the second type of triangle corresponding to the target triangle to which the reference point belongs. coordinate value;
    其中,所述目标参数包括所述参考点修改后的坐标值、被美妆部位处于所述第一状态时所述开关点所处位置上的点的坐标值、被美妆部位处于所述第二状态时所述开关点所处位置上的点的坐标值、与所述参考点所属目标三角形对应的第二类三角形的第二扩展点的坐标值。Wherein, the target parameter includes the modified coordinate value of the reference point, the coordinate value of the point where the switch point is located when the cosmetic part is in the first state, and the cosmetic part is in the first state. In the second state, the coordinate value of the point where the switch point is located, and the coordinate value of the second extension point of the second type of triangle corresponding to the target triangle to which the reference point belongs.
  5. 根据权利要求1所述的图像处理方法,其中,所述根据所述目标坐标值,以及预先确定的配置文件,得到所述被美妆部位的网格结构,包括:The image processing method according to claim 1, wherein, according to the target coordinate value and a predetermined configuration file, the grid structure of the part to be beautified is obtained, comprising:
    采用相似三角形算法,根据所述目标图像中的被美妆部位的轮廓特征点中的稳定点的坐标值,以及所述配置文件中的第一类三角形的顶点的坐标值,计算得到第一类扩展点的坐标值;Using the similar triangle algorithm, according to the coordinate value of the stable point in the contour feature points of the part to be beautified in the target image, and the coordinate value of the vertex of the first type of triangle in the configuration file, the first type of triangle is calculated. The coordinate value of the extension point;
    采用相似三角形算法,根据所述目标图像中的被美妆部位的轮廓特征点中的开关点的坐标值、所述第一类扩展点的坐标值以及所述配置文件中的第二类三角形的顶点的坐标值,计算得到第二类扩展点的坐标值;Using the similar triangle algorithm, according to the coordinate value of the switch point in the contour feature point of the part to be beautified in the target image, the coordinate value of the first type of extension point and the second type of triangle in the configuration file The coordinate value of the vertex is calculated to obtain the coordinate value of the second type of extension point;
    根据所述第一类扩展点的坐标值、所述第二类扩展点的坐标值和所述目标坐标值,计算得到第三类扩展点的坐标值;According to the coordinate value of the first type of extension point, the coordinate value of the second type of extension point and the target coordinate value, calculate the coordinate value of the third type of extension point;
    根据所述第一类扩展点的坐标值、所述第二类扩展点的坐标值和所述第三类扩展点的坐标值,得到所述目标网格结构;Obtain the target grid structure according to the coordinate value of the first type of extension point, the coordinate value of the second type of extension point and the coordinate value of the third type of extension point;
    其中,所述第一类扩展点为所述目标网格结构中,与所述第一类三角形中的第一扩展点对应的点;所述第二类扩展点为所述目标网格结构中,与所述第二类三角形中的第二扩展点对应的点,所述第三类扩展点为所述目标网格结构中除所述目标图像中的被美妆部位的轮廓特征点、所述第一类扩展点和所述第二类扩展点之外的其他点。The first type of extension point is a point in the target grid structure that corresponds to the first extension point in the first type of triangle; the second type of extension point is in the target grid structure , the point corresponding to the second expansion point in the second type of triangle, and the third type of expansion point is the contour feature point of the makeup part in the target image except the contour feature point in the target image, all the Points other than the first type of extension point and the second type of extension point.
  6. 根据权利要求5所述的图像处理方法,其中,所述第三类扩展点中的至少部分点的坐标值是采用平滑过渡或插值方法确定的。The image processing method according to claim 5, wherein the coordinate values of at least some points in the third type of extension points are determined by using a smooth transition or interpolation method.
  7. 根据权利要求5所述的图像处理方法,其中,所述预设三角形还包括至少一个第三类三角形,其中,一个第三类三角形的顶点包括一个第三扩展点和目标集合中的其中两个点,所述第三扩展点为预先根据所述被美妆部位的轮廓设置的点,所述目标集合中包括所述第一类三角形的顶点和所述第二类三角形的顶点,以及所述被美妆部位的轮廓特征点中除去所述稳定点和所述开关点之外的其他点;The image processing method according to claim 5, wherein the preset triangle further comprises at least one triangle of the third type, wherein the vertex of a triangle of the third type comprises a third extension point and two of the target set point, the third extension point is a point set in advance according to the contour of the part to be beautified, the target set includes the vertices of the first type of triangles and the vertices of the second type of triangles, and the Other points except the stable point and the switch point in the contour feature points of the part to be beauty makeup;
    所述根据所述第一类扩展点的坐标值、所述第二类扩展点的坐标值和所述目标坐标值,计算得到第三类扩展点的坐标值,包括:According to the coordinate value of the first type of extension point, the coordinate value of the second type of extension point and the target coordinate value, the coordinate value of the third type of extension point is calculated and obtained, including:
    采用相似三角形算法,根据所述第一类扩展点的坐标值、所述第二类扩展点的坐标值和所述目标坐标值,以及所述配置文件中的第三类三角形的顶点的坐标值,计算得到所述第三类扩展点的坐标值。Using the similar triangle algorithm, according to the coordinate value of the first type of extension point, the coordinate value of the second type of extension point and the target coordinate value, and the coordinate value of the vertex of the third type of triangle in the configuration file , and calculate the coordinate value of the third type of extension point.
  8. 根据权利要求1所述的图像处理方法,其中,在所述美妆部位为眼睛的情况下,所述稳定点为两个眼角点,所述开关点为上眼皮轮廓的中点。The image processing method according to claim 1, wherein, in the case that the beauty makeup parts are eyes, the stable points are two corner points, and the switch point is the midpoint of the contour of the upper eyelid.
  9. 一种图像处理装置,其中,包括:An image processing device, comprising:
    图像获取模块,被配置为获取包含被美妆部位的目标图像;an image acquisition module, configured to acquire a target image containing the part to be beautified;
    坐标获取模块,被配置为获取所述被美妆部位的轮廓特征点在所述目标图像中的坐标值,以作为目标坐标值;A coordinate acquisition module, configured to acquire the coordinate value of the contour feature point of the part to be beautified in the target image, as the target coordinate value;
    网格结构获取模块,被配置为根据所述目标坐标值,以及预先确定的配置文件,得到所述被美妆部位的网格结构,以作为目标网格结构;a grid structure acquisition module, configured to obtain the grid structure of the part to be beautified according to the target coordinate value and a predetermined configuration file, as a target grid structure;
    图像绘制模块,被配置为根据所述目标网格结构,对所述被美妆部位进行美妆处理,得到美妆图像;an image drawing module, configured to perform beauty makeup processing on the beautified part according to the target grid structure to obtain a beauty makeup image;
    其中,所述配置文件中包括被美妆部位的网格结构中的预设三角形以及所述预设三角形的顶点的坐标值,所述预设三角形包括至少一个第一类三角形和与所述第一类三角形对应的第二类三角形,一个第一类三角形的顶点包括两个稳定点和一个第一扩展点,一个第二类三角形的顶点包括与其对应的第一类三角形中的第一扩展点、一个开关点和一个第二扩展点;Wherein, the configuration file includes a preset triangle in the mesh structure of the part to be beautified and coordinate values of vertices of the preset triangle, and the preset triangle includes at least one first-type triangle and a A triangle of the second type corresponds to a triangle of the first type. The vertex of a triangle of the first type includes two stable points and a first extension point, and the vertex of a triangle of the second type includes the first extension point of the corresponding triangle of the first type. , a switch point and a second expansion point;
    所述稳定点和所述开关点分别为在被美妆部位从第一状态变化至第二状态的过程中,所述被美妆部位的轮廓特征点中运动幅度最小的一点和运动幅度最大的点,所述第一扩展点和所述第二扩展点为预先根据所述被美妆部位的轮廓设置的点。The stable point and the switch point are respectively the point with the smallest movement range and the one with the largest movement range among the contour feature points of the beautified part in the process of changing from the first state to the second state of the beautified part. point, the first extension point and the second extension point are points set in advance according to the contour of the part to be beautified.
  10. 根据权利要求9所述的图像处理装置,其中,所述装置还包括:The image processing apparatus according to claim 9, wherein the apparatus further comprises:
    修改模块,被配置为响应于用户的第一操作,修改预先确定的所述配置文件中的其中一个第一扩展点的坐标值;a modification module, configured to modify the predetermined coordinate value of one of the first extension points in the configuration file in response to the user's first operation;
    保存模块,被配置为保存修改后的所述配置文件;a saving module configured to save the modified configuration file;
    所述网格结构获取模块具体被配置为:The grid structure acquisition module is specifically configured as:
    根据所述目标坐标值,以及修改后的所述配置文件,得到所述目标网格结构。According to the target coordinate value and the modified configuration file, the target grid structure is obtained.
  11. 根据权利要求9所述的图像处理装置,其中,所述第二类三角形中的开关点的坐标值为,被美妆部位处于所述第一状态时,所述开关点所处位置处的坐标值,其中,一个第二类三角形存在一个与其对应的目标三角形,所述目标三角形的顶点包括与其对应的第二类三角形中的第一扩展点、被美妆部位处于所述第二状态时所述开关点所处位置上的点和目标点,所述第二类三角形与其对应的所述目标三角形相似;The image processing device according to claim 9, wherein the coordinate value of the switch point in the second type of triangle is the coordinate value of the position of the switch point when the part to be beautified is in the first state value, wherein, a second-type triangle has a corresponding target triangle, and the vertex of the target triangle includes the first extension point in the corresponding second-type triangle, and the value of the target triangle when the makeup part is in the second state. The point on the position where the switch point is located and the target point, the second type of triangle is similar to its corresponding target triangle;
    所述装置还包括:The device also includes:
    第一计算模块,被配置为根据所述第二类三角形与其对应的目标三角形的相似关系,以及所述第二类三角形的顶点的坐标值、被美妆部位处于所述第二状态时所述开关点所处位置上的点的坐标值,计算所述目标点的坐标值;The first calculation module is configured to describe the second type of triangle according to the similarity relationship between the second type of triangle and its corresponding target triangle, as well as the coordinate value of the vertex of the second type of triangle, when the part to be beauty makeup is in the second state. The coordinate value of the point at the position of the switch point, and the coordinate value of the target point is calculated;
    显示模块,被配置为根据所述目标点的坐标值以及所述第二扩展点的坐标值,显示从所述目标点指向与其对应的第二扩展点的方向;a display module, configured to display a direction from the target point to the corresponding second extension point according to the coordinate value of the target point and the coordinate value of the second extension point;
    其中,与目标点对应的第二扩展点,为与目标点所属目标三角形对应的第二类三角形中的第二扩展点。The second extension point corresponding to the target point is the second extension point in the second type of triangle corresponding to the target triangle to which the target point belongs.
  12. 根据权利要求10所述的图像处理装置,其中,所述第二类三角形中的开关点的坐标值为,被美妆部位处于所述第一状态时,所述开关点所处位置处的坐标值,其中,一个第二类三角形存在一个与其对应的目标三角形,所述目标三角形的顶点包括与其对应的第二类三角形中的第一扩展点、被美妆部位处于所述第二状态时所述开关点所处位置上的点和目标点,所述第二类三角形与其对应的所述目标三角形相似;The image processing device according to claim 10, wherein the coordinate value of the switch point in the second type of triangle is the coordinate value of the position of the switch point when the part to be beautified is in the first state value, wherein, a second-type triangle has a corresponding target triangle, and the vertex of the target triangle includes the first extension point in the corresponding second-type triangle, and the value of the target triangle when the makeup part is in the second state. The point on the position where the switch point is located and the target point, the second type of triangle is similar to its corresponding target triangle;
    所述第一操作为用户对目标界面上显示的一个目标点的坐标值的修改操作;The first operation is a user's modification operation on the coordinate value of a target point displayed on the target interface;
    所述修改模块包括:The modification module includes:
    第一确定子模块,被配置为根据所述第一操作,确定参考点修改后的坐标值,所述参考点为所述第一操作针对的目标点;a first determination submodule, configured to determine, according to the first operation, a modified coordinate value of a reference point, where the reference point is a target point targeted by the first operation;
    第一计算子模块,被配置为根据参考点所属的目标三角形,与该目标三角形对应的第二类三角形的相似关系,以及目标参数,计算与所述参考点所属的目标三角形对应的第二类三角形的第一扩展点修改后的坐标值;The first calculation sub-module is configured to calculate the second type of 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 relationship of the second type of triangle corresponding to the target triangle, and the target parameter. The modified coordinate value of the first extension point of the triangle;
    其中,所述目标参数包括所述参考点修改后的坐标值、被美妆部位处于所述第一状态时所述开关点所处位置上的点的坐标值、被美妆部位处于所述第二状态时所述开关点所处位置上的点的坐标值、与所述参考点所属目标三角形对应的第二类三角形的第二扩展点的坐标值。Wherein, the target parameter includes the modified coordinate value of the reference point, the coordinate value of the point where the switch point is located when the cosmetic part is in the first state, and the cosmetic part is in the first state. In the second state, the coordinate value of the point where the switch point is located, and the coordinate value of the second extension point of the second type of triangle corresponding to the target triangle to which the reference point belongs.
  13. 根据权利要求9所述的图像处理装置,其中,所述网格结构获取模块包括:The image processing apparatus according to claim 9, wherein the grid structure acquisition module comprises:
    第二计算子模块,被配置为采用相似三角形算法,根据所述目标图像中的被美妆部位的轮廓特征点中的稳定点的坐标值,以及所述配置文件中的第一类三角形的顶点的坐标值,计算得到第一类扩展点的坐标值;The second calculation sub-module is configured to adopt a similar triangle algorithm, according to the coordinate value of the stable point in the contour feature points of the part to be beautified in the target image, and the vertices of the first type of triangle in the configuration file. The coordinate value of , calculate the coordinate value of the first type of extension point;
    第三计算子模块,被配置为采用相似三角形算法,根据所述目标图像中的被美妆部位的轮廓特征点中的开关点的坐标值、所述第一类扩展点的坐标值以及所述配置文件中的第二类三角形的顶点的坐标值,计算得到第二类扩展点的坐标值;The third calculation sub-module is configured to adopt a similar triangle algorithm, according to the coordinate value of the switch point in the contour feature points of the part to be beautified in the target image, the coordinate value of the first type of extension point and the The coordinate value of the vertex of the second type of triangle in the configuration file is calculated to obtain the coordinate value of the second type of extension point;
    第四计算子模块,被配置为根据所述第一类扩展点的坐标值、所述第二类扩展点的坐标值和所述目标坐标值,计算得到第三类扩展点的坐标值;The fourth calculation submodule is configured to calculate the coordinate value of the third type of expansion point according to the coordinate value of the first type of expansion point, the coordinate value of the second type of expansion point and the target coordinate value;
    网格结构绘制子模块,被配置为根据所述第一类扩展点的坐标值、所述第二类扩展点的坐标值和所述第三类扩展点的坐标值,得到所述目标网格结构;A grid structure drawing submodule, configured to obtain the target grid according to the coordinate values of the first type of extension points, the coordinate values of the second type of extension points and the coordinate values of the third type of extension points structure;
    其中,所述第一类扩展点为所述目标网格结构中,与所述第一类三角形中的第一扩展点对应的点;所述第二类扩展点为所述目标网格结构中,与所述第二类三角形中的第二扩展点对应的点,所述第三类扩展点为所述目标网格结构中除所述目标图像中的被美妆部位的轮廓特征点、所述第一类扩展点和所述第二类扩展点之外的其他点。The first type of extension point is a point in the target grid structure that corresponds to the first extension point in the first type of triangle; the second type of extension point is in the target grid structure , the point corresponding to the second expansion point in the second type of triangle, and the third type of expansion point is the contour feature point of the makeup part in the target image except the contour feature point in the target image, all the Points other than the first type of extension point and the second type of extension point.
  14. 根据权利要求13所述的图像处理装置,其中,所述第三类扩展点中的至少部分点的坐标值是采用平滑过渡或插值方法确定的。The image processing apparatus according to claim 13, wherein the coordinate values of at least some points in the third type of extension points are determined by using a smooth transition or interpolation method.
  15. 根据权利要求13所述的图像处理装置,其中,所述预设三角形还包括至少一个第三类三角形,其中,一个第三类三角形的顶点包括一个第三扩展点和目标集合中的其中两个点,所述第三扩展点为预先根据所述被美妆部位的轮廓设置的点,所述目标集合中包括所述第一类三角形的顶点和所述第二类三角形的顶点,以及所述被美妆部位的轮廓特征点中除去所述稳定点和所述开关点之外的其他点;The image processing apparatus according to claim 13, wherein the preset triangle further comprises at least one third type of triangle, wherein a vertex of one third type of triangle comprises a third extension point and two of the target set point, the third extension point is a point set in advance according to the contour of the part to be beautified, the target set includes the vertices of the first type of triangles and the vertices of the second type of triangles, and the Other points except the stable point and the switch point in the contour feature points of the part to be beauty makeup;
    所述第四计算子模块具体被配置为:The fourth computing submodule is specifically configured as:
    采用相似三角形算法,根据所述第一类扩展点的坐标值、所述第二类扩展点的坐标值和所述目标坐标值,以及所述配置文件中的第三类三角形的顶点的坐标值,计算得到所述第三类扩展点的坐标值。Using the similar triangle algorithm, according to the coordinate value of the first type of extension point, the coordinate value of the second type of extension point and the target coordinate value, and the coordinate value of the vertex of the third type of triangle in the configuration file , and calculate the coordinate value of the third type of extension point.
  16. 根据权利要求9所述的图像处理装置,其中,在所述美妆部位为眼睛的情况下,所述稳定点为两个眼角点,所述开关点为上眼皮轮廓的中点。The image processing device according to claim 9, wherein, in the case where the beauty makeup parts are eyes, the stable points are two corner points, and the switching point is a midpoint of the contour of the upper eyelid.
  17. 一种电子设备,其中,包括:An electronic device comprising:
    处理器;processor;
    用于存储所述处理器可执行指令的存储器;a memory for storing the processor-executable instructions;
    其中,所述处理器被配置为执行以下步骤:wherein the processor is configured to perform the following steps:
    获取包含被美妆部位的目标图像;Get the target image that contains the makeup part;
    获取所述被美妆部位的轮廓特征点在所述目标图像中的坐标值,以作为目标坐标值;Obtain the coordinate value of the contour feature point of the part to be beautified in the target image, as the target coordinate value;
    根据所述目标坐标值,以及预先确定的配置文件,得到所述被美妆部位的网格结构,以作为目标网格结构;According to the target coordinate value and the predetermined configuration file, the grid structure of the part to be beautified is obtained as the target grid structure;
    根据所述目标网格结构,对所述被美妆部位进行美妆处理,得到美妆图像;According to the target grid structure, beauty makeup processing is performed on the beauty makeup part to obtain a beauty makeup image;
    其中,所述配置文件中包括被美妆部位的网格结构中的预设三角形以及所述预设三角形的顶点的坐标值,所述预设 三角形包括至少一个第一类三角形和与所述第一类三角形对应的第二类三角形,一个第一类三角形的顶点包括两个稳定点和一个第一扩展点,一个第二类三角形的顶点包括与其对应的第一类三角形中的第一扩展点、一个开关点和一个第二扩展点;Wherein, the configuration file includes a preset triangle in the mesh structure of the part to be beautified and coordinate values of vertices of the preset triangle, and the preset triangle includes at least one first-type triangle and a A triangle of the second type corresponds to a triangle of the first type. The vertex of a triangle of the first type includes two stable points and a first extension point, and the vertex of a triangle of the second type includes the first extension point of the corresponding triangle of the first type. , a switch point and a second expansion point;
    所述稳定点和所述开关点分别为在被美妆部位从第一状态变化至第二状态的过程中,所述被美妆部位的轮廓特征点中运动幅度最小的一点和运动幅度最大的点,所述第一扩展点和所述第二扩展点为预先根据所述被美妆部位的轮廓设置的点。The stable point and the switch point are respectively the point with the smallest movement range and the one with the largest movement range among the contour feature points of the beautified part in the process of changing from the first state to the second state of the beautified part. point, the first extension point and the second extension point are points set in advance according to the contour of the part to be beautified.
  18. 根据权利要求17所述的电子设备,其中,所述处理器还被配置为执行以下步骤:The electronic device of claim 17, wherein the processor is further configured to perform the steps of:
    响应于用户的第一操作,修改预先确定的所述配置文件中的其中一个第一扩展点的坐标值;In response to the user's first operation, modifying the predetermined coordinate value of one of the first extension points in the configuration file;
    保存修改后的所述配置文件;save the modified configuration file;
    所述根据所述目标坐标值,以及预先确定的配置文件,得到所述被美妆部位的网格结构,包括:The grid structure of the part to be beautified is obtained according to the target coordinate value and a predetermined configuration file, including:
    根据所述目标坐标值,以及修改后的所述配置文件,得到所述目标网格结构。According to the target coordinate value and the modified configuration file, the target grid structure is obtained.
  19. 根据权利要求17所述的电子设备,其中,所述第二类三角形中的开关点的坐标值为,被美妆部位处于所述第一状态时,所述开关点所处位置处的坐标值,其中,一个第二类三角形存在一个与其对应的目标三角形,所述目标三角形的顶点包括与其对应的第二类三角形中的第一扩展点、被美妆部位处于所述第二状态时所述开关点所处位置上的点和目标点,所述第二类三角形与其对应的所述目标三角形相似;The electronic device according to claim 17, wherein the coordinate value of the switch point in the second type of triangle is the coordinate value of the position of the switch point when the part to be beautified is in the first state , wherein, a second-type triangle has a corresponding target triangle, and the vertex of the target triangle includes the first expansion point in the corresponding second-type triangle, and the makeup part is in the second state. The point at the position of the switch point and the target point, the second type of triangle is similar to its corresponding target triangle;
    所述处理器还被配置为执行以下步骤:The processor is also configured to perform the following steps:
    根据所述第二类三角形与其对应的目标三角形的相似关系,以及所述第二类三角形的顶点的坐标值、被美妆部位处于所述第二状态时所述开关点所处位置上的点的坐标值,计算所述目标点的坐标值;According to the similar relationship between the second type of triangle and its corresponding target triangle, as well as the coordinate value of the vertex of the second type of triangle, the point at the position of the switch point when the part to be beautified is in the second state The coordinate value of , calculate the coordinate value of the target point;
    根据所述目标点的坐标值以及所述第二扩展点的坐标值,显示从所述目标点指向与其对应的第二扩展点的方向;According to the coordinate value of the target point and the coordinate value of the second extension point, displaying the direction from the target point to the corresponding second extension point;
    其中,与目标点对应的第二扩展点,为与目标点所属目标三角形对应的第二类三角形中的第二扩展点。The second extension point corresponding to the target point is the second extension point in the second type of triangle corresponding to the target triangle to which the target point belongs.
  20. 根据权利要求18所述的电子设备,其中,所述第二类三角形中的开关点的坐标值为,被美妆部位处于所述第一状态时,所述开关点所处位置处的坐标值,其中,一个第二类三角形存在一个与其对应的目标三角形,所述目标三角形的顶点包括与其对应的第二类三角形中的第一扩展点、被美妆部位处于所述第二状态时所述开关点所处位置上的点和目标点,所述第二类三角形与其对应的所述目标三角形相似;The electronic device according to claim 18, wherein the coordinate value of the switch point in the second type of triangle is the coordinate value of the position of the switch point when the part to be beautified is in the first state , wherein, a second-type triangle has a corresponding target triangle, and the vertex of the target triangle includes the first expansion point in the corresponding second-type triangle, and the makeup part is in the second state. The point at the position of the switch point and the target point, the second type of triangle is similar to its corresponding target triangle;
    所述第一操作为用户对目标界面上显示的一个目标点的坐标值的修改操作;The first operation is a user's modification operation on the coordinate value of a target point displayed on the target interface;
    所述处理器还被配置为执行以下步骤:The processor is also configured to perform the following steps:
    根据所述第一操作,确定参考点修改后的坐标值,所述参考点为所述第一操作针对的目标点;According to the first operation, the modified coordinate value of a reference point is determined, and the reference point is the target point targeted by the first operation;
    根据参考点所属的目标三角形,与该目标三角形对应的第二类三角形的相似关系,以及目标参数,计算与所述参考点所属的目标三角形对应的第二类三角形的第一扩展点修改后的坐标值;According to the target triangle to which the reference point belongs, the similarity relationship of the second type of triangle corresponding to the target triangle, and the target parameters, calculate the modified first extension point of the second type of triangle corresponding to the target triangle to which the reference point belongs. coordinate value;
    其中,所述目标参数包括所述参考点修改后的坐标值、被美妆部位处于所述第一状态时所述开关点所处位置上的点的坐标值、被美妆部位处于所述第二状态时所述开关点所处位置上的点的坐标值、与所述参考点所属目标三角形对应的第二类三角形的第二扩展点的坐标值。Wherein, the target parameter includes the modified coordinate value of the reference point, the coordinate value of the point where the switch point is located when the cosmetic part is in the first state, and the cosmetic part is in the first state. In the second state, the coordinate value of the point where the switch point is located, and the coordinate value of the second extension point of the second type of triangle corresponding to the target triangle to which the reference point belongs.
  21. 根据权利要求17所述的电子设备,其中,所述处理器还被配置为执行以下步骤:The electronic device of claim 17, wherein the processor is further configured to perform the steps of:
    采用相似三角形算法,根据所述目标图像中的被美妆部位的轮廓特征点中的稳定点的坐标值,以及所述配置文件中的第一类三角形的顶点的坐标值,计算得到第一类扩展点的坐标值;Using the similar triangle algorithm, according to the coordinate value of the stable point in the contour feature points of the part to be beautified in the target image, and the coordinate value of the vertex of the first type triangle in the configuration file, the first type is calculated. The coordinate value of the extension point;
    采用相似三角形算法,根据所述目标图像中的被美妆部位的轮廓特征点中的开关点的坐标值、所述第一类扩展点的坐标值以及所述配置文件中的第二类三角形的顶点的坐标值,计算得到第二类扩展点的坐标值;Using the similar triangle algorithm, according to the coordinate value of the switch point in the contour feature point of the part to be beautified in the target image, the coordinate value of the first type of extension point and the second type of triangle in the configuration file The coordinate value of the vertex is calculated to obtain the coordinate value of the second type of extension point;
    根据所述第一类扩展点的坐标值、所述第二类扩展点的坐标值和所述目标坐标值,计算得到第三类扩展点的坐标值;According to the coordinate value of the first type of extension point, the coordinate value of the second type of extension point and the target coordinate value, calculate the coordinate value of the third type of extension point;
    根据所述第一类扩展点的坐标值、所述第二类扩展点的坐标值和所述第三类扩展点的坐标值,得到所述目标网格结构;Obtain the target grid structure according to the coordinate value of the first type of extension point, the coordinate value of the second type of extension point and the coordinate value of the third type of extension point;
    其中,所述第一类扩展点为所述目标网格结构中,与所述第一类三角形中的第一扩展点对应的点;所述第二类扩展点为所述目标网格结构中,与所述第二类三角形中的第二扩展点对应的点,所述第三类扩展点为所述目标网格结构中除所述目标图像中的被美妆部位的轮廓特征点、所述第一类扩展点和所述第二类扩展点之外的其他点。The first type of extension point is a point in the target grid structure that corresponds to the first extension point in the first type of triangle; the second type of extension point is in the target grid structure , the point corresponding to the second expansion point in the second type of triangle, and the third type of expansion point is the contour feature point of the makeup part in the target image except the contour feature point in the target image, all the Points other than the first type of extension point and the second type of extension point.
  22. 根据权利要求21所述的电子设备,其中,所述第三类扩展点中的至少部分点的坐标值是采用平滑过渡或插值方法确定的。The electronic device according to claim 21, wherein the coordinate values of at least some points in the third type of extension points are determined by using a smooth transition or interpolation method.
  23. 根据权利要求21所述的电子设备,其中,所述预设三角形还包括至少一个第三类三角形,其中,一个第三类三 角形的顶点包括一个第三扩展点和目标集合中的其中两个点,所述第三扩展点为预先根据所述被美妆部位的轮廓设置的点,所述目标集合中包括所述第一类三角形的顶点和所述第二类三角形的顶点,以及所述被美妆部位的轮廓特征点中除去所述稳定点和所述开关点之外的其他点;The electronic device according to claim 21, wherein the preset triangle further includes at least one triangle of the third type, wherein the vertex of a triangle of the third type includes a third extension point and two of the points in the target set , the third extension point is a point set in advance according to the contour of the part to be beautified, and the target set includes the vertices of the first type of triangle and the vertices of the second type of triangle, and the Points other than the stable point and the switch point in the contour feature points of the beauty makeup part;
    所述处理器还被配置为执行以下步骤:The processor is also configured to perform the following steps:
    采用相似三角形算法,根据所述第一类扩展点的坐标值、所述第二类扩展点的坐标值和所述目标坐标值,以及所述配置文件中的第三类三角形的顶点的坐标值,计算得到所述第三类扩展点的坐标值。Using the similar triangle algorithm, according to the coordinate value of the first type of extension point, the coordinate value of the second type of extension point and the target coordinate value, and the coordinate value of the vertex of the third type of triangle in the configuration file , and calculate the coordinate value of the third type of extension point.
  24. 根据权利要求17所述的电子设备,其中,在所述美妆部位为眼睛的情况下,所述稳定点为两个眼角点,所述开关点为上眼皮轮廓的中点。The electronic device according to claim 17, wherein, when the beauty makeup part is the eye, the stable point is two corner points, and the switch point is the midpoint of the contour of the upper eyelid.
  25. 一种存储介质,其中,所述存储介质中的指令由电子设备的处理器执行时,使得所述电子设备能够执行以下步骤:A storage medium, wherein when the instructions in the storage medium are executed by a processor of an electronic device, the electronic device can perform the following steps:
    获取包含被美妆部位的目标图像;Get the target image that contains the makeup part;
    获取所述被美妆部位的轮廓特征点在所述目标图像中的坐标值,以作为目标坐标值;Obtain the coordinate value of the contour feature point of the part to be beautified in the target image, as the target coordinate value;
    根据所述目标坐标值,以及预先确定的配置文件,得到所述被美妆部位的网格结构,以作为目标网格结构;According to the target coordinate value and the predetermined configuration file, the grid structure of the part to be beautified is obtained as the target grid structure;
    根据所述目标网格结构,对所述被美妆部位进行美妆处理,得到美妆图像;According to the target grid structure, beauty makeup processing is performed on the beauty makeup part to obtain a beauty makeup image;
    其中,所述配置文件中包括被美妆部位的网格结构中的预设三角形以及所述预设三角形的顶点的坐标值,所述预设三角形包括至少一个第一类三角形和与所述第一类三角形对应的第二类三角形,一个第一类三角形的顶点包括两个稳定点和一个第一扩展点,一个第二类三角形的顶点包括与其对应的第一类三角形中的第一扩展点、一个开关点和一个第二扩展点;Wherein, the configuration file includes a preset triangle in the mesh structure of the part to be beautified and coordinate values of vertices of the preset triangle, and the preset triangle includes at least one first-type triangle and a A triangle of the second type corresponds to a triangle of the first type. The vertex of a triangle of the first type includes two stable points and a first extension point, and the vertex of a triangle of the second type includes the first extension point of the corresponding triangle of the first type. , a switch point and a second expansion point;
    所述稳定点和所述开关点分别为在被美妆部位从第一状态变化至第二状态的过程中,所述被美妆部位的轮廓特征点中运动幅度最小的一点和运动幅度最大的点,所述第一扩展点和所述第二扩展点为预先根据所述被美妆部位的轮廓设置的点。The stable point and the switch point are respectively the point with the smallest movement range and the one with the largest movement range among the contour feature points of the beautified part in the process of changing from the first state to the second state of the beautified part. point, the first extension point and the second extension point are points set in advance according to the contour of the part to be beautified.
PCT/CN2021/114378 2020-08-24 2021-08-24 Image processing method and apparatus WO2022042570A1 (en)

Applications Claiming Priority (2)

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

Publications (1)

Publication Number Publication Date
WO2022042570A1 true WO2022042570A1 (en) 2022-03-03

Family

ID=80295631

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/114378 WO2022042570A1 (en) 2020-08-24 2021-08-24 Image processing method and apparatus

Country Status (2)

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

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117972438A (en) * 2024-03-31 2024-05-03 浪潮电子信息产业股份有限公司 Data processing method, system, equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109063560A (en) * 2018-06-28 2018-12-21 北京微播视界科技有限公司 Image processing method, device, computer readable storage medium and terminal
CN109584151A (en) * 2018-11-30 2019-04-05 腾讯科技(深圳)有限公司 Method for beautifying faces, device, terminal and storage medium
US20190122404A1 (en) * 2016-03-02 2019-04-25 Holition Limited Locating and augmenting object features in images
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
CN111489311A (en) * 2020-04-09 2020-08-04 北京百度网讯科技有限公司 Face beautifying method and device, electronic equipment and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107977934B (en) * 2017-11-10 2022-04-01 北京小米移动软件有限公司 Image processing method and device
CN108986016B (en) * 2018-06-28 2021-04-20 北京微播视界科技有限公司 Image beautifying method and device and electronic equipment
CN111047511A (en) * 2019-12-31 2020-04-21 维沃移动通信有限公司 Image processing method and electronic equipment

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
US20190122404A1 (en) * 2016-03-02 2019-04-25 Holition Limited Locating and augmenting object features in images
CN109063560A (en) * 2018-06-28 2018-12-21 北京微播视界科技有限公司 Image processing method, device, computer readable storage medium and terminal
CN109584151A (en) * 2018-11-30 2019-04-05 腾讯科技(深圳)有限公司 Method for beautifying faces, device, terminal and storage medium
CN111489311A (en) * 2020-04-09 2020-08-04 北京百度网讯科技有限公司 Face beautifying method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN114095646B (en) 2022-08-26
CN114095646A (en) 2022-02-25

Similar Documents

Publication Publication Date Title
KR102283613B1 (en) Avatar Creation User Interface
TWI785258B (en) Method, device, and storage medium for processing human face image
CN110675310B (en) Video processing method and device, electronic equipment and storage medium
CN107680033B (en) Picture processing method and device
KR102442485B1 (en) Image processing method and apparatus, electronic device and computer readable storage medium
CN109242765B (en) Face image processing method and device and storage medium
WO2015188614A1 (en) Method and device for operating computer and mobile phone in virtual world, and glasses using same
CN107818543B (en) Image processing method and device
CN107958439B (en) Image processing method and device
CN107977934B (en) Image processing method and device
US11030733B2 (en) Method, electronic device and storage medium for processing image
EP2927787A1 (en) Method and device for displaying picture
CN107657590B (en) Picture processing method and device and storage medium
CN107341777B (en) Picture processing method and device
CN110889382A (en) Virtual image rendering method and device, electronic equipment and storage medium
US11308692B2 (en) Method and device for processing image, and storage medium
CN107330868A (en) image processing method and device
CN109325908B (en) Image processing method and device, electronic equipment and storage medium
CN111985268A (en) Method and device for driving animation by human face
TW202013316A (en) Method, device and electronic apparatus for face image processing and storage medium thereof
CN109840939A (en) Three-dimensional rebuilding method, device, electronic equipment and storage medium
US20210118148A1 (en) Method and electronic device for changing faces of facial image
CN110782532B (en) Image generation method, image generation device, electronic device, and storage medium
WO2022042570A1 (en) Image processing method and apparatus
CN108776957A (en) Face image processing process and device

Legal Events

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

Ref document number: 21860405

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 27.06.2023)

122 Ep: pct application non-entry in european phase

Ref document number: 21860405

Country of ref document: EP

Kind code of ref document: A1