Facial Beautification Method, Device, Electronic Device and Storage Medium
By identifying and avoiding the display area of the preset object in the image to be processed, the face area is beautified, and the problems of residual and deformation of beautification traces in the prior art are solved, and a better visual effect is achieved.
Patent Information
- Application Number
- CN202011024656.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-25
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2040-09-25
AI Technical Summary
When the prior art beautify and adjust the face area, it will have a deformation effect on the background area, resulting in residual beautification traces and present different different effects on different background objects.
By identifying the preset first object in the image to be processed, a display area thereof is determined, and a target area that does not contain the preset first object is determined based on the display area, thereby beautifying the face area in the target area.
Reduces beautification traces caused by beautification operations on the face area, avoids unnecessary deformation of the background area, and improves the visual effect.
Smart Images

Figure CN114255175B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a face beautification method, device, electronic device and storage medium. Background Art
[0002] In order to present a satisfactory photogenic effect, users sometimes need to make certain beautification adjustments to the facial area in the captured image or video. However, when the current deformation algorithm makes beautification adjustments to the facial area, it will also have a certain deformation effect on the background area outside the facial area, so that some beautification traces remain in the beautified image. Moreover, the residual beautification traces present different differences on different background objects. Therefore, in order to present a better visual effect, it is necessary to reduce the residual beautification traces. Summary of the invention
[0003] In order to overcome at least one of the deficiencies in the prior art, one of the purposes of the present application is to provide a face beautification method, which is applied to an electronic device, and the method comprises:
[0004] Acquire an image to be processed including a face area;
[0005] Determining a display area of a preset first object outside the facial area in the image to be processed;
[0006] Determining a target area including the face area from the image to be processed according to the display area, wherein the preset first object is located outside the target area;
[0007] Based on the target area, the range occupied by the facial area in the target area is adjusted to obtain a beautified facial area.
[0008] Optionally, the method further comprises:
[0009] Determine a region to be optimized in the target region, wherein the region to be optimized is located between the beautified facial region and an edge of the target region;
[0010] The shape of the image in the area to be optimized is corrected.
[0011] Optionally, before determining the area to be optimized in the target area, the method further includes:
[0012] Acquire the size relationship between the target area and the face area;
[0013] Determining whether the size relationship satisfies a preset optimization condition;
[0014] If so, the area to be optimized in the target area is determined.
[0015] Optionally, the step of obtaining the size relationship between the target area and the facial area includes:
[0016] Acquire a first distance for measuring the size of the target area and a second distance for measuring the size of the target area;
[0017] The ratio of the first distance to the second distance is taken as the size relationship.
[0018] Optionally, the step of acquiring a first distance for measuring the size of the target area and a second distance for measuring the size of the target area includes:
[0019] The distance between the areas where both eyes are located in the facial area is taken as the first distance, and the distance between the edge position of the target area and the preset first position in the facial area is taken as the second distance.
[0020] Optionally, the step of adjusting the range occupied by the facial region in the target region based on the target region to obtain a beautified facial region includes:
[0021] Determining whether there is a preset second object located in the facial area;
[0022] If yes, the range of the area in the face area except the preset second object in the target area is adjusted to obtain the beautified face area.
[0023] Optionally, the size of the target area is positively correlated with a reference distance between a preset second position in the facial area and a preset third position in the display area.
[0024] A second object of the embodiment of the present application is to provide a face beautification device, which is applied to an electronic device. The face beautification device includes:
[0025] An input module, used for acquiring an image to be processed including a face area;
[0026] a processing module, configured to determine a display area of a preset first object outside the facial area in the image to be processed; and determine a target area including the facial area from the image to be processed according to the display area, wherein the preset first object is located outside the target area;
[0027] The output module is used to adjust the range occupied by the facial area in the target area based on the target area to obtain a beautified facial area.
[0028] The third objective of an embodiment of the present application is to provide an electronic device, which includes a processor and a memory, wherein the memory stores computer-executable instructions, and when the computer-executable instructions are executed by the processor, the face beautification method is implemented.
[0029] A fourth objective of an embodiment of the present application is to provide a storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the face beautification method is implemented.
[0030] Compared with the prior art, this application has the following beneficial effects:
[0031] The embodiment of the present application provides a face beautification method, device, electronic device and storage medium. Based on the face beautification method, the electronic device determines a target area including the face area through the display area of the preset first object outside the face area in the image to be processed. Since the target area does not include the preset first object, when the face area in the target area is beautified, the preset first object will not be deformed. Therefore, the beautification traces caused by the beautification operation of the face area can be reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. 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 related drawings can be obtained based on these drawings without paying creative work.
[0033] Figure 1 A schematic diagram of a facial beautification method provided in an embodiment of the present application;
[0034] Figure 2 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0035] Figure 3 This is a schematic diagram of the steps of the face beautification method provided in an embodiment of the present application;
[0036] Figure 4 One of the target area schematic diagrams provided in the embodiment of the present application;
[0037] Figure 5 The second step flow diagram of the face beautification method provided in the embodiment of the present application;
[0038] Figure 6 A schematic diagram of a beautification method for a target area provided in an embodiment of the present application;
[0039] Figure 7This is one of the schematic diagrams of the causes of distortion provided in the embodiment of the present application;
[0040] Figure 8 The second schematic diagram of the cause of distortion provided in the embodiment of the present application;
[0041] Fig. 9 The second schematic diagram of the target area provided in the embodiment of the present application;
[0042] Fig.10 This is a schematic diagram of the structure of a facial beautification device provided in an embodiment of the present application.
[0043] Icons: 100-facial contour key points; 110-microphone area; 120-first triangle; 200-electronic device; 210-facial beautification device; 220-memory; 230-processor; 240-communication unit; 130-target area; 150-second triangle; 300-first example triangle; 310-first example key points; 400-second example triangle; 410-second example key points; 1101-input module; 1102-processing module; 1103-output module. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.
[0045] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0046] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0047] In the description of the present application, it should be noted that the terms "first", "second", "third", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0048] In order to present a satisfactory photogenic effect, users sometimes need to make certain beautification adjustments to the facial area in the captured image or video. However, when the current deformation algorithm makes beautification adjustments to the facial area, it will also have a certain deformation effect on the background area outside the facial area, so that some beautification traces remain in the beautified image. Moreover, the residual beautification traces present different differences on different background objects. Therefore, in order to present a better visual effect, it is necessary to reduce the residual beautification traces.
[0049] There are many algorithms for deforming the facial area, such as the liquefaction deformation algorithm and the mesh deformation algorithm. The following takes the live broadcast scene as an example and combines the mesh deformation algorithm to illustrate the above beautification trace residue.
[0050] like Figure 1 As shown in the figure, the anchor, who is one of the above users, needs to interact with the audience through the microphone during the live broadcast. In order to achieve the purpose of beautification, the mesh deformation algorithm can be used in the following example. Figure 1 In the live broadcast image shown, a triangular mesh is established between the facial contour key points 100 in the host's facial area and the edge position of the host's image. By adjusting the positions of some of the triangles in the live broadcast image, the purpose of beautifying the host's facial area is achieved.
[0051] However, when the host's face area is close to the area where the microphone area 110 is located, the deformation of the host's face area will cause the microphone area 110 to also deform to a certain extent, so that the shape of the microphone area 110 in the live broadcast image is somewhat different from the actual shape of the microphone area 110. Therefore, the audience can find that the host has used beauty filters through the shape change of the microphone area 110.
[0052] Of course, the remaining traces of beautification are not limited to the deformation of the microphone area 110, but also include the deformation of the host's chair in the live broadcast, the deformation of the shelf in the live broadcast screen, and the deformation of the ornaments in the live broadcast screen. In addition, the deformation of some objects in the live broadcast screen can be clearly perceived, while the deformation of some objects cannot be clearly perceived, depending on the specific type of the object.
[0053] In view of this, an embodiment of the present application provides a face beautification method, which is applied to an electronic device. Based on the face beautification method, the electronic device determines the display area of a preset first object by identifying and detecting the preset first object in the image to be processed; and determines a target area including a face area in the image to be processed based on the display area of the preset first object, so that the target area avoids the preset first object, and then when the face area is beautified in the target area, the preset first object will not be deformed, thereby reducing the residual beautification traces.
[0054] The electronic device may be, but is not limited to, a server, a smart phone, a personal computer (PC), a tablet computer, a personal digital assistant (PDA), a mobile Internet device (MID), and an image acquisition device.
[0055] As a possible implementation, see Figure 2 The electronic device 200 is a schematic structural diagram of the electronic device 200. The electronic device 200 includes a face beautification device 210, a memory 220, a processor 230, and a communication unit 240.
[0056] The memory 220, the processor 230 and the communication unit 240 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, these elements can be electrically connected to each other through one or more communication buses or signal lines. The face beautification device 210 includes at least one software function module that can be stored in the memory 220 in the form of software or firmware or solidified in the operating system (OS) of the electronic device 200. The processor 230 is used to execute the executable modules stored in the memory 220, such as the software function modules and computer programs included in the face beautification device 210. When the computer executable instructions in the face beautification device 210 are executed by the processor, the face beautification method is implemented.
[0057] The memory 220 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 electric erasable programmable read-only memory (EEPROM), etc. The memory 220 is used to store a program, and the processor 230 executes the program after receiving an execution instruction. The communication unit 240 is used to send and receive data through a network.
[0058] The processor 230 may be an integrated circuit chip with signal processing capabilities. The above-mentioned processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may 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 gates or transistor logic devices, discrete hardware components. The various methods, steps and logic block diagrams disclosed in the embodiments of the present application may be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0059] Combine the following Figure 3 The step flow diagram of the face beautification method shown in FIG. 1 is a schematic diagram of the step flow diagram of the face beautification method, and each step of the method is described in detail.
[0060] Step S100, obtaining an image to be processed including a face area.
[0061] The image to be processed may be each frame of the video. For example, it may be each frame of the live video. Of course, the image to be processed may also be a single image such as a photo. The embodiment of the present application does not limit the specific type of the image to be processed.
[0062] Step S110, determining a display area of a preset first object outside the face area in the image to be processed.
[0063] The preset first object can be adaptively adjusted in different usage scenarios. For example, taking a live broadcast scenario as an example, the first object can be a microphone, a puppet ornament, etc.
[0064] Step S120: determining a target area including a face area from the image to be processed according to the display area.
[0065] The preset first object is located outside the target area, that is, the target area determined by the electronic device 200 in the embodiment of the present application includes the face area and avoids the preset first object.
[0066] Step S130, based on the target area, adjusting the range occupied by the facial area in the target area to obtain a beautified facial area.
[0067] The electronic device 200 only adjusts the range occupied by the facial region in the determined target region to achieve beautification of the facial region. It is worth noting that, since aesthetics is a subjective personal concept, adjusting the range occupied by the facial region can be to expand the range of the facial region or to reduce the range of the facial region.
[0068] Please refer to Figure 4 The following takes the live broadcast scenario as an example to illustrate the above steps. Figure 4 As shown, the live broadcast image as one of the above-mentioned images to be processed includes a host face area and a microphone area 110. The microphone area 110 is close to the host image area. Therefore, in order to avoid deformation of the microphone area 110 when the host face area is beautified, the electronic device 200 determines a target area 130 from the live broadcast image according to the position of the microphone area 110.
[0069] like Figure 4 As shown, the target area 130 avoids the microphone area 110 and includes the host's face area. Since the electronic device 200 avoids the microphone area 110 when performing beautification processing on the host's face area based on the target area 130, the microphone area 110 is not affected.
[0070] Based on the face beautification method, the electronic device 200 determines a target area 130 including the face area through the display area of the preset first object outside the face area in the image to be processed. Since the target area 130 does not include the preset first object, when the face area in the target area 130 is beautified, the preset first object will not be deformed. Therefore, the beautification traces caused by the beautification operation of the face area can be reduced.
[0071] In addition, when beautifying the face area, the area where deformation mainly occurs is located between the edge of the face area and the edge of the target area 130. Therefore, in order to eliminate the deformation that may occur, please refer to Figure 5 , the face beautification method further includes:
[0072] Step S160 , determining the area to be optimized in the target area 130 .
[0073] The area to be optimized is located between the beautified facial area and the edge of the target area 130 .
[0074] Step S170, correcting the shape of the image in the area to be optimized.
[0075] The electronic device 200 determines the area to be optimized that may be deformed, and corrects the shape of the image therein, thereby further achieving the purpose of reducing the remaining beautification traces.
[0076] It is worth noting that the severity of the deformation of the area to be optimized is related to the size of the area. Specifically, when the size range of the area to be optimized is large, although the facial area will be beautified, the area will have a certain deformation, but the degree of deformation is usually small. If the size range of the area to be optimized is small, the area will have a certain deformation that is more obvious, and even distortion will occur. Among them, the distortion phenomenon is specifically manifested as obvious distortion of the shape of the image.
[0077] Regarding the reason why the target area 130 may be distorted when the size is too small, Figure 1 as well as Figure 6 An example is given. Figure 1 as well as Figure 6 As shown, based on the same facial contour key points 100 in the anchor's facial area, Figure 1 Construct the first triangle 120 in Figure 6 The second triangle 150 is constructed in Figure 1 The entire live image is used as the target area 130, therefore, Figure 1 The area of the first triangle 120 is greater than Figure 6 The second triangle 150 in .
[0078] when Figure 1 and Figure 6 To achieve the same beautification effect, the facial contour key point 100 is Figure 1 and Figure 6 , a first deformation region is generated in the first triangle 120 and a second deformation region is generated in the second triangle 150. The degree of change of the first deformation region compared to the area of the first triangle 120 is the first degree of change. The degree of change of the second deformation region compared to the area of the second triangle 150 is the second degree of change. Since the area of the first triangle 120 is larger than the area of the second triangle 150, the first degree of change is smaller than the second degree of change. It should be understood that the greater the degree of change, the more obvious the distortion.
[0079] like Figure 7 as well as Figure 8 As shown, in order to intuitively demonstrate the first and second change degrees, two example triangles of the same shape are provided, namely, a first example triangle 300 and a second example triangle 400, wherein the area of the first example triangle 300 is greater than the area of the second example triangle 400. When the first example key point 310 in the first example triangle 300 and the second example key point 410 in the second example triangle 400 move the same distance in the same direction respectively. Figure 7 as well as Figure 8As shown, the deformation degree of the first example triangle 300 is smaller than the deformation degree of the second example triangle 400 .
[0080] In view of this, in step S120, in order to reduce the distortion as much as possible, the size of the target area 130 is positively correlated with the reference distance from the preset second position in the face area to the preset third position in the display area.
[0081] When there are multiple preset first objects, the electronic device 200 can select the shortest reference distance from multiple reference distances determined by the multiple preset first objects to determine the range of the target area 130 .
[0082] The preset second position in the face area may be the position of the nose, or the position between the two eyes. Of course, adaptive adjustment may be made according to specific needs, and the embodiment of the present application does not make specific limitations. The third position may be the center of the circumscribed circle of the display area where the preset first object is located. Of course, the third position may also be determined by other means, and the embodiment of the present application does not make specific limitations.
[0083] That is, when determining a target area 130 based on the display area of the preset first object, the electronic device 200 tries to make the target area 130 obtain a larger area range without including the display area of the preset first object.
[0084] Considering that correcting the area to be optimized will take up too much computing resources and require a certain amount of computing time, therefore, for some scenes with high timeliness requirements (for example, live broadcast scenes), it is necessary to make a certain trade-off between the picture effect and timeliness.
[0085] In view of this, please refer again to Figure 5 , the face beautification method further includes:
[0086] Step S140, obtaining the size relationship between the area to be beautified and the face area.
[0087] Step S150, determining whether the size relationship satisfies a preset optimization condition.
[0088] If the size relationship meets the preset optimization condition, step S160 is executed.
[0089] That is, in the embodiment of the present application, the electronic device 200 compares the size of the target area 130 with the size of the face area, which can reflect to a certain extent whether the edge position of the target area 130 is close to the edge position of the face area. When the edge position of the target area 130 is close to the edge position of the face area, the above-mentioned distortion phenomenon will occur. Therefore, in the embodiment of the present application, the image shape is corrected only when the optimization conditions are met, which can take into account the timeliness of image processing while reducing the residual beautification traces, thereby improving the transition effect between the various areas in the picture.
[0090] In the embodiment of the present application, before determining whether to perform a correction operation on the image shape in the target area 130, a method for measuring the size relationship between the target area 130 and the face area needs to be provided. Therefore, as a possible implementation method, step S140 includes:
[0091] Step S140 - 1 , obtaining a first distance for measuring the size of the target area 130 and a second distance for measuring the size of the target area 130 .
[0092] Step S140 - 2 , taking the ratio of the first distance to the second distance as the size relationship.
[0093] In the embodiment of the present application, considering that the shapes of the face area and the target area 130 are not regular shapes, a complex calculation method is required to determine their specific sizes. Therefore, the size relationship between the face area and the target area 130 can be determined by the first distance and the second distance, while reducing the amount of calculation.
[0094] Regarding the first distance and the second distance, as a possible implementation, the electronic device 200 uses the distance between the edge position of the target area 130 and the preset first position in the face area as the first distance, and the distance between the areas where the eyes are located in the face area as the second distance.
[0095] That is, the electronic device 200 compares the ratio of the first distance to the second distance with a preset threshold. When it is less than the preset threshold, the shape of the image in the area to be optimized is corrected to improve the transition effect between the area to be optimized and other adjacent areas; otherwise, no correction is performed.
[0096] It is worth noting that the preset first position in the face area and the preset second position used to determine the reference distance can be the same position or different positions. Of course, other distances can also be selected as the first distance and the second distance, as long as they can reflect the size of the face area and the target area 130, and the embodiment of the present application does not make specific limitations.
[0097] Furthermore, multiple neural network models can be selected to correct the image shape in the area to be optimized. As a possible implementation, the electronic device 200 is preset with an adversarial neural network model. The electronic device 200 can correct the shape of the image in the area to be optimized by using the adversarial neural network model.
[0098] Since only the preset first object outside the face area is considered when determining the target area 130, when the preset second object exists in the face area, the electronic device 200 needs to avoid the preset second object when beautifying the face area. It is worth noting that the preset first object and the preset second object can be the same object or different objects.
[0099] Take the common live broadcast scene as an example. Fig. 9 The live broadcast screen shown includes the host's face area and the microphone area 110. The microphone area 110 occupies a part of the host's face area. Therefore, in order to avoid deformation of the microphone area 110, it is only necessary to optimize the position of the host's face area except the microphone area 110.
[0100] In view of this, step S130 includes:
[0101] Step S130 - 1 , determining whether there is a preset second object located in the face area.
[0102] Step S130 - 2 : if yes, then adjust the range of the area in the face area except the preset second object in the target area 130 to obtain a beautified face area.
[0103] Based on the above steps, the electronic device 200 determines the second object in the facial area, and only performs beautification processing on the area outside the second object. Then, in the beautified facial area, the second object will not be deformed.
[0104] Based on the same inventive concept, the embodiment of the present application further provides a face beautification device 210, which is applied to the electronic device 200. The face beautification device 210 includes at least one functional module that can be stored in the memory 220 in the form of software. Fig.10 From the functional point of view, the face beautification device 210 may include:
[0105] The input module 1101 is used to obtain an image to be processed including a face area.
[0106] In the embodiment of the present application, the input module 1101 is used to execute Figure 3 For the detailed description of step S100 in the input module 1101, please refer to the detailed description of step S100.
[0107] The processing module 1102 is used to determine a display area of a preset first object outside the face area in the image to be processed; and determine a target area 130 including the face area from the image to be processed according to the display area, wherein the preset first object is located outside the target area 130.
[0108] In the implementation of this application, the processing module 1102 is used to execute Figure 3 For the detailed description of the processing module 1102, please refer to the detailed description of steps S110 and S120.
[0109] The output module 1103 is used to adjust the range of the facial region in the target region 130 based on the target region 130 to obtain a beautified facial region.
[0110] In the embodiment of the present application, the output module 1103 is used to execute Figure 3 For the detailed description of the output module 1103, please refer to the detailed description of step S130.
[0111] Optionally, the processing module 1102 is further configured to:
[0112] Determine a region to be optimized in the target region 130 , wherein the region to be optimized is located between the beautified facial region and an edge of the target region 130 ;
[0113] Correct the shape of the image in the area to be optimized.
[0114] Optionally, before determining the area to be optimized in the target area 130, the processing module 1102 is further used to:
[0115] Acquire the size relationship between the target area 130 and the face area;
[0116] Determine whether the size relationship meets the preset optimization conditions;
[0117] If yes, then the area to be optimized in the target area 130 is determined.
[0118] Optionally, the specific manner in which the processing module 1102 obtains the size relationship includes:
[0119] Acquire a first distance for measuring the size of the target area 130 and a second distance for measuring the size of the target area 130;
[0120] The ratio of the first distance to the second distance is taken as the size relationship.
[0121] Optionally, the specific manner in which the processing module 1102 obtains the first distance and the second distance includes:
[0122] The distance between the areas where both eyes are located in the face area is taken as the first distance, and the distance between the edge position of the target area 130 and the preset first position in the face area is taken as the second distance.
[0123] Optionally, the output module 1103 beautifies the facial area in a manner that specifically includes:
[0124] determining whether there is a preset second object located in the face area;
[0125] If yes, the range of the area in the face area except the preset second object in the target area 130 is adjusted to obtain a beautified face area.
[0126] The embodiment of the present application further provides an electronic device 200. The electronic device 200 includes a processor 230 and a memory 220, wherein the memory 220 stores computer executable instructions, and when the computer executable instructions are executed by the processor 230, the face beautification method is implemented.
[0127] The present application also provides a storage medium as an example, wherein the storage medium stores a computer program, and when the computer program is executed by the processor 230, the face beautification method is implemented.
[0128] In summary, the embodiments of the present application provide a face beautification method, device, electronic device, and storage medium. Based on the face beautification method, the electronic device determines a target area including a face area through the display area of a preset first object outside the face area in the image to be processed. Since the target area does not include the preset first object, when the face area in the target area is beautified, the preset first object will not be deformed. Therefore, the beautification traces caused by the beautification operation of the face area can be reduced.
[0129] In the embodiments provided in the present 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 schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, 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 part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order 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 the flowchart, and the combination of boxes in the block diagram and / or the flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0130] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0131] 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 can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods 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.
[0132] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0133] The above are only various implementations of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A face beautification method, characterized in that, applied to an electronic device, the method includes: Obtaining a to-be-processed image including a face region; Determining a display region of a preset first object outside the face region in the to-be-processed image; Determining a target region including the face region from the to-be-processed image according to the display region, wherein the preset first object is located outside the target region; Based on the target region, adjusting the range occupied by the face region in the target region to obtain a beautified face region; Obtaining a size relationship between the target region and the face region, and determining whether the size relationship meets a preset optimization condition, wherein the size relationship is a ratio of the size between the target region and the face region, and the preset optimization condition is that the ratio is less than a preset threshold; If so, determining a region to be optimized in the target region, wherein the region to be optimized is located between the edge of the beautified face region and the target region; Correcting the shape of the image in the region to be optimized.
2. The face beautification method according to claim 1, characterized in that, The step of obtaining the size relationship between the target region and the face region includes: Obtaining a first distance for measuring the size of the target region and a second distance for measuring the size of the target region; Taking the ratio of the first distance to the second distance as the size relationship.
3. The face beautification method according to claim 2, characterized in that, The step of obtaining a first distance for measuring the size of the target region and a second distance for measuring the size of the target region includes: Taking the distance between the regions where the two eyes are located in the face region as the first distance, and the distance between the edge position of the target region and a preset first position in the face region as the second distance, wherein the first position is the position where the nose is located in the face region or the position between the two eyes.
4. The face beautification method according to claim 1, characterized in that, The step of adjusting the range occupied by the face region in the target region based on the target region to obtain a beautified face region includes: Determining whether there is a preset second object in the face region; If so, adjusting the range occupied by the region other than the preset second object in the face region in the target region to obtain the beautified face region.
5. The face beautification method according to claim 1, characterized in that, The size of the target region is positively correlated with a reference distance from a preset second position in the face region to a preset third position in the display region, where the second position is the position where the nose is located in the face region or the position between the two eyes; the third position is the center of the circumcircle of the display region.
6. A face beautification device, characterized in that, applied to an electronic device, the face beautification device includes: An input module for obtaining a to-be-processed image including a face region; A processing module, configured to determine a display area of a preset first object outside the face area in the image to be processed; and determine a target area including the face area from the image to be processed according to the display area, where the preset first object is located outside the target area; An output module, configured to adjust a range occupied by the face area in the target area based on the target area to obtain a beautified face area; The processing module is further configured to obtain a size relationship between the target area and the face area, and determine whether the size relationship meets a preset optimization condition, where the size relationship is a ratio of the size between the target area and the face area, and the preset optimization condition is that the ratio is less than a preset threshold; If so, determine an area to be optimized in the target area, where the area to be optimized is located between the edge of the beautified face area and the target area; Correct the shape of the image in the area to be optimized.
7. An electronic device, characterized in that, the electronic device includes a processor and a memory, the memory stores computer-executable instructions, and when the computer-executable instructions are executed by the processor, the face beautification method according to any one of claims 1-5 is implemented.
8. A storage medium, characterized in that, the storage medium stores a computer program, and when the computer program is executed by a processor, the face beautification method according to any one of claims 1-5 is implemented.
Citation Information
Patent Citations
Image processing method, apparatus and terminal device
CN107316281A
An image processing method and terminal equipment
CN109584150A