Method and device for fitting masks and real-life facial images for medical aesthetics
By obtaining the feature points of the real face image and fitting the standard mask image, the problem of low automation in the prior art is solved, and a more accurate determination of plastic surgery plans and minimized surgery volume is achieved.
Patent Information
- Application Number
- CN202210433165.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-24
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2042-04-24
AI Technical Summary
The existing technology of traditional Chinese medicine beauty masks and real-person facial image fitting methods have low degree of automation, which makes it difficult to determine plastic surgery plans.
By obtaining the image of the to-process real person's face, performing feature detection, and using the feature points of the to-processed feature points and the standard face mask image for fitting, including building connections and scaling, until the feature lines overlap, to achieve automated fitting of the image.
It improves the degree of automation of image fitting, can determine the plastic surgery plan more accurately, and reduce the amount of surgery.
Smart Images

Figure CN115035022B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of medical aesthetics technology, and in particular to a method and device for fitting a mask and a real-life facial image for medical aesthetics. Background Art
[0002] With the improvement of living standards, people pay more and more attention to appearance. For those with poor appearance and temperament, they usually choose facial plastic surgery to improve their appearance and temperament.
[0003] Currently, before performing facial plastic surgery, manual fitting of real-life images and standard facial mask images is required to determine the difference between the user's real face and the standard face corresponding to the standard facial mask image, so as to determine the plastic surgery plan.
[0004] In the process of realizing the present invention, the inventors discovered that the prior art has the following defects: since the existing image fitting is performed manually, the existing method has the problem of low degree of automation. Summary of the Invention
[0005] The purpose of the embodiments of the present application is to provide a method and device for fitting a mask and a real-life facial image for medical aesthetics, so as to solve the problem of low automation in the prior art.
[0006] In a first aspect, an embodiment of the present application provides a method for fitting a mask and a real-person facial image for medical aesthetics, the method comprising: obtaining a real-person facial image to be processed for fitting with a standard facial mask image; performing feature detection on the real-person facial image to be processed to obtain feature points to be processed; and fitting the real-person facial image to be processed and the standard facial mask image based on the feature points to be processed and the standard feature points obtained after feature detection on the standard facial mask image to obtain a fitted image.
[0007] Therefore, with the help of the above technical solution, the embodiment of the present application can automatically realize the fitting of the real face image to be processed and the standard face mask image. Compared with the existing method, it can at least improve the degree of automation of image fitting.
[0008] In one possible embodiment, the standard facial mask image includes a standard frontal face image, the real person facial image to be processed includes a frontal face image to be processed, the feature points to be processed include inner eye corner points to be processed and lip points to be processed, the standard feature points include standard inner eye corner points and standard lip points, and the fitting image includes a frontal face fitting image;
[0009] Wherein, based on the feature points to be processed and the standard feature points obtained after feature detection of the standard facial mask image, the real person facial image to be processed and the standard facial mask image are fitted to obtain a fitted image, including: constructing a first line of two inner eye corner points to be processed corresponding to the real person facial image to be processed, determining the first midpoint of the first line, and constructing a second line of the first midpoint and the lip point to be processed; based on the second line and the third line corresponding to the standard frontal face image, the frontal face image to be processed is scaled until the second line and the third line coincide, so as to obtain a frontal face fitting image; wherein the third line is constructed based on the second midpoint of the fourth line of the two standard inner eye corner points of the standard facial mask image and the standard lip point.
[0010] Therefore, with the help of the above technical solution, the embodiment of the present application can improve the degree of automation of image fitting.
[0011] In one possible embodiment, the standard facial mask image includes a standard side face image, and the real person facial image to be processed includes a side face image to be processed, and the feature points to be processed include a brow point to be processed, a lower eyelid point to be processed, an upper lip convex point to be processed, a lower lip convex point to be processed, and a chin convex point to be processed, and the standard feature points include a standard brow point, a standard lower eyelid point, a standard upper lip convex point, a standard lower lip convex point, and a standard chin convex point, and the fitting image includes a side face fitting image;
[0012] Among them, based on the feature points to be processed and the standard feature points obtained after feature detection of the standard facial mask image, the real person facial image to be processed and the standard facial mask image are fitted to obtain a fitted image, including: based on the to-be-processed brow point, the to-be-processed lower eyelid point, the standard brow point and the standard lower eyelid point, the upper half of the to-be-processed real person facial image and the upper half of the standard facial mask image are fitted to obtain a middle side face fitting image; based on the to-be-processed upper lip convex point, the to-be-processed lower lip convex point, the to-be-processed chin convex point, the standard upper lip convex point, the standard lower lip convex point and the standard chin convex point, the lower half of the middle side face fitting image except the upper half is fitted again to obtain a side face fitting image.
[0013] Therefore, with the help of the above technical solution, the embodiment of the present application can achieve the effect of minimizing the amount of surgery.
[0014] In one possible embodiment, based on the to-be-processed Yintang point, the to-be-processed lower eyelid point, the standard Yintang point and the standard lower eyelid point, the upper half of the to-be-processed real-person face image and the upper half of the standard face mask image are fitted to obtain an intermediate side face fitting image, including: calculating the first coordinate difference between the first coordinate of the to-be-processed Yintang point and the first coordinate of the to-be-processed lower eyelid point; judging the size of the first coordinate difference and the preset Yintang height value; if it is determined that the first coordinate difference is greater than or equal to the preset Yintang height value, aligning the first coordinate of the to-be-processed Yintang point and the first coordinate of the standard Yintang point.
[0015] Therefore, with the help of the above technical solution, the embodiment of the present application can achieve the effect of minimizing the amount of surgery.
[0016] In a possible embodiment, the method also includes: if it is determined that the first coordinate difference is less than the preset Yintang height value, then judging the size of the first coordinate difference and the first difference; wherein the first difference is the difference between the preset Yintang height value and the preset Yintang adjustment value; if it is determined that the first coordinate difference is greater than or equal to the first difference, then calculating the first sum of the lower eyelid point to be processed and the preset Yintang height value, and using the first sum as the new first coordinate of the Yintang point to be processed, and aligning the new first coordinate of the Yintang point to be processed with the first coordinate of the standard Yintang point.
[0017] Therefore, with the help of the above technical solution, the embodiment of the present application can achieve the effect of minimizing the amount of surgery.
[0018] In a possible embodiment, the method also includes: if it is determined that the first coordinate difference is less than the first difference, then judging the size of the first coordinate difference and the second difference; wherein the second difference is the difference between the preset Yintang height value and twice the preset Yintang adjustment value; if the first coordinate difference is greater than or equal to the second difference, then calculating the first coordinate of the lower eyelid point to be processed and the second sum of the first difference, and using the second sum as the new first coordinate of the Yintang point to be processed, and aligning the new first coordinate of the Yintang point to be processed with the first coordinate of the standard Yintang point; if the first coordinate difference is less than the second difference, then calculating the third sum of the first coordinate of the lower eyelid point to be processed and the second difference, and using the third sum as the new first coordinate of the Yintang point to be processed, and aligning the new first coordinate of the Yintang point to be processed with the first coordinate of the standard Yintang point.
[0019] Therefore, with the help of the above technical solution, the embodiment of the present application can achieve the effect of minimizing the amount of surgery.
[0020] In one possible embodiment, based on the upper lip convex point to be processed, the lower lip convex point to be processed, the chin convex point to be processed, the standard upper lip convex point, the standard lower lip convex point and the standard chin convex point, the lower half of the intermediate profile fitting image except the upper half is re-fitted to obtain the profile fitting image, including: calculating the second coordinate difference between the first coordinate of the chin convex point to be processed and the first coordinate of the standard chin convex point; judging whether the second coordinate difference is non-negative; if it is determined that the second coordinate difference is negative, aligning the first coordinate of the upper lip convex point to be processed in the intermediate profile fitting image with the first coordinate of the standard upper lip convex point in the intermediate profile fitting image.
[0021] Therefore, with the help of the above technical solution, the embodiment of the present application can achieve the effect of minimizing the amount of surgery.
[0022] In one possible embodiment, the method further includes: if it is determined that the second coordinate difference is non-negative, calculating the third coordinate difference between the first coordinate of the standard lower lip convex point and the first coordinate of the chin convex point to be processed, and judging the size of the third coordinate difference and the preset side chin value; if it is determined that the third coordinate difference is greater than or equal to the preset side chin value, aligning the first coordinate of the chin convex point to be processed with the first coordinate of the standard chin convex point; if it is determined that the third coordinate difference is less than the preset side chin value, calculating the fourth sum of the first coordinate of the standard chin convex point and the preset side chin value, and using the fourth sum as the new first coordinate of the standard chin convex point, and aligning the new first coordinate of the standard chin convex point with the first coordinate of the chin convex point to be processed.
[0023] Therefore, with the help of the above technical solution, the embodiment of the present application can achieve the effect of minimizing the amount of surgery.
[0024] In one possible embodiment, calculating the second coordinate difference between the first coordinate of the chin convex point to be processed and the first coordinate of the standard chin convex point includes: calculating the fourth coordinate difference between the first coordinate of the upper lip convex point to be processed and the first coordinate of the lower lip convex point to be processed; judging whether the fourth coordinate difference is a non-negative number; if it is determined that the second coordinate difference is a non-negative number, calculating the second coordinate difference; if it is determined that the second coordinate difference is a negative number, updating the first coordinate of the chin point to be processed to the first coordinate of the upper lip convex point to be processed, so as to achieve realignment of the upper half of the real face image to be processed and the upper half of the standard face mask image.
[0025] Therefore, with the help of the above technical solution, the embodiment of the present application can achieve the effect of minimizing the amount of surgery.
[0026] In the second aspect, an embodiment of the present application provides a device for fitting masks and real-person facial images for medical aesthetics, including: an acquisition module for acquiring a real-person facial image to be processed for fitting with a standard facial mask image; a feature detection module for performing feature detection on the real-person facial image to be processed to obtain feature points to be processed; a fitting processing module for fitting the real-person facial image to be processed and the standard facial mask image based on the feature points to be processed and the standard feature points obtained after feature detection of the standard facial mask image to obtain a fitted image.
[0027] Therefore, with the help of the above technical solution, the embodiment of the present application can automatically realize the fitting of the real face image to be processed and the standard face mask image. Compared with the existing method, it can at least improve the degree of automation of image fitting.
[0028] In one possible embodiment, the standard facial mask image includes a standard frontal face image, the real person facial image to be processed includes a frontal face image to be processed, the feature points to be processed include inner eye corner points to be processed and lip points to be processed, the standard feature points include standard inner eye corner points and standard lip points, and the fitting image includes a frontal face fitting image;
[0029] Among them, the fitting processing module is specifically used to: construct a first line connecting two inner eye corner points to be processed corresponding to the real face image to be processed, determine the first midpoint of the first line, and construct a second line connecting the first midpoint and the lip dividing point to be processed; based on the second line and the third line corresponding to the standard frontal face image, the frontal face image to be processed is scaled until the second line and the third line coincide to obtain a frontal face fitting image; wherein the third line is constructed based on the second midpoint of the fourth line connecting the two standard inner eye corner points of the standard facial mask image and the standard lip dividing point.
[0030] Therefore, with the help of the above technical solution, the embodiment of the present application can improve the degree of automation of image fitting.
[0031] In one possible embodiment, the standard facial mask image includes a standard side face image, and the real person facial image to be processed includes a side face image to be processed, and the feature points to be processed include a brow point to be processed, a lower eyelid point to be processed, an upper lip convex point to be processed, a lower lip convex point to be processed, and a chin convex point to be processed, and the standard feature points include a standard brow point, a standard lower eyelid point, a standard upper lip convex point, a standard lower lip convex point, and a standard chin convex point, and the fitting image includes a side face fitting image;
[0032] Among them, the fitting processing module is specifically used to: based on the to-be-processed brow point, the to-be-processed lower eyelid point, the standard brow point and the standard lower eyelid point, perform fitting processing on the upper half of the to-be-processed real-person face image and the upper half of the standard face mask image to obtain the intermediate side face fitting image; based on the to-be-processed upper lip convex point, the to-be-processed lower lip convex point, the to-be-processed chin convex point, the standard upper lip convex point, the standard lower lip convex point and the standard chin convex point, perform re-fitting on the lower half of the intermediate side face fitting image except the upper half to obtain the side face fitting image.
[0033] Therefore, with the help of the above technical solution, the embodiment of the present application can achieve the effect of minimizing the amount of surgery.
[0034] In one possible embodiment, the fitting processing module is specifically used to: calculate the first coordinate difference between the first coordinate of the to-be-processed Yintang point and the first coordinate of the to-be-processed lower eyelid point; determine the size of the first coordinate difference and the preset Yintang height value; if it is determined that the first coordinate difference is greater than or equal to the preset Yintang height value, align the first coordinate of the to-be-processed Yintang point and the first coordinate of the standard Yintang point.
[0035] Therefore, with the help of the above technical solution, the embodiment of the present application can achieve the effect of minimizing the amount of surgery.
[0036] In a possible embodiment, the device also includes: a first judgment module, which is used to judge the size of the first coordinate difference and the first difference if it is determined that the first coordinate difference is less than the preset Yintang height value; wherein the first difference is the difference between the preset Yintang height value and the preset Yintang adjustment value; a first calculation and alignment module, which is used to calculate the first sum of the lower eyelid point to be processed and the preset Yintang height value if it is determined that the first coordinate difference is greater than or equal to the first difference, and use the first sum as the new first coordinate of the Yintang point to be processed, and align the new first coordinate of the Yintang point to be processed with the first coordinate of the standard Yintang point.
[0037] Therefore, with the help of the above technical solution, the embodiment of the present application can achieve the effect of minimizing the amount of surgery.
[0038] In one possible embodiment, the device also includes: a second judgment module, which is used to judge the size of the first coordinate difference and the second difference if it is determined that the first coordinate difference is less than the first difference; wherein the second difference is the difference between the preset Yintang height value and twice the preset Yintang adjustment value; a second calculation and alignment module, which is used to calculate the first coordinate of the lower eyelid point to be processed and the second sum of the first difference if the first coordinate difference is greater than or equal to the second difference, and use the second sum as the new first coordinate of the Yintang point to be processed, and align the new first coordinate of the Yintang point to be processed with the first coordinate of the standard Yintang point; a third calculation and alignment module, which is used to calculate the third sum of the first coordinate of the lower eyelid point to be processed and the second difference if the first coordinate difference is less than the second difference, and use the third sum as the new first coordinate of the Yintang point to be processed, and align the new first coordinate of the Yintang point to be processed with the first coordinate of the standard Yintang point.
[0039] Therefore, with the help of the above technical solution, the embodiment of the present application can achieve the effect of minimizing the amount of surgery.
[0040] In one possible embodiment, the fitting processing module is specifically used to: calculate the second coordinate difference between the first coordinate of the chin convex point to be processed and the first coordinate of the standard chin convex point; determine whether the second coordinate difference is a non-negative number; if it is determined that the second coordinate difference is a negative number, align the first coordinate of the upper lip convex point to be processed in the intermediate profile fitting image with the first coordinate of the standard upper lip convex point in the intermediate profile fitting image.
[0041] Therefore, with the help of the above technical solution, the embodiment of the present application can achieve the effect of minimizing the amount of surgery.
[0042] In one possible embodiment, the device further includes: a calculation and judgment module, which is used to calculate the third coordinate difference between the first coordinate of the standard lower lip convex point and the first coordinate of the chin convex point to be processed if it is determined that the second coordinate difference is non-negative, and to judge the size of the third coordinate difference and the preset side chin value; an alignment module, which is used to align the first coordinate of the chin convex point to be processed with the first coordinate of the standard chin convex point if it is determined that the third coordinate difference is greater than or equal to the preset side chin value; a fourth calculation and alignment module, which is used to calculate the fourth sum of the first coordinate of the standard chin convex point and the preset side chin value if it is determined that the third coordinate difference is less than the preset side chin value, and use the fourth sum as the new first coordinate of the standard chin convex point, and align the new first coordinate of the standard chin convex point with the first coordinate of the chin convex point to be processed.
[0043] Therefore, with the help of the above technical solution, the embodiment of the present application can achieve the effect of minimizing the amount of surgery.
[0044] In one possible embodiment, the fitting processing module is specifically used to: calculate the fourth coordinate difference between the first coordinate of the upper lip convex point to be processed and the first coordinate of the lower lip convex point to be processed; determine whether the fourth coordinate difference is a non-negative number; if the second coordinate difference is determined to be a non-negative number, calculate the second coordinate difference; if the second coordinate difference is determined to be a negative number, update the first coordinate of the brow point to be processed to the first coordinate of the upper lip convex point to be processed, so as to achieve realignment of the upper half of the real face image to be processed and the upper half of the standard face mask image.
[0045] Therefore, with the help of the above technical solution, the embodiment of the present application can achieve the effect of minimizing the amount of surgery.
[0046] In a third aspect, an embodiment of the present application provides a computer storage medium having a computer program stored thereon, and the computer program is executed by a processor to execute the method described in the first aspect or any optional implementation of the first aspect.
[0047] In a fourth aspect, an embodiment of the present application provides an electronic device comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor and the memory communicate through the bus, and when the machine-readable instructions are executed by the processor, the method described in the first aspect or any optional implementation of the first aspect is performed.
[0048] In a fifth aspect, the present application provides a computer program product, which, when running on a computer, enables the computer to execute the method in the first aspect or any possible implementation of the first aspect.
[0049] In order to make the above-mentioned objectives, features and advantages to be achieved by the embodiments of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work.
[0051] Figure 1 A flowchart of a method for fitting a mask and a real face image for medical aesthetics provided by an embodiment of the present application is shown;
[0052] Figure 2 A schematic diagram of a frontal face image to be processed provided by an embodiment of the present application is shown;
[0053] Figure 3 A flowchart of a side face image fitting method provided in an embodiment of the present application is shown;
[0054] Figure 4 A schematic diagram of a side face image to be processed provided by an embodiment of the present application is shown;
[0055] Figure 5 A structural block diagram of a device for fitting a mask and a real face image for medical aesthetics provided by an embodiment of the present application is shown;
[0056] Figure 6 A structural block diagram of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0057] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present invention.
[0058] In order to solve the problem of low degree of automation in existing methods, the embodiment of the present application cleverly proposes an image fitting solution, which obtains a real-person facial image to be processed for fitting with a standard facial mask image, then performs feature detection on the real-person facial image to be processed to obtain feature points to be processed, and then performs fitting processing on the real-person facial image to be processed and the standard facial mask image based on the feature points to be processed and the standard feature points obtained after feature detection on the standard facial mask image to obtain a fitted image.
[0059] With the help of the above technical solution, the embodiment of the present application can automatically realize the fitting of the real face image to be processed and the standard face mask image. Compared with the existing method, it can at least improve the degree of automation of image fitting.
[0060] See Figure 1 , Figure 1 The flowchart of the method for fitting a mask and a real face image for medical aesthetics provided by the embodiment of the present application is shown. Figure 1The method shown can be performed by a device for fitting a mask and a real face image for medical beauty, and the device can be as follows Figure 5 The device shown. And the specific device of the device can be set according to actual needs, and the embodiment of the present application is not limited to this. For example, the device can be a computer or a server. Specifically, the method includes:
[0061] Step S110 , obtaining a real person face image to be processed for fitting with a standard face mask image.
[0062] It should be understood that the standard facial mask image may also be referred to as a mask, or as a reference facial image, etc. For example, the standard facial mask image may be referred to as a golden ratio mask.
[0063] That is, the standard facial mask image may be a preset facial image with perfect proportions, that is, each facial organ (eg, nose, mouth, eyes, etc.) in the standard facial mask image is in perfect proportions.
[0064] It should also be understood that the real-person facial image to be processed may be a facial image of a patient to undergo plastic surgery (or a user seeking advice on plastic surgery, etc.).
[0065] It should also be understood that the images included in the real-person facial image to be processed can also be set according to actual needs, and the embodiments of the present application are not limited to this.
[0066] Optionally, the real-person facial image to be processed may include a frontal face image to be processed and a side face image to be processed.
[0067] For example, the real-person facial image to be processed may include a frontal face image to be processed and a left-side face image to be processed.
[0068] Correspondingly, the standard facial mask image may include a standard frontal face image and a standard side face image.
[0069] It should be noted here that both the standard facial mask image and the real person facial image to be processed can be two-dimensional images.
[0070] Step S120 , performing feature detection on the real person face image to be processed to obtain feature points to be processed.
[0071] It should be understood that the specific feature points included in the feature points to be processed can be set according to actual needs, and the embodiments of the present application are not limited to this.
[0072] For example, when the real-person facial image to be processed is a frontal face image to be processed, the feature points to be processed may include an inner eye corner point to be processed and a lip point to be processed. Both the inner eye corner point to be processed and the lip point to be processed can be used for fitting the frontal face image, and the lip point to be processed can be the midpoint of a line connecting two mouth corners in the frontal face image to be processed.
[0073] For another example, when the real-person facial image to be processed is a profile face image to be processed, the feature points to be processed may include a brow point to be processed, a lower eyelid point to be processed, an upper lip convex point to be processed, a lower lip convex point to be processed, and a chin convex point to be processed. The brow point to be processed, the lower eyelid point to be processed, the upper lip convex point to be processed, the lower lip convex point to be processed, and the chin convex point to be processed can all be used for fitting the profile face image.
[0074] It should also be understood that the specific method for feature detection of the real-life facial image to be processed can be set according to actual needs, and the embodiments of the present application are not limited to this.
[0075] For example, existing computer recognition technology can be used to perform feature detection on the real-person facial image to be processed.
[0076] Step S130 , based on the feature points to be processed and the standard feature points obtained by performing feature detection on the standard facial mask image, fitting processing is performed on the real person facial image to be processed and the standard facial mask image to obtain a fitting image.
[0077] It should be understood that the specific feature points included in the standard feature points can be set according to actual needs, and the embodiments of the present application are not limited to this.
[0078] For example, when the standard facial mask image is a standard frontal face image, the standard feature points may include a standard inner eye corner point and a standard lip dividing point. Both the standard inner eye corner point and the standard lip dividing point may be used for fitting the frontal face image, and the standard lip dividing point may be the midpoint of the line connecting the two mouth corners in the standard frontal face image.
[0079] For another example, when the standard facial mask image is a standard profile face image, the standard feature points may include a standard brow point, a standard lower eyelid point, a standard upper lip convex point, a standard lower lip convex point, and a standard chin convex point. The standard brow point, the standard lower eyelid point, the standard upper lip convex point, the standard lower lip convex point, and the standard chin convex point can all be used for fitting the profile face image.
[0080] It should also be understood that the fitting image may include a front face fitting image and a side face fitting image.
[0081] It should also be understood that based on the feature points to be processed and the standard feature points obtained after feature detection of the standard facial mask image, the real person facial image to be processed and the standard facial mask image are fitted, and the specific process of obtaining the fitted image can also be set according to actual needs, and the embodiments of the present application are not limited to this.
[0082] Optionally, when the real-person facial image to be processed is a frontal face image to be processed and the standard facial mask image is a standard frontal face image, the frontal face image to be processed and the standard frontal face image are fitted based on the feature points to be processed related to the frontal face image to be processed and the standard feature points related to the standard frontal face image to obtain a frontal face fitting image.
[0083] It should be understood that the fitting process may refer to a process of image alignment.
[0084] It should also be understood that based on the feature points to be processed related to the frontal face image to be processed and the standard feature points related to the standard frontal face image, the frontal face image to be processed and the standard frontal face image are fitted, and the specific process of obtaining the frontal face fitting image can be set according to actual needs, and the embodiments of the present application are not limited to this.
[0085] Optionally, a first line connecting two inner canthus points to be processed corresponding to the real face image to be processed may be constructed, and a first midpoint of the first line may be determined. A second line connecting the first midpoint and the lip point to be processed may be constructed. Furthermore, based on the second line and a third line corresponding to the standard frontal face image, the frontal face image to be processed may be scaled (i.e., reduced or enlarged) until the second line and the third line coincide (or the distance between the second line and the third line is the same), thereby obtaining a frontal face fitting image. The third line is constructed based on the second midpoint of a fourth line connecting the two standard inner canthus points of the standard facial mask image and the standard lip point.
[0086] It should be noted here that the third connection line can be pre-constructed, so that in the process of fitting different frontal face images, it can be directly called without repeated construction.
[0087] To facilitate understanding of the specific process of constructing the first connecting line and the connecting line of the lip dividing point, a specific embodiment is used for description below.
[0088] For example, see Figure 2 , Figure 2 FIG. 1 shows a schematic diagram of a frontal face image to be processed provided by an embodiment of the present application. Figure 2 As shown, a first connection between the left inner canthus point and the right inner canthus point can be constructed by a computer program, and a line connecting the midpoint of the first connection line and the lip dividing point can be constructed.
[0089] Therefore, the embodiment of the present application uses the inner canthus points and lip dividing points to automatically fit the frontal face image. Since the inner canthus points and lip dividing points are well distinguished from the surrounding face, and are also relatively classic feature extraction points in the existing face recognition algorithm, their recognition effect is higher for computer recognition, and thus the accuracy of image fitting can be guaranteed, and the efficiency of image fitting can be improved.
[0090] Optionally, when the real-life facial image to be processed is a side face image to be processed and the standard facial mask image is a standard side face image, the side face image to be processed and the standard side face image are fitted based on the feature points to be processed related to the side face image to be processed and the standard feature points related to the standard side face image to obtain a side face fitting image.
[0091] It should also be understood that when the real-life facial image to be processed is a side face image to be processed and the standard facial mask image is a standard side face image, the side face image to be processed and the standard side face image are fitted based on the feature points to be processed related to the side face image to be processed and the standard feature points related to the standard side face image. The specific process of obtaining the side face fitting image can be set according to actual needs, and the embodiments of the present application are not limited to this.
[0092] Alternatively, see Figure 3 , Figure 3 FIG. 1 shows a flow chart of a side face image fitting method provided by an embodiment of the present application. Figure 3 The fitting methods shown are:
[0093] Step S301: Obtain the first coordinates of the feature points to be processed of the side face image to be processed.
[0094] It should be understood that the first coordinate may be a coordinate of the direction in which the face is facing, or a horizontal coordinate, etc.
[0095] It should be noted that since both the profile image to be processed and the standard profile image can be two-dimensional images, they can be placed in the same coordinate system for image fitting. Furthermore, in the initial stage of image fitting, the profile image to be processed and the standard profile image can be initially fitted (i.e., at this stage, the profile image to be processed and the standard profile image are only roughly placed together and have not yet reached the level of image fitting), so that subsequent methods can be implemented based on this initial fitting.
[0096] Step S302: Construct a fifth line connecting the lower eyelid point and the corner of the mouth of the profile image to be processed, and scale the image to be processed based on the fifth line and a sixth line corresponding to the standard profile image until the fifth and sixth lines overlap, at which point scaling stops. The sixth line may be a line connecting the lower eyelid point and the corner of the mouth of the standard profile image.
[0097] It should be understood that the sixth line may be pre-constructed, so that in the subsequent process of scaling the side face image to be processed, there is no need to repeatedly construct the sixth line, thereby improving the efficiency of image fitting.
[0098] To facilitate understanding of the process of constructing the fifth connection, a specific embodiment is used for description below.
[0099] For example, see Figure 4 , Figure 4 FIG. 1 shows a schematic diagram of a side face image to be processed provided by an embodiment of the present application. Figure 4 As shown, the feature points of the side face image to be processed include the corner of the mouth to be processed, the forehead point to be processed, the lower eyelid point to be processed, the upper lip convex point to be processed, the lower lip convex point to be processed and the chin convex point to be processed, and the lower eyelid point to be processed and the corner of the mouth to be processed can be connected to obtain a fifth connecting line.
[0100] Therefore, since the computer can recognize the lower eyelid point and the corner of the mouth point of the side face very well, the embodiment of the present application can select the lower eyelid point to the corner of the mouth point as the approximate eye-lip line to control the scaling size, thereby achieving the effect of precise scaling.
[0101] Step S303: Calculate the first coordinate difference between the first coordinate of the to-be-processed brow point and the first coordinate of the to-be-processed lower eyelid point, wherein the first coordinate difference can be used to represent the actual height of the brow point of the user in the to-be-processed profile image.
[0102] Step S304: determining the difference between the first coordinate difference and the preset forehead height value.
[0103] It should be understood that the specific value of the preset forehead height value can be set according to actual needs, and the embodiments of the present application are not limited to this.
[0104] For example, the preset height value of the forehead may be 55 pixels.
[0105] In addition, if the first coordinate difference is greater than or equal to the preset Yintang height value, it indicates that the user's Yintang height is moderate or relatively high, and step S305 can be executed; if the first coordinate difference is less than the preset Yintang height value, it indicates that the Yintang height is low, and step S306 can be executed.
[0106] Step S305: aligning the first coordinate of the to-be-processed Yintang point with the first coordinate of the standard Yintang point.
[0107] Therefore, step S305 can achieve alignment between the profile image to be processed and the upper half (or upper face) of the standard profile image to obtain a middle profile fitting image, wherein the upper half can be obtained by bisecting the profile image to be processed along a central axis parallel to the direction of the face.
[0108] It should be understood that the upper part can also be called the first part, and correspondingly, the remaining part or the lower part except the upper part can also be called the second part.
[0109] It should also be understood that the intermediate profile face fitting image may refer to an image obtained by aligning the Yin Tang point of the profile face image to be processed and the Yin Tang point of the standard profile face image according to relevant rules.
[0110] Step S306: Determine the magnitude of the first coordinate difference and the first difference value, wherein the first difference value is the difference between the preset brow height value and the preset brow adjustment value.
[0111] For example, when the preset brow height value is B and the preset brow adjustment value is A, the first difference is BA.
[0112] It should be understood that the specific value of the preset Yin Tang adjustment value can be set according to actual needs, and the embodiment of the present application is not limited to this.
[0113] For example, the preset brow adjustment value may be 10.
[0114] In addition, if the first coordinate difference is greater than or equal to the first difference value, step S307 is executed; if the first coordinate difference is less than the first difference value, it indicates that the forehead is relatively low, and step S308 can be executed.
[0115] Step S307, calculating the first sum of the lower eyelid point to be processed and the preset Yintang height value, and taking the first sum as the new first coordinate of the Yintang point to be processed, and aligning the new first coordinate of the Yintang point to be processed with the first coordinate of the standard Yintang point.
[0116] It should be understood that taking the first sum value as the new first coordinate of the Yintang point to be processed means replacing the previous first coordinate with the new first coordinate.
[0117] Therefore, step S307 can be used to align the side face image to be processed with the upper half (or upper face) of the standard side face image to obtain an intermediate side face fitting image.
[0118] Step S308: Determine the magnitude of the first coordinate difference and the second difference, wherein the second difference is the difference between the preset brow height value and twice the preset brow adjustment value.
[0119] For example, when the preset brow height value is B and the preset brow adjustment value is A, the second difference is B-2A.
[0120] In addition, if the first coordinate difference is greater than or equal to the second difference, step S309 is executed; if the first coordinate difference is less than the second difference, step S310 is executed.
[0121] Step S309, calculating the second sum of the first coordinate of the lower eyelid point to be processed and the first difference, and taking the second sum as the new first coordinate of the Yintang point to be processed, and aligning the new first coordinate of the Yintang point to be processed with the first coordinate of the standard Yintang point.
[0122] For example, when the first coordinate of the lower eyelid point to be processed is X, the second sum value may be X+BA.
[0123] Therefore, step S309 can be used to align the side face image to be processed with the upper half (or upper face) of the standard side face image to obtain an intermediate side face fitting image.
[0124] Step S310, calculate the third sum of the first coordinate and the second difference of the lower eyelid point to be processed, and use the third sum as the new first coordinate of the Yintang point to be processed, and align the new first coordinate of the Yintang point to be processed with the first coordinate of the standard Yintang point.
[0125] For example, when the first coordinate of the lower eyelid point to be processed is X, the third sum value may be X+B-2A.
[0126] Step S311 , calculating a fourth coordinate difference between the first coordinate of the upper lip salient point to be processed and the first coordinate of the lower lip salient point to be processed.
[0127] Step S312: determine whether the fourth coordinate difference is a non-negative number.
[0128] That is, it is determined whether the fourth coordinate difference is greater than or equal to zero.
[0129] In addition, if it is determined that the fourth coordinate difference is non-negative (ie, an integer), it indicates that the upper lip is normal, and step S314 can be executed; if the fourth coordinate difference is negative, it indicates that the lower lip is higher than the upper lip, and step S314 can be executed.
[0130] Step S313: realign the middle profile face fitting image.
[0131] Specifically, the first coordinate of the brow point to be processed can be updated to the first coordinate of the upper lip convex point to be processed, and the facial image to be processed can be moved to one side for a certain distance, and the moving distance is the difference between the first coordinate of the upper lip convex point to be processed and the first coordinate of the brow point to be processed, thereby achieving realignment.
[0132] In addition, after step S313 is executed, step S314 may be executed.
[0133] Step S314 , calculating a second coordinate difference between the first coordinate of the chin point to be processed and the first coordinate of the standard chin point.
[0134] Step S315: Determine whether the second coordinate difference is a non-negative number, or in other words, determine whether the second coordinate difference is greater than or equal to zero.
[0135] If the second coordinate difference is non-negative, it means that the side chin of the user in the image to be processed is higher than that in the standard image, and step S316 can be executed; if the second coordinate difference is negative, it means that the side chin of the user in the image to be processed is lower than that in the standard image, and step S320 can be executed.
[0136] Step S316: Calculate the third coordinate difference between the first coordinate of the standard lower lip convex point and the first coordinate of the chin convex point to be processed, wherein the third coordinate difference is used to represent the size of the user's chin in the image to be processed.
[0137] For example, when the first coordinate of the standard lower lip convex point is Y and the first coordinate of the chin convex point to be processed is Z, the third coordinate difference is YZ.
[0138] Step S317: Determine the size of the third coordinate difference and the preset side chin value.
[0139] It should be understood that the specific value of the preset side chin value can be set according to actual needs, and the embodiment of the present application is not limited to this.
[0140] For example, the preset chin value may be 10 pixels.
[0141] In addition, if the third coordinate difference is greater than or equal to the preset chin value, it indicates that the chin is of moderate size, and step S318 can be executed; if the third coordinate difference is less than the preset chin value, it indicates that the chin is relatively large, and step S319 can be executed.
[0142] Step S318: aligning the first coordinate of the chin point to be processed with the first coordinate of the standard chin point.
[0143] Therefore, step S318 can be used to align the lower half (or lower half face) of the side face image to be processed with the standard side face image to obtain a side face fitting image.
[0144] Step S319: Calculate the fourth sum of the first coordinate of the standard chin point and the preset side chin value, use the fourth sum as the new first coordinate of the standard chin point, and align the new first coordinate of the standard chin point with the first coordinate of the chin point to be processed.
[0145] For example, when the first coordinate of the standard chin point is K and the sum of the preset side chin value is M, the fourth sum value is K+M.
[0146] Therefore, step S319 can realize the alignment of the lower half (or lower half face) of the side face image to be processed and the standard side face image to obtain a side face fitting image, so that when it is determined that the side chin is relatively large, appropriate feature points in the chin can be selected for alignment.
[0147] Step S320: aligning the first coordinates of the upper lip salient point to be processed in the intermediate profile face fitting image with the first coordinates of the standard upper lip salient point in the intermediate profile face fitting image.
[0148] That is, the first coordinate of the upper lip convex point to be processed is aligned with the first coordinate of the standard upper lip convex point.
[0149] Therefore, step S320 can achieve alignment between the side face image to be processed and the lower half (or the lower half of the face) of the standard side face image.
[0150] It should be noted here that compared with the fitting of frontal facial images, the fitting of profile facial images is relatively complex. Therefore, in addition to the eye and lip lines, the profile facial images also take into account the forehead, lips and chin. In different situations, the computer performs different calculations, and the fitting that is closest to the human face is used to minimize the amount of surgery and achieve the purpose of guiding doctors.
[0151] It should be noted here that face alignment fitting introduces three preset values: the preset brow height value, the preset brow adjustment value, and the preset chin value. The purpose of using these three preset values is to determine the amount of surgery. With the advancement of medical technology, these three preset values can be adjusted.
[0152] Furthermore, using these three preset values to determine the extent of plastic surgery is currently limited to fat grafting or hyaluronic acid injections. For larger surgeries, such as those involving bone reduction, the constants can also serve as a guide for bone reduction. The height of the Yingtang point determines the extent of surgery in the upper face, while the size of the chin determines the extent of surgery in the midface, not the chin.
[0153] Additionally, the preset values can be set in pixels. For example, 4 pixels are equivalent to 1 mm in real life. Currently, the maximum fill volume a doctor can fill in a single surgery is 5 mm, or 20 pixels, or 2A. Any larger length can only be achieved through multiple surgeries, which is more in line with current practice.
[0154] In summary, with the aid of the above technical solutions, the embodiments of the present application can replace manual alignment with computer alignment.
[0155] In addition, the embodiments of the present application can be Figure 3The profile fitting process shown can determine the difference between the user's profile and the standard profile, and the facial difference can minimize the amount of surgery.
[0156] It should be understood that the above method is merely exemplary, and those skilled in the art may make various modifications based on the above method, and the modified schemes also fall within the scope of protection of this application.
[0157] See Figure 5 , Figure 5 The structural block diagram of a device 500 for fitting a mask and a real face image for medical aesthetics provided by an embodiment of the present application is shown. It should be understood that the device 500 is capable of performing each step in the above-mentioned method embodiment. The specific functions of the device 500 can be found in the description above. To avoid repetition, a detailed description is appropriately omitted here. The device 500 includes at least one software function module that can be stored in a memory in the form of software or firmware or solidified in the operating system (OS) of the device 500. Specifically, the device 500 includes:
[0158] An acquisition module 510 is configured to acquire a real person face image to be processed for fitting with a standard face mask image;
[0159] The feature detection module 520 is used to perform feature detection on the real face image to be processed to obtain feature points to be processed;
[0160] The fitting processing module 530 is used to perform fitting processing on the real face image to be processed and the standard face mask image based on the feature points to be processed and the standard feature points obtained by feature detection on the standard face mask image to obtain a fitting image.
[0161] Therefore, with the help of the above technical solution, the embodiment of the present application can automatically realize the fitting of the real face image to be processed and the standard face mask image. Compared with the existing method, it can at least improve the degree of automation of image fitting.
[0162] In one possible embodiment, the standard facial mask image includes a standard frontal face image, the real person facial image to be processed includes a frontal face image to be processed, the feature points to be processed include inner eye corner points to be processed and lip points to be processed, the standard feature points include standard inner eye corner points and standard lip points, and the fitting image includes a frontal face fitting image;
[0163] Among them, the fitting processing module 530 is specifically used to: construct a first line connecting two inner eye corner points to be processed corresponding to the real face image to be processed, determine the first midpoint of the first line, and construct a second line connecting the first midpoint and the lip dividing point to be processed; based on the second line and the third line corresponding to the standard frontal face image, scale the frontal face image to be processed until the second line and the third line coincide to obtain a frontal face fitting image; wherein the third line is constructed based on the second midpoint of the fourth line connecting the two standard inner eye corner points of the standard facial mask image and the standard lip dividing point.
[0164] Therefore, with the help of the above technical solution, the embodiment of the present application can improve the degree of automation of image fitting.
[0165] In one possible embodiment, the standard facial mask image includes a standard side face image, and the real person facial image to be processed includes a side face image to be processed, and the feature points to be processed include a brow point to be processed, a lower eyelid point to be processed, an upper lip convex point to be processed, a lower lip convex point to be processed, and a chin convex point to be processed, and the standard feature points include a standard brow point, a standard lower eyelid point, a standard upper lip convex point, a standard lower lip convex point, and a standard chin convex point, and the fitting image includes a side face fitting image;
[0166] Among them, the fitting processing module 530 is specifically used to: based on the to-be-processed brow point, the to-be-processed lower eyelid point, the standard brow point and the standard lower eyelid point, perform fitting processing on the upper half of the to-be-processed real face image and the upper half of the standard face mask image to obtain the intermediate side face fitting image; based on the to-be-processed upper lip convex point, the to-be-processed lower lip convex point, the to-be-processed chin convex point, the standard upper lip convex point, the standard lower lip convex point and the standard chin convex point, perform re-fitting on the lower half of the intermediate side face fitting image except the upper half to obtain the side face fitting image.
[0167] Therefore, with the help of the above technical solution, the embodiment of the present application can achieve the effect of minimizing the amount of surgery.
[0168] In one possible embodiment, the fitting processing module 530 is specifically used to: calculate the first coordinate difference between the first coordinate of the to-be-processed Yintang point and the first coordinate of the to-be-processed lower eyelid point; determine the size of the first coordinate difference and the preset Yintang height value; if it is determined that the first coordinate difference is greater than or equal to the preset Yintang height value, align the first coordinate of the to-be-processed Yintang point and the first coordinate of the standard Yintang point.
[0169] Therefore, with the help of the above technical solution, the embodiment of the present application can achieve the effect of minimizing the amount of surgery.
[0170] In one possible embodiment, the device 500 also includes: a first judgment module (not shown), which is used to judge the size of the first coordinate difference and the first difference if it is determined that the first coordinate difference is less than the preset Yintang height value; wherein the first difference is the difference between the preset Yintang height value and the preset Yintang adjustment value; a first calculation and alignment module (not shown), which is used to calculate the first sum of the lower eyelid point to be processed and the preset Yintang height value if it is determined that the first coordinate difference is greater than or equal to the first difference, and use the first sum as the new first coordinate of the Yintang point to be processed, and align the new first coordinate of the Yintang point to be processed with the first coordinate of the standard Yintang point.
[0171] Therefore, with the help of the above technical solution, the embodiment of the present application can achieve the effect of minimizing the amount of surgery.
[0172] In one possible embodiment, the device 500 also includes: a second judgment module (not shown), which is used to judge the size of the first coordinate difference and the second difference if it is determined that the first coordinate difference is less than the first difference; wherein the second difference is the difference between the preset Yintang height value and twice the preset Yintang adjustment value; a second calculation and alignment module (not shown), which is used to calculate the first coordinate of the lower eyelid point to be processed and the second sum of the first difference if the first coordinate difference is greater than or equal to the second difference, and use the second sum as the new first coordinate of the Yintang point to be processed, and align the new first coordinate of the Yintang point to be processed with the first coordinate of the standard Yintang point; a third calculation and alignment module (not shown), which is used to calculate the third sum of the first coordinate of the lower eyelid point to be processed and the second difference if the first coordinate difference is less than the second difference, and use the third sum as the new first coordinate of the Yintang point to be processed, and align the new first coordinate of the Yintang point to be processed with the first coordinate of the standard Yintang point.
[0173] Therefore, with the help of the above technical solution, the embodiment of the present application can achieve the effect of minimizing the amount of surgery.
[0174] In one possible embodiment, the fitting processing module 530 is specifically used to: calculate the second coordinate difference between the first coordinate of the chin convex point to be processed and the first coordinate of the standard chin convex point; determine whether the second coordinate difference is a non-negative number; if it is determined that the second coordinate difference is a negative number, align the first coordinate of the upper lip convex point to be processed in the middle profile fitting image with the first coordinate of the standard upper lip convex point in the middle profile fitting image.
[0175] Therefore, with the help of the above technical solution, the embodiment of the present application can achieve the effect of minimizing the amount of surgery.
[0176] In one possible embodiment, the device further includes: a calculation and judgment module (not shown), which is used to calculate the third coordinate difference between the first coordinate of the standard lower lip convex point and the first coordinate of the chin convex point to be processed if the second coordinate difference is determined to be a non-negative number, and to judge the size of the third coordinate difference and the preset side chin value; an alignment module (not shown), which is used to align the first coordinate of the chin convex point to be processed with the first coordinate of the standard chin convex point if the third coordinate difference is determined to be greater than or equal to the preset side chin value; a fourth calculation and alignment module (not shown), which is used to calculate the fourth sum of the first coordinate of the standard chin convex point and the preset side chin value if the third coordinate difference is determined to be less than the preset side chin value, and to use the fourth sum as the new first coordinate of the standard chin convex point, and to align the new first coordinate of the standard chin convex point with the first coordinate of the chin convex point to be processed.
[0177] Therefore, with the help of the above technical solution, the embodiment of the present application can achieve the effect of minimizing the amount of surgery.
[0178] In one possible embodiment, the fitting processing module 530 is specifically used to: calculate the fourth coordinate difference between the first coordinate of the upper lip convex point to be processed and the first coordinate of the lower lip convex point to be processed; determine whether the fourth coordinate difference is a non-negative number; if the second coordinate difference is determined to be a non-negative number, calculate the second coordinate difference; if the second coordinate difference is determined to be a negative number, update the first coordinate of the brow point to be processed to the first coordinate of the upper lip convex point to be processed, so as to achieve realignment of the upper half of the real face image to be processed and the upper half of the standard face mask image.
[0179] Therefore, with the help of the above technical solution, the embodiment of the present application can achieve the effect of minimizing the amount of surgery.
[0180] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working process of the device described above can refer to the corresponding process in the aforementioned method, and will not be described in detail here.
[0181] See Figure 6 , Figure 6 FIG. 6 shows a structural block diagram of an electronic device 600 provided in an embodiment of the present application. Figure 6As shown, the electronic device 600 may include a processor 610, a communication interface 620, a memory 630, and at least one communication bus 640. The communication bus 640 is used to realize direct connection and communication between these components. The communication interface 620 of the device in the embodiment of the present application is used to communicate signaling or data with other node devices. The processor 610 can be an integrated circuit chip with signal processing capabilities. The above-mentioned processor 610 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor, or the processor 610 can also be any conventional processor.
[0182] The memory 630 may be, but is not limited to, a random access memory (RAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc. The memory 630 stores computer-readable instructions. When the computer-readable instructions are executed by the processor 610, the electronic device 600 may perform the steps of the above-described method embodiment.
[0183] The electronic device 600 may further include a memory controller, an input / output unit, an audio unit, and a display unit.
[0184] The memory 630, storage controller, processor 610, peripheral interface, input / output unit, audio unit, and display unit are electrically connected to each other directly or indirectly to enable data transmission or interaction. For example, these components can be electrically connected to each other via one or more communication buses 640. The processor 610 is used to execute executable modules stored in the memory 630, such as software function modules or computer programs included in the electronic device 600.
[0185] The input and output unit is used to provide input data to the user to realize the interaction between the user and the server (or local terminal). The input and output unit can be, but is not limited to, a mouse and a keyboard.
[0186] The audio unit provides an audio interface to the user and may include one or more microphones, one or more speakers, and audio circuitry.
[0187] The display unit provides an interactive interface (e.g., a user operation interface) between the electronic device and the user or is used to display image data for the user's reference. In this embodiment, the display unit can be a liquid crystal display or a touch display. If it is a touch display, it can be a capacitive touch screen or a resistive touch screen that supports single-point and multi-touch operations. Supporting single-point and multi-touch operations means that the touch display can sense touch operations generated simultaneously from one or more locations on the touch display and pass the sensed touch operations to the processor for calculation and processing.
[0188] I understand. Figure 6 The structure shown is for illustration only. The electronic device 600 may also include Figure 6 More or fewer components than shown, or with Figure 6 Different configurations shown. Figure 6 Each component shown in the figure can be implemented by hardware, software or a combination thereof.
[0189] The present application provides a computer storage medium having a computer program stored thereon. The computer program is executed by a processor to execute the method described in the embodiment.
[0190] The present application also provides a computer program product, which, when running on a computer, enables the computer to execute the method described in the method embodiment.
[0191] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working process of the system described above can refer to the corresponding process in the aforementioned method, and will not be elaborated here.
[0192] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similarities between the various embodiments can be referred to in conjunction with each other. For device embodiments, since they are generally similar to method embodiments, their description is relatively simple, and for relevant details, reference can be made to the description of the method embodiments.
[0193] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0194] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architectures, functions, and operations of the devices, methods, and computer program products according to the multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment, or a portion of code, and the module, program segment, or a portion of code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or can be implemented using a combination of dedicated hardware and computer instructions.
[0195] In addition, the functional modules in each embodiment of the present application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0196] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk. It should be noted that, in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus that includes a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.
[0197] The foregoing description is merely a preferred embodiment of the present application and is not intended to limit the present application. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included within the scope of protection of the present application. It should be noted that similar reference numerals and letters represent similar items in the following figures. Therefore, once an item is defined in one figure, it does not need to be further defined or explained in subsequent figures.
[0198] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. A method for fitting a mask and a real face image for medical aesthetics, characterized in that: include: Obtaining a real face image to be processed for fitting with a standard face mask image; Performing feature detection on the real person face image to be processed to obtain feature points to be processed; Based on the feature points to be processed and the standard feature points obtained by performing feature detection on the standard facial mask image, fitting the real person facial image to be processed and the standard facial mask image to obtain a fitting image; The fitting process is performed on the real person face image to be processed and the standard face mask image to obtain a fitting image, including obtaining first coordinates of feature points to be processed of the side face image to be processed, wherein the real person face image to be processed includes the side face image to be processed, and the first coordinates are coordinates of the face orientation direction or horizontal coordinates; constructing a fifth line connecting the lower eyelid point and the corner of the mouth point of the side face image to be processed, and scaling the image to be processed based on the fifth line and a sixth line corresponding to the standard side face image, until the fifth line and the sixth line coincide, then stopping the scaling, wherein the sixth line is a line connecting the lower eyelid point and the corner of the mouth point of the standard side face image, and the standard face mask image includes the standard side face image; The standard facial mask image includes a standard side face image, and the real person facial image to be processed includes a side face image to be processed, and the feature points to be processed include a brow point to be processed, a lower eyelid point to be processed, an upper lip convex point to be processed, a lower lip convex point to be processed, and a chin convex point to be processed, and the standard feature points include a standard brow point, a standard lower eyelid point, a standard upper lip convex point, a standard lower lip convex point, and a standard chin convex point, and the fitting image includes a side face fitting image; Wherein, based on the feature points to be processed and the standard feature points obtained after feature detection of the standard facial mask image, the real person facial image to be processed and the standard facial mask image are fitted to obtain a fitted image, including: based on the brow point to be processed, the lower eyelid point to be processed, the standard brow point and the standard lower eyelid point, the upper half of the real person facial image to be processed and the upper half of the standard facial mask image are fitted to obtain a middle side face fitting image; based on the upper lip convex point to be processed, the lower lip convex point to be processed, the chin convex point to be processed, the standard upper lip convex point, the standard lower lip convex point and the standard chin convex point, the lower half of the middle side face fitting image except the upper half is fitted again to obtain the side face fitting image.
2. The method according to claim 1, characterized in that The standard facial mask image includes a standard frontal face image, and the real person facial image to be processed includes a frontal face image to be processed, the feature points to be processed include inner eye corner points to be processed and lip points to be processed, and the standard feature points include standard inner eye corner points and standard lip points, and the fitting image includes a frontal face fitting image; The step of fitting the real face image to be processed and the standard face mask image based on the feature points to be processed and the standard feature points obtained by performing feature detection on the standard face mask image to obtain a fitting image comprises: Constructing a first line connecting two inner eye corner points to be processed corresponding to the real person facial image to be processed, determining a first midpoint of the first line, and constructing a second line connecting the first midpoint and the lip point to be processed; Based on the second line and the third line corresponding to the standard frontal face image, the frontal face image to be processed is scaled until the second line and the third line coincide with each other to obtain the frontal face fitting image; wherein the third line is constructed based on the second midpoint of the fourth line of the two standard inner eye corner points of the standard facial mask image and the standard lip dividing point.
3. The method according to claim 1, characterized in that The step of fitting the upper half of the to-be-processed real-person face image and the upper half of the standard face mask image based on the to-be-processed brow point, the to-be-processed lower eyelid point, the standard brow point, and the standard lower eyelid point to obtain a middle profile face fitting image includes: Calculating a first coordinate difference between the first coordinate of the to-be-processed Yintang point and the first coordinate of the to-be-processed lower eyelid point; Determining the difference between the first coordinate difference and a preset brow height value; If it is determined that the first coordinate difference is greater than or equal to the preset Yintang height value, the first coordinate of the Yintang point to be processed is aligned with the first coordinate of the standard Yintang point.
4. The method according to claim 3, characterized in that The method further comprises: If it is determined that the first coordinate difference is less than the preset yintang height value, determining the size of the first coordinate difference and the first difference value; wherein the first difference value is the difference between the preset yintang height value and the preset yintang adjustment value; If it is determined that the first coordinate difference is greater than or equal to the first difference value, the first sum of the lower eyelid point to be processed and the preset Yintang height value is calculated, and the first sum is used as the new first coordinate of the Yintang point to be processed, and the new first coordinate of the Yintang point to be processed is aligned with the first coordinate of the standard Yintang point.
5. The method according to claim 4, characterized in that The method further comprises: If it is determined that the first coordinate difference is less than a first difference value, determining the magnitude of the first coordinate difference and a second difference value; wherein the second difference value is the difference between the preset brow height value and twice the preset brow adjustment value; If the first coordinate difference is greater than or equal to the second difference, calculating a second sum of the first coordinate of the to-be-processed lower eyelid point and the first difference, using the second sum as a new first coordinate of the to-be-processed Yintang point, and aligning the new first coordinate of the to-be-processed Yintang point with the first coordinate of the standard Yintang point; If the first coordinate difference is less than the second difference, calculate the third sum of the first coordinate of the lower eyelid point to be processed and the second difference, and use the third sum as the new first coordinate of the Yingtang point to be processed, and align the new first coordinate of the Yingtang point to be processed with the first coordinate of the standard Yingtang point.
6. The method according to claim 1, characterized in that The step of refitting the lower half of the intermediate profile fitting image except the upper half based on the upper lip convex points to be processed, the lower lip convex points to be processed, the chin convex points to be processed, the standard upper lip convex points, the standard lower lip convex points, and the standard chin convex points to obtain the profile fitting image includes: Calculating a second coordinate difference between the first coordinate of the chin point to be processed and the first coordinate of the standard chin point; Determining whether the second coordinate difference is a non-negative number; If it is determined that the second coordinate difference is a negative number, the first coordinate of the upper lip salient point to be processed in the intermediate profile face fitting image is aligned with the first coordinate of the standard upper lip salient point in the intermediate profile face fitting image.
7. The method according to claim 6, characterized in that The method further comprises: If it is determined that the second coordinate difference is non-negative, calculating a third coordinate difference between the first coordinate of the standard lower lip convex point and the first coordinate of the chin convex point to be processed, and determining a magnitude between the third coordinate difference and a preset side chin value; If it is determined that the third coordinate difference is greater than or equal to the preset side chin value, aligning the first coordinate of the chin point to be processed with the first coordinate of the standard chin point; If it is determined that the third coordinate difference is less than the preset side chin value, a fourth sum of the first coordinate of the standard chin point and the preset side chin value is calculated, and the fourth sum is used as the new first coordinate of the standard chin point, and the new first coordinate of the standard chin point is aligned with the first coordinate of the chin point to be processed.
8. The method according to claim 6, characterized in that Calculating the second coordinate difference between the first coordinate of the chin convex point to be processed and the first coordinate of the standard chin convex point includes: Calculating a fourth coordinate difference between the first coordinate of the upper lip convex point to be processed and the first coordinate of the lower lip convex point to be processed; Determining whether the fourth coordinate difference is a non-negative number; If it is determined that the second coordinate difference is the non-negative number, calculating the second coordinate difference; If it is determined that the second coordinate difference is a negative number, the first coordinate of the to-be-processed brow point is updated to the first coordinate of the to-be-processed upper lip convex point, so as to achieve realignment of the upper half of the to-be-processed real person face image and the upper half of the standard face mask image.
9. A device for fitting a mask to a real face image for medical aesthetics, characterized in that: include: An acquisition module, configured to acquire a real person face image to be processed for fitting with a standard face mask image; A feature detection module is used to perform feature detection on the real face image to be processed to obtain feature points to be processed; a fitting processing module, configured to perform fitting processing on the real person face image to be processed and the standard face mask image based on the feature points to be processed and the standard feature points obtained by performing feature detection on the standard face mask image, so as to obtain a fitting image; The fitting processing module is specifically used to obtain the first coordinates of the feature points to be processed of the side face image to be processed, wherein the real face image to be processed includes the side face image to be processed, and the first coordinates are the coordinates of the direction of the human face orientation or the horizontal coordinates; construct a fifth line connecting the lower eyelid point and the corner of the mouth point of the side face image to be processed, and based on the fifth line and the sixth line corresponding to the standard side face image, scale the image to be processed until the fifth line and the sixth line coincide, then stop scaling, wherein the sixth line is the line connecting the lower eyelid point and the corner of the mouth point of the standard side face image, and the standard facial mask image includes the standard side face image; The standard facial mask image includes a standard side face image, and the real person facial image to be processed includes a side face image to be processed, and the feature points to be processed include a brow point to be processed, a lower eyelid point to be processed, an upper lip convex point to be processed, a lower lip convex point to be processed, and a chin convex point to be processed, and the standard feature points include a standard brow point, a standard lower eyelid point, a standard upper lip convex point, a standard lower lip convex point, and a standard chin convex point, and the fitting image includes a side face fitting image; Among them, the fitting processing module is specifically used to: based on the to-be-processed brow point, the to-be-processed lower eyelid point, the standard brow point and the standard lower eyelid point, perform fitting processing on the upper half of the to-be-processed real-person face image and the upper half of the standard face mask image to obtain the intermediate side face fitting image; based on the to-be-processed upper lip convex point, the to-be-processed lower lip convex point, the to-be-processed chin convex point, the standard upper lip convex point, the standard lower lip convex point and the standard chin convex point, perform re-fitting on the lower half of the intermediate side face fitting image except the upper half to obtain the side face fitting image.
10. The device according to claim 9, characterized in that The standard facial mask image includes a standard frontal face image, and the real person facial image to be processed includes a frontal face image to be processed, the feature points to be processed include inner eye corner points to be processed and lip points to be processed, and the standard feature points include standard inner eye corner points and standard lip points, and the fitting image includes a frontal face fitting image; Among them, the fitting processing module is specifically used to: construct a first line connecting the two inner eye corners to be processed corresponding to the real-life facial image to be processed, determine the first midpoint of the first line, and construct a second line connecting the first midpoint and the lip dividing point to be processed; based on the second line and the third line corresponding to the standard frontal face image, scale the frontal face image to be processed until the second line and the third line coincide to obtain the frontal face fitting image; wherein, the third line is constructed based on the second midpoint of the fourth line connecting the two standard inner eye corners of the standard facial mask image and the standard lip dividing point.
11. The device according to claim 9, characterized in that The fitting processing module is specifically used to: calculate the first coordinate difference between the first coordinate of the to-be-processed Yintang point and the first coordinate of the to-be-processed lower eyelid point; and determine the size of the first coordinate difference and the preset Yintang height value; If it is determined that the first coordinate difference is greater than or equal to the preset Yintang height value, the first coordinate of the Yintang point to be processed is aligned with the first coordinate of the standard Yintang point.
12. The device according to claim 11, characterized in that The device further comprises: a first determining module configured to determine, if it is determined that the first coordinate difference is less than the preset yintang height value, a magnitude of the first coordinate difference and a first difference value; wherein the first difference value is a difference between the preset yintang height value and a preset yintang adjustment value; The first calculation and alignment module is used to calculate the first sum of the lower eyelid point to be processed and the preset Yintang height value if it is determined that the first coordinate difference is greater than or equal to the first difference value, and use the first sum as the new first coordinate of the Yintang point to be processed, and align the new first coordinate of the Yintang point to be processed with the first coordinate of the standard Yintang point.
13. The device according to claim 12, characterized in that The device further comprises: a second judgment module, configured to judge the magnitude of the first coordinate difference and a second difference if it is determined that the first coordinate difference is less than a first difference value; wherein the second difference value is the difference between the preset brow height value and twice the preset brow adjustment value; a second calculation and alignment module, configured to calculate a second sum of the first coordinate of the to-be-processed lower eyelid point and the first difference if the first coordinate difference is greater than or equal to a second difference, use the second sum as a new first coordinate of the to-be-processed Yintang point, and align the new first coordinate of the to-be-processed Yintang point with the first coordinate of the standard Yintang point; The third calculation and alignment module is used to calculate the third sum of the first coordinate of the lower eyelid point to be processed and the second difference if the first coordinate difference is less than the second difference, and use the third sum as the new first coordinate of the yintang point to be processed, and align the new first coordinate of the yintang point to be processed with the first coordinate of the standard yintang point.
14. The device according to claim 9, characterized in that The fitting processing module is specifically used to: calculate the second coordinate difference between the first coordinate of the chin convex point to be processed and the first coordinate of the standard chin convex point; determine whether the second coordinate difference is a non-negative number; if it is determined that the second coordinate difference is a negative number, align the first coordinate of the upper lip convex point to be processed in the intermediate profile fitting image with the first coordinate of the standard upper lip convex point in the intermediate profile fitting image.
15. The device according to claim 14, characterized in that The device further comprises: a calculation and judgment module, configured to calculate a third coordinate difference between the first coordinate of the standard lower lip convex point and the first coordinate of the chin convex point to be processed, if the second coordinate difference is determined to be non-negative, and to determine a magnitude between the third coordinate difference and a preset side chin value; an alignment module, configured to align the first coordinate of the chin point to be processed with the first coordinate of the standard chin point if it is determined that the third coordinate difference is greater than or equal to the preset side chin value; The fourth calculation and alignment module is used to calculate a fourth sum of the first coordinate of the standard chin point and the preset chin value if it is determined that the third coordinate difference is less than the preset chin value, and use the fourth sum as the new first coordinate of the standard chin point, and align the new first coordinate of the standard chin point with the first coordinate of the chin point to be processed.
16. The device according to claim 15, characterized in that The fitting processing module is specifically used to: calculate the fourth coordinate difference between the first coordinate of the upper lip convex point to be processed and the first coordinate of the lower lip convex point to be processed; determine whether the fourth coordinate difference is a non-negative number; if it is determined that the second coordinate difference is the non-negative number, calculate the second coordinate difference; if it is determined that the second coordinate difference is a negative number, update the first coordinate of the brow point to be processed to the first coordinate of the upper lip convex point to be processed, so as to achieve realignment of the upper half of the real face image to be processed and the upper half of the standard face mask image.
Citation Information
Patent Citations
Method for generating personalized three dimension face model and apparatus therefor
KR1020180097915A