A method for digitalizing beautiful eyebrows, electronic equipment and storage medium

By obtaining the eyebrow key points and geometric areas in the face image, and using the image deformation and fusion model, the natural beautification and realism improvement of the eyebrow shape is achieved, and the problem of lack of realism in the eyebrow shape beautification in the existing technology is solved.

CN113689325BActive Publication Date: 2024-09-06SHENZHEN SHULIAN TIANXIA INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110786745.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-12
Publication Date
2024-09-06
Estimated Expiration
2041-07-12

AI Technical Summary

Technical Problem

It is difficult to naturally beautify the eyebrow shape with the existing technology, resulting in a lack of realism in the beautified eyebrows.

Method used

By obtaining the eyebrow key points in the face image, determining the geometric area, and using the preset image deformation model and fusion model to adjust the pixel position of the eyebrows to achieve natural deformation and fusion of the eyebrow shape, and generate a realistic Eyebrow images.

Benefits of technology

Compared with traditional methods, it achieves natural changes in eyebrow shape and improves realism. The transition between the eyebrow area and the skin area is more natural, and the dividing line between the eyebrows and skin pixels is weakened, making the deformed eyebrows more realistic.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113689325B
    Figure CN113689325B
Patent Text Reader

Abstract

This invention relates to the field of image processing technology and discloses a method, electronic device, and storage medium for digitally shaping eyebrows. The method involves acquiring a face image and obtaining key points of the eyebrows within the image. Based on these key points, a geometric region including the eyebrows is determined within the face image. The face image, the geometric region, and the shape features of the target eyebrow shape are input into a preset image deformation model. The image deformation model then deforms the positions of pixels within the geometric region of the face image according to the shape features of the target eyebrow shape, obtaining a deformed first target face image. This deformed first target face image then achieves the desired eyebrow shape, thus changing the eyebrow shape. Notably, the eyebrows in the first target face image are obtained by adjusting the pixel positions of the original eyebrows, resulting in a more natural appearance compared to the traditional method of directly pasting eyebrows with the target eyebrow shape onto the original face image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of image processing technology, and in particular to a method for digitizing beautiful eyebrows, an electronic device and a storage medium. Background Art

[0002] With the popularization of smart mobile terminals with cameras, the development of image processing technology, and the emphasis on appearance, people are increasingly keen to use applications on smart mobile terminals to beautify or apply makeup to facial images, namely digital beauty, to present optimized facial images.

[0003] Among them, the beautification of eyebrows currently mainly involves filling or covering the eyebrows with colors, such as filling the original eyebrows with colors without changing the shape, or directly covering and replacing the original eyebrows with eyebrow templates of other shapes, making the beautified eyebrows unnatural and lacking in realism. Summary of the invention

[0004] The main technical problem solved by the embodiments of the present invention is to provide a method, electronic device and storage medium for digitally shaping eyebrows, which can naturally beautify the eyebrows and make the eyebrows after beautification have a sense of reality.

[0005] In order to solve the above technical problems, in a first aspect, an embodiment of the present invention provides a method for digitally shaping eyebrows, comprising:

[0006] Acquire a face image, and acquire key points of eyebrows in the face image;

[0007] Determining a geometric region including eyebrows in the face image according to the key points of the eyebrows;

[0008] The shape features of the facial image, the geometric area and the target eyebrow shape are input into a preset image deformation model to deform and adjust the position of each pixel point in the geometric area in the facial image to obtain a deformed first target facial image, in which the shape of the eyebrows is the target eyebrow shape.

[0009] In some embodiments, the image deformation model is set based on an OpenGLES framework.

[0010] In some embodiments, the image deformation model is an image deformation algorithm that uses a moving least squares method to calculate deformation parameters.

[0011] In some embodiments, the image deformation algorithm comprises an affine transformation, a similarity transformation, or a rigid transformation.

[0012] In some embodiments, the step of determining the geometric area including eyebrows in the face image according to the key points of the eyebrows comprises:

[0013] The geometric area is determined to be the minimum circumscribed rectangle of the eyebrow.

[0014] In some embodiments, the method further comprises:

[0015] The deformation of the position of each pixel point in the geometric area including the eyebrows in the first target facial image relative to the position of each pixel point in the geometric area including the eyebrows in the facial image is attenuated according to a preset attenuation rule to obtain an attenuated second target facial image, wherein the degree of deformation of the non-eyebrow pixel points in the geometric area of ​​the second target facial image relative to the facial image is less than the degree of deformation of the non-eyebrow pixel points in the geometric area of ​​the first target facial image relative to the facial image.

[0016] In some embodiments, the preset attenuation rule includes a gradually increasing attenuation degree of deformation of the position of each pixel point in the geometric area including eyebrows in the first target facial image relative to the position of each pixel point in the geometric area including eyebrows in the facial image from the center to the boundary of the geometric area.

[0017] In some embodiments, the method further comprises:

[0018] The second target face image and the preset eyebrow material image are input into a preset image fusion model for fusion to obtain a fused third target face image, wherein the image fusion model is set based on an OpenGLES framework.

[0019] To solve the above technical problems, in a second aspect, an embodiment of the present invention provides an electronic device, comprising a memory and at least one processor, wherein the at least one processor is used to execute at least one computer program stored in the memory, and when the at least one processor executes the at least one computer program, the electronic device implements the method described in the first aspect above.

[0020] To solve the above technical problem, in a third aspect, an embodiment of the present invention provides a readable storage medium, wherein the readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes the method described in the first aspect above.

[0021] Beneficial effects of the embodiments of the present invention: Different from the prior art, the method, electronic device and storage medium for digitizing beautiful eyebrows provided by the embodiments of the present invention obtain a face image and key points of the eyebrows in the face image, determine the geometric area including the eyebrows in the face image according to the key points of the eyebrows, input the face image, the geometric area and the shape features of the target eyebrow shape into a preset image deformation model, so that the image deformation model deforms the position of each pixel point in the geometric area in the face image according to the shape features of the target eyebrow shape, obtains a deformed first target face image, and makes the shape of the eyebrows in the first target face image the target eyebrow shape, thereby achieving a change in the eyebrow shape. Among them, on the one hand, the eyebrows in the first target face image are obtained by adjusting the pixel positions on the basis of the original eyebrows, which is more natural than the traditional method of directly fitting the eyebrows with the target eyebrow shape to the original face image; on the other hand, the geometric area can include not only the eyebrows but also the skin around the eyebrows. The positions of each pixel in the geometric area including the eyebrows are deformed and adjusted, so that the eyebrow area and the non-eyebrow area (skin area) can transition naturally, weakening the dividing line between the eyebrow pixels and the skin pixels, making the deformed eyebrows more realistic. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0023] Figure 1 A schematic diagram of the operating environment of the method for digitally shaping eyebrows provided by an embodiment of the present invention;

[0024] Figure 2 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention;

[0025] Figure 3 A schematic diagram of a process of a method for digitally shaping eyebrows provided by an embodiment of the present invention;

[0026] Figure 4 A schematic diagram of key points of a face provided by an embodiment of the present invention;

[0027] Figure 5 A schematic diagram of a geometric region provided by an embodiment of the present invention;

[0028] Figure 6 A schematic diagram of the effect of shaping eyebrows before and after according to an embodiment of the present invention;

[0029] Figure 7 A schematic diagram for describing the attenuation degree provided by an embodiment of the present invention;

[0030] Figure 8 An eyebrow material image provided by an embodiment of the present invention;

[0031] Fig. 9 A schematic diagram of a third target face image after image fusion provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0032] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several variations and improvements may be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.

[0033] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0034] It should be noted that, if there is no conflict, the various features in the embodiments of the present invention can be combined with each other, all within the scope of protection of the present application. In addition, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in a different order than the module division in the device or the flow chart. In addition, the words "first", "second", "third", etc. used herein do not limit the data and execution order, but only distinguish the same items or similar items with basically the same functions and effects.

[0035] Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in this specification and in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used in this specification includes any and all combinations of one or more of the related listed items.

[0036] In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0037] Figure 1 FIG. 1 is a schematic diagram of the operating environment of the method for digitalizing eyebrows in an embodiment of the present invention. Figure 1 The operating environment includes an electronic device 10 and an image acquisition device 20, and the electronic device 10 and the image acquisition device 20 are communicatively connected.

[0038] The communication connection can be a wired connection, such as a fiber optic cable, or a wireless communication connection, such as a WIFI connection, a Bluetooth connection, a 4G wireless communication connection, a 5G wireless communication connection, and the like.

[0039] The image acquisition device 20 is used to acquire a face image. The image acquisition device 20 may be a terminal capable of capturing images, such as a mobile phone, tablet computer, video recorder or camera with a capturing function.

[0040] The electronic device 10 is a device that can run according to a program and automatically and quickly process massive amounts of data. It is usually composed of a hardware system and a software system, such as a computer, a smart phone, etc. The electronic device 10 can be a local device that is directly connected to the image acquisition device 20; it can also be a cloud device, such as a cloud server, a cloud host, a cloud service platform, a cloud computing platform, etc. The cloud device is connected to the image acquisition device 20 through a network, and the two are connected in communication through a predetermined communication protocol. In some embodiments, the communication protocol can be TCP / IP, NETBEUI, IPX / SPX, etc.

[0041] It is understandable that the image acquisition device 20 and the electronic device 10 may also be integrated together as an integrated device, such as a computer or smart phone with a camera.

[0042] The electronic device 10 receives the face image sent by the image acquisition device 20, and the electronic device 10 beautifies the eyebrows in the face image, such as changing the eyebrow shape, to obtain the face image after the eyebrow shape is beautified.

[0043] In the above Figure 1 Based on this, another embodiment of the present invention provides an electronic device 10, see Figure 2 , is a hardware structure diagram of an electronic device 10 provided in an embodiment of the present invention, specifically, as Figure 2 As shown, the electronic device 10 includes at least one processor 11 and a memory 12 ( Figure 2 (a bus connection and a processor are used as an example).

[0044] The processor 11 is used to provide computing and control capabilities to control the electronic device 10 to perform corresponding tasks, for example, to control the electronic device 10 to perform any one of the methods for digitally shaping eyebrows provided in the following embodiments of the invention.

[0045] It can be understood that the processor 11 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, discrete hardware components.

[0046] The memory 12, as a non-transient computer-readable storage medium, can be used to store non-transient software programs, non-transient computer executable programs and modules, such as program instructions / modules corresponding to the method for digitalizing eyebrows in the embodiment of the present invention. The processor 11 can implement the method for digitalizing eyebrows in any of the following method embodiments by running the non-transient software programs, instructions and modules stored in the memory 12. Specifically, the memory 12 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory 12 may also include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network and a combination thereof.

[0047] In some embodiments, the electronic device also includes at least one graphics processing unit (GPU), which is a chipset that is a set of highly parallelizable processing tasks. It has customized chips that specifically handle depth buffers, fast access to textures and other buffers, and a processor that can provide programmable shaders that support parallel execution.

[0048] It is understandable that the at least one processor 11 may include an independent processor in the electronic device, and may also include a processor in the image processing unit. When the at least one processor 11 implements the method of digitally shaping eyebrows in any of the following method embodiments by running the non-transient software program, instructions, and modules stored in the memory 12, the independent processor in the electronic device and the processor in the image processing unit may cooperate to complete the implementation.

[0049] The following is a detailed description of the method for digital eyebrow shaping provided in the embodiment of the present application. Figure 3 The method S20 includes but is not limited to the following steps:

[0050] S21: Acquire a face image, and acquire key points of eyebrows in the face image.

[0051] S22: Determine a geometric region including eyebrows in the face image according to the key points of the eyebrows.

[0052] S23: Inputting shape features of the facial image, the geometric area and the target eyebrow shape into a preset image deformation model to deform and adjust the position of each pixel point in the geometric area in the facial image to obtain a deformed first target facial image, wherein the shape of the eyebrows in the first target facial image is the target eyebrow shape.

[0053] Among them, the face image is an image including a face, which can be acquired by the above-mentioned image acquisition device. For example, the face image can be a selfie captured by the above-mentioned image acquisition device.

[0054] In order to beautify the eyebrows in the face image, first, the key points of the eyebrows in the face image are obtained to locate the eyebrows. Specifically, Figure 4 As shown in FIG, the existing facial key point algorithm is used to locate several key points of the face, including points in the eyebrows, eyes, nose, mouth, facial contour and other areas. Then, the key point belonging to the eyebrow is obtained from the several key points, such as Figure 4 The key points are numbered 33-42 and 64-71 in FIG. It can be understood that the key points of the eyebrows can reflect the positions of the eyebrows in the face image.

[0055] It is worth noting that the existing face key point algorithms can be active appearance models (AAMs), constrained local models (CLMs), explicit shape regression (ESR) or supervised descent method (SDM), etc. The specific process of obtaining face key points by the above face key point algorithms will not be described one by one.

[0056] After obtaining the key points of the eyebrows, based on the key points of the eyebrows reflecting the positions of the eyebrows in the face image, the geometric area including the eyebrows in the face image can be determined according to the key points of the eyebrows. It can be understood that the position area reflected by the geometric area in the face image is the area that can frame the eyebrows. In some embodiments, the geometric area can be irregular, for example, it can be an area surrounded by the outer edge of the eyebrows. In this embodiment, the pixels in the geometric area include eyebrow pixels. In some embodiments, the geometric area can also be regular, for example, it can be a rectangle, a square, etc. In this implementation, the pixels in the geometric area include eyebrow pixels and non-eyebrow pixels (such as skin pixels).

[0057] In some embodiments, Figure 5 As shown, determining the geometric area as the minimum circumscribed rectangle of the eyebrows can not only ensure that the geometric area can frame the eyebrows and include skin pixels, but also avoid the pixels in the non-eyebrow area being affected by too many skin pixels in the geometric area. Figure 5 The above is only an example and does not impose any limitation on the geometric area.

[0058] Then, the shape features of the facial image, geometric area and target eyebrow shape are input into a preset image deformation model. The image deformation model deforms and adjusts the position of each pixel point in the geometric area in the facial image according to the shape features of the target eyebrow shape, and obtains a deformed first target facial image, so that the shape of the eyebrows in the first target facial image is the target eyebrow shape.

[0059] The target eyebrow shape can be flat eyebrow, willow-leaf eyebrow, European eyebrow or sword eyebrow, etc. The target eyebrow shape is the eyebrow shape that needs to be generated after the original eyebrow is deformed. Each eyebrow shape has its own shape characteristics, which are reflected in the key points of the eyebrow. Figure 4 Take the eyebrow key points in as an example for exemplary explanation: for flat eyebrows, the brow peak and eyebrow tail are flush, which is manifested in that key points 34, 35, 36, 39, 40, and 41 are roughly on the same horizontal line; for willow-leaf eyebrows, they are willow-leaf-shaped, which is manifested in that the curvature of key points 34, 35, and 36 is greater than the preset curvature threshold, and the curvature of key points 39, 40, and 41 is greater than the preset curvature threshold; for European eyebrows, the brow peak is higher and the eyebrow tail is lower, which is manifested in that the distance between key points 33 and 34 is greater than the preset distance threshold, and the distance between key points 41 and 42 is greater than the preset distance threshold; for sword eyebrows, they are in an inverted eight-character shape, which is manifested in that the coordinates of key point 33 are higher than the coordinates of key point 34, and the coordinates of key point 42 are higher than the coordinates of key point 41.

[0060] After obtaining the key points of the original eyebrows in the face image and the shape features of the target eyebrow type, the key points of the original eyebrows are deformed through the image deformation model to generate key points of new eyebrows that meet the shape features of the target eyebrow type, so that the shape of the eyebrows in the first target face image obtained after deformation is the target eyebrow type.

[0061] The image deformation model calculates the deformation parameters required for the eyebrows to deform from the original key points to the target key points based on the key points of the original eyebrows in the face image and the target key points reflected by the shape characteristics of the target eyebrow shape. Then, each pixel point in the geometric area of ​​the face image is deformed according to the above deformation parameters to obtain the first target face image. Figure 6As shown, the eyebrows in the face image A are flat eyebrows. After being processed by the image deformation model, the eyebrows in the first target face image B obtained are European eyebrows with higher brow peaks.

[0062] The image deformation model is a preset image deformation algorithm used to deform the image. In some embodiments, the image deformation algorithm includes rotation, translation, affine transformation, rigid transformation or similarity transformation. The deformation parameters are related to the image deformation algorithm. For example, when the image deformation algorithm is a radial transformation, the deformation parameters include a linear transformation matrix M and a translation vector T. For any pixel position x in the geometric area, after the radial transformation, the pixel position y=xM+T is obtained.

[0063] Among them, the eyebrows in the first target face image are obtained by adjusting the pixel positions on the basis of the original eyebrows, which is more natural than the traditional method of directly fitting the eyebrows with the target eyebrow shape to the original face image; on the other hand, the geometric area can include not only the eyebrows but also the skin around the eyebrows. The positions of each pixel in the geometric area including the eyebrows are deformed and adjusted, so that the eyebrow area and the non-eyebrow area (skin area) can transition naturally, weakening the dividing line between the eyebrow pixel points and the skin pixel points, making the deformed eyebrows more realistic.

[0064] In some embodiments, the image deformation model is set based on the OpenGLES framework, that is, the image deformation algorithm is written in the OpenGLES framework to form the image deformation model. Among them, the OpenGLES framework defines a professional graphics program interface for cross-programming language and cross-platform programming, which can be used for processing and rendering of two-dimensional or three-dimensional images. GLSL (OpenGL Shading Language) is the shader language of OpenGLES. In the OpenGLES framework, programs written in this language run on the graphics processing unit (Graphic Processor Unit, GPU) of the computing device to process and render images. Programs based on the OpenGLES framework directly call the image processing unit (GPU) of the electronic device for calculation, and the calculation speed is fast.

[0065] In this embodiment, by acquiring a face image and acquiring key points of eyebrows in the face image, determining a geometric region including eyebrows in the face image according to the key points of eyebrows, inputting the shape features of the face image, the geometric region and the target eyebrow shape into a preset image deformation model, so that the image deformation model deforms the positions of each pixel point in the geometric region in the face image according to the shape features of the target eyebrow shape, and obtains a deformed first target face image, so that the shape of the eyebrows in the first target face image is the target eyebrow shape, and the eyebrow shape is changed. Among them, on the one hand, the eyebrows in the first target face image are obtained by adjusting the pixel position on the basis of the original eyebrows, which is more natural than the traditional method of directly attaching the eyebrows with the target eyebrow shape to the original face image; on the other hand, the geometric region can include not only eyebrows but also the skin around the eyebrows, and the positions of each pixel point in the geometric region including the eyebrows are deformed and adjusted, so that the eyebrow region and the non-eyebrow region (skin region) can be naturally transitioned, and the boundary between the eyebrow pixel point and the skin pixel point is weakened, so that the deformed eyebrows are more realistic.

[0066] In some embodiments, the image deformation model is an image deformation algorithm that uses a moving least squares method to calculate deformation parameters. The deformation parameters calculated using the moving least squares method are accurate, and the deformed eyebrow shape is further made to be the target eyebrow shape. The calculation process of the moving least squares method is exemplified by taking the image deformation algorithm as affine deformation.

[0067] The deformation parameters of each pixel in the geometric area of ​​the face image are calculated by the following optimization function. When the optimization function is minimized, the optimal deformation parameters are obtained.

[0068]

[0069] in,

[0070] Where v is the position of any pixel in the geometric area of ​​the face image, p i is the position of any original key point of the eyebrows in the face image, q i is the original key point p i The position of the target key point after deformation, lv(p i ) is the original key point p i The position after affine transformation, w i is the deformation weight, Set to 1.

[0071] For different pixel points v, different deformation parameters can be obtained. The deformation parameters include the linear transformation matrix M and the translation vector T. Then the radiation transformation function l v (x) = xM + T, for the optimization function Taking the partial derivative and setting it to 0, we can get the expression of T = q * -p * M, where p* is the weighted centroid of the original key point, and q* is the weighted centroid of the target key point. Specifically:

[0072]

[0073] Thus, l v (x)=(xp * )M+q * , then the original optimization function is

[0074] in,

[0075] In order to find a radiation transformation to minimize the optimization function, the optimization problem is solved directly using the classical method:

[0076]

[0077] Thus, the expression of the affine transformation is:

[0078]

[0079] Because pi is fixed, separate the original eyebrow key point pi and the deformed target key point qi to obtain:

[0080]

[0081] in,

[0082] For each pixel point whose position is to be determined after deformation, the above optimization function is established to solve an affine transformation function. Thus, the position of each pixel point in the geometric area of ​​the face image is transformed by the corresponding affine transformation function f a (v) After transformation, the first target face image is obtained.

[0083] In this embodiment, the image deformation model is an image deformation algorithm that uses the moving least squares method to calculate deformation parameters. The deformation parameters calculated using the moving least squares method are accurate, and further make the deformed eyebrow shape the target eyebrow shape, which can accurately change the eyebrow shape according to user needs.

[0084] In some embodiments, the deformation of the position of each pixel point in the geometric area including eyebrows in the first target facial image relative to the position of each pixel point in the geometric area including eyebrows in the facial image is attenuated according to a preset attenuation rule to obtain an attenuated second target facial image, wherein the degree of deformation of the non-eyebrow pixel points in the geometric area of ​​the second target facial image relative to the facial image is less than the degree of deformation of the non-eyebrow pixel points in the geometric area of ​​the first target facial image relative to the facial image.

[0085] In this embodiment, the deformation of the position of each pixel point in the geometric area including the eyebrows in the first target facial image relative to the position of each pixel point in the geometric area including the eyebrows in the facial image is reduced according to a preset attenuation rule to obtain a second target facial image, so that the deformation degree of the non-eyebrow pixels in the geometric area of ​​the second target facial image relative to the facial image is less than the deformation degree of the non-eyebrow pixels in the geometric area of ​​the first target facial image relative to the facial image, that is, the deformation degree of the non-eyebrow pixels in the geometric area of ​​the first target facial image is adjusted back to prevent the non-eyebrow pixels in the geometric area from being severely deformed, affecting the overall effect of the image, and making the eyebrow pixels deform unnaturally.

[0086] In some embodiments, the preset attenuation rule includes a gradually increasing attenuation degree of deformation of the position of each pixel within the geometric area including eyebrows in the first target facial image relative to the position of each pixel within the geometric area including eyebrows in the facial image from the center to the boundary of the geometric area.

[0087] like Figure 7 As shown, from the center o of the geometric area to any boundary S, the degree of attenuation of the deformation of the position of each pixel point in the geometric area including the eyebrows in the first target facial image relative to the position of each pixel point in the geometric area including the eyebrows in the facial image gradually increases, that is, from point o to any point a on the boundary S, the degree of attenuation of the deformation of the position of each pixel point gradually increases. For example, the attenuation degree of point c on the line connecting point o to point a is greater than the attenuation degree of point b, that is, in the second target facial image, the degree of deformation of point c relative to the original facial image is smaller, and the degree of deformation of point b relative to the original facial image is larger.

[0088] For example, when setting the attenuation coefficient cita, the smaller the distance between the point in the geometric area and the center point o, the larger the attenuation coefficient. The larger the distance, the greater the attenuation system will continue to attenuate to 0. The attenuation coefficient cita is:

[0089] Where x is the distance to the center point o, and thre is a constant, which is an empirical value. Preferably, thre can be 2.

[0090] The position of the pixel points in the geometric area of ​​the second target face image obtained after attenuation is:

[0091] fv2=(fv1-img_coordinate)*cita+img_coordinate;

[0092] Among them, fv2 is the position of any pixel point in the geometric area of ​​the second target face image; fv1 is the position of the corresponding pixel point in the geometric area of ​​the first target face image, and img_coordinate is the position of the corresponding pixel point in the original face image. For example, img_coordinate(1,5) is the position of the pixel point in the first row and fifth column of the original face image.

[0093] From the above formula, we can see that the closer to the center point o of the geometric area, the larger cita is, the smaller the attenuation is, and the larger the pixel deformation is; the farther away from the center point o of the geometric area, the smaller cita is, the larger the attenuation is, and the smaller the pixel deformation is. Therefore, the non-eyebrow pixels in the geometric area will not affect the overall effect of the image due to severe deformation, and the eyebrow pixels will deform naturally.

[0094] In some embodiments, the method S20 further includes:

[0095] S24: Inputting the second target face image and the preset eyebrow material image into a preset image fusion model for fusion to obtain a fused third target face image, wherein the image fusion model is pre-set based on an OpenGLES framework.

[0096] like Figure 8 As shown, the eyebrow material image is an image including an eyebrow template, and the eyebrow template can be an eyebrow of various eyebrow shapes. It is understandable that after the user changes the eyebrow shape, there may be defects, such as sparse eyebrows that do not match the adjusted European-style eyebrows. Therefore, the user can further beautify the eyebrows as needed. Specifically, the second target face image and the preset eyebrow material image, such as the European-style eyebrow material image, are input into the preset image fusion model for fusion to obtain the fused third target face image. Fig. 9 FIG. 4 shows a third target face image after image fusion in one embodiment.

[0097] Among them, the image fusion model is used to superimpose the eyebrow pixels in the second target face image with the pixels of the eyebrow material image, and the superimposed area is natural, so that the obtained third target face image has both the characteristics of the eyebrows in the second target face image and the characteristics of the eyebrows in the eyebrow material image, thereby achieving the effect of modifying the eyebrows in the deformed second target face image, which is more natural and realistic than the traditional method of directly fitting and covering the eyebrow material image. The image fusion model can adopt existing image fusion algorithms, such as weighted averaging, feathering algorithm, Laplace pyramid fusion, etc.

[0098] It is understandable that the image fusion model is also set based on the OpenGLES framework, that is, the image fusion algorithm is written in the OpenGLES framework to form the image fusion model. The program based on the OpenGLES framework directly calls the image processing unit (GPU) of the electronic device for calculation, so it has the characteristic of fast calculation speed.

[0099] In some embodiments, the depth of the eyebrow material image can also be adjusted through relevant controls, which is conducive to user customization and optimization of visual effects.

[0100] In this embodiment, by fusing the second target facial image with the preset eyebrow material image, the third target facial image obtained by fusion has both the characteristics of the eyebrows in the second target facial image and the characteristics of the eyebrows in the eyebrow material image, thereby achieving the effect of modifying the eyebrows in the deformed second target facial image, which is more natural and realistic than the traditional method of directly fitting and covering the eyebrow material image.

[0101] In another embodiment of the present application, a readable storage medium is provided, wherein the readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes the method for digitizing beautiful eyebrows in any of the above method embodiments.

[0102] It should be noted that the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0103] Through the description of the above implementation methods, ordinary technicians in this field can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, it can also be implemented by hardware. Ordinary technicians in this field can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0104] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them. Under the concept of the present invention, the technical features in the above embodiments or different embodiments may also be combined, the steps may be implemented in any order, and there are many other changes in different aspects of the present invention as described above, which are not provided in detail for the sake of simplicity. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they may still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for digitally shaping eyebrows, characterized in that: include: Acquire a face image, and acquire key points of eyebrows in the face image; Determine, according to the key points of the eyebrows, a geometric region including the eyebrows in the face image, wherein the pixels in the geometric region include eyebrow pixels and non-eyebrow pixels; Inputting the shape features of the facial image, the geometric region and the target eyebrow shape into a preset image deformation model to deform and adjust the position of each pixel point in the geometric region in the facial image to obtain a deformed first target facial image, wherein the shape of the eyebrows in the first target facial image is the target eyebrow shape; The deformation of the position of each pixel point in the geometric area including eyebrows in the first target facial image relative to the position of each pixel point in the geometric area including eyebrows in the facial image is attenuated according to a preset attenuation rule to obtain an attenuated second target facial image, wherein the deformation degree of the non-eyebrow pixel points in the geometric area of ​​the second target facial image relative to the facial image is less than the deformation degree of the non-eyebrow pixel points in the geometric area of ​​the first target facial image relative to the facial image; the preset attenuation rule includes that from the center to the boundary of the geometric area, the attenuation degree of the deformation of the position of each pixel point in the geometric area including eyebrows in the first target facial image relative to the position of each pixel point in the geometric area including eyebrows in the facial image gradually increases.

2. The method according to claim 1, characterized in that The image deformation model is set based on the OpenGLES framework.

3. The method according to claim 1, characterized in that The image deformation model is an image deformation algorithm that uses the moving least square method to calculate deformation parameters.

4. The method according to claim 3, characterized in that The image deformation algorithm includes affine transformation, similarity transformation or rigid transformation.

5. The method according to claim 1, characterized in that The step of determining the geometric area including the eyebrows in the face image according to the key points of the eyebrows comprises: The geometric area is determined to be the minimum circumscribed rectangle of the eyebrow.

6. The method according to claim 1, characterized in that The method further comprises: The second target face image and the preset eyebrow material image are input into a preset image fusion model for fusion to obtain a fused third target face image, wherein the image fusion model is set based on an OpenGLES framework.

7. An electronic device, characterized in that: The electronic device comprises a memory and at least one processor, wherein the at least one processor is used to execute at least one computer program stored in the memory, and when the at least one processor executes the at least one computer program, the electronic device implements the method according to any one of claims 1 to 6.

8. A readable storage medium, characterized in that: The readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes the method according to any one of claims 1 to 6.