Image processing method and device, electronic device and storage medium
By determining the center brightness of the target part and increasing the brightness of the pixels, and combining the beautification materials to generate a beautified image, it solves the problem of poor rendering effects of eyebrows and other parts, and achieves a natural fading effect and better beautification effect.
Patent Information
- Application Number
- CN202111137723.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-27
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2041-09-27
AI Technical Summary
When the existing technology renders parts such as eyebrows in an image, the rendering effect is difficult to meet expectations due to its heavy color, and it is difficult to achieve a natural fading effect.
By receiving the beautification operation of the user's image, it determines the center brightness of the target part as the benchmark, improves the brightness of the pixels in the target part, and generates a beautified image based on the beautification material and target brightness, reducing the impact of the original color on the beautification process.
It achieves natural lightening of the target parts in the user's image, improves the beautification effect, reduces the impact of the original color of eyebrows and other parts on the beautification process, and achieves better beautification effects.
Smart Images

Figure CN113763287B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer vision, and in particular to an image processing method and device, an electronic device, and a storage medium. Background Art
[0002] With the development of computer vision technology, operations such as eyebrow shaping or color rendering of eyebrows and other parts in images have been increasingly widely used in the field of image processing. However, since eyebrows and other parts have darker colors, it is often difficult to achieve the expected rendering effect. Summary of the invention
[0003] The present disclosure proposes an image processing solution.
[0004] According to one aspect of the present disclosure, there is provided an image processing method, comprising:
[0005] A beautification operation for a user image is received, and a target part to be beautified in the user image is determined; a reference brightness of the target part is determined according to the brightness of the center position of the target part; according to the reference brightness, the brightness of the pixels in the target part is increased to obtain a target brightness of the pixels in the target part; and according to the beautification material input in the beautification operation and the target brightness, a target user image after beautifying the target part is generated.
[0006] In a possible implementation, the method further includes: determining the original brightness of the pixel points in the target part according to the original color of the pixel points in the target part; and improving the brightness of the pixel points in the target part according to the reference brightness to obtain the target brightness of the pixel points in the target part, including: determining the brightness improvement value of the pixel points in the target part according to the original brightness and the reference brightness; and obtaining the target brightness of the pixel points in the target part according to the brightness improvement value and the original brightness.
[0007] In a possible implementation, determining the brightness enhancement value of the pixel in the target part based on the original brightness and the reference brightness includes: when the original brightness of the pixel in the target part is lower than the reference brightness, obtaining the brightness enhancement value of the pixel in the target part based on a first difference between the reference brightness and the original brightness.
[0008] In a possible implementation, the brightness enhancement value of the pixel in the target part is obtained based on the first difference between the reference brightness and the original brightness, including: obtaining the first difference between the reference brightness and the original brightness; and obtaining the brightness enhancement value of the pixel in the target part according to the first difference and a preset channel value, wherein the preset channel value is determined according to a target part mask, and the target part mask is used to determine the target part to be beautified in the user image.
[0009] In a possible implementation, determining the brightness boost value of the pixel in the target part according to the reference brightness also includes: when the brightness boost value is greater than a preset brightness threshold, updating the brightness boost value based on a second difference between the brightness boost value and the preset brightness threshold to obtain an updated brightness boost value; obtaining the target brightness of the pixel in the target part according to the brightness boost value and the original brightness includes: obtaining the target brightness of the pixel in the target part according to the updated brightness boost value and the original brightness.
[0010] In a possible implementation, the brightness improvement value is updated based on a second difference between the brightness improvement value and the preset brightness threshold to obtain an updated brightness improvement value, including: obtaining the second difference between the brightness improvement value and the preset brightness threshold; obtaining the updated brightness improvement value according to the second difference, the original brightness and a preset channel value, wherein the preset channel value is determined according to a target part mask, and the target part mask is used to determine the target part to be beautified in the user image.
[0011] In a possible implementation manner, the preset brightness threshold is calculated according to the reference brightness.
[0012] In a possible implementation, determining the reference brightness of the target part according to the brightness of the center position of the target part includes: obtaining the reference brightness of the target part according to the original brightness of at least one pixel point at the center position of the target part.
[0013] In a possible implementation, generating a target user image after beautifying the target part according to the beautification material input in the beautification operation and the target brightness includes: determining an intermediate color of pixels in the target part according to the target brightness; fusing the intermediate color with the beautification color in the beautification material to obtain a target color of pixels in the target part; and obtaining a target user image after beautifying the target part based on the target color.
[0014] In a possible implementation, the target part includes an eyebrow part, and the beautification operation includes an eyebrow shape rendering operation.
[0015] According to one aspect of the present disclosure, there is provided an image processing apparatus, comprising:
[0016] A receiving module is used to receive a beautification operation on a user image and determine a target part to be beautified in the user image; a brightness determination module is used to determine a reference brightness of the target part according to the brightness of the center position of the target part; a brightness enhancement module is used to enhance the brightness of the pixels in the target part according to the reference brightness to obtain a target brightness of the pixels in the target part; a beautification module is used to generate a target user image after beautifying the target part according to the beautification material input in the beautification operation and the target brightness.
[0017] In a possible implementation, the device is also used to: determine the original brightness of the pixel points in the target part according to the original color of the pixel points in the target part; the brightness enhancement module is used to: determine the brightness enhancement value of the pixel points in the target part according to the original brightness and the reference brightness; and obtain the target brightness of the pixel points in the target part according to the brightness enhancement value and the original brightness.
[0018] In a possible implementation, the brightness enhancement module is further used to obtain a brightness enhancement value of the pixel point in the target part based on a first difference between the reference brightness and the original brightness when the original brightness of the pixel point in the target part is lower than the reference brightness.
[0019] In a possible implementation, the brightness enhancement module is further used to: obtain a first difference between the reference brightness and the original brightness; and obtain a brightness enhancement value of a pixel point in the target part based on the first difference and a preset channel value, wherein the preset channel value is determined based on a target part mask, and the target part mask is used to determine the target part to be beautified in the user image.
[0020] In a possible implementation, the brightness enhancement module is also used to: when the brightness enhancement value is greater than a preset brightness threshold, based on a second difference between the brightness enhancement value and the preset brightness threshold, update the brightness enhancement value to obtain an updated brightness enhancement value; and obtain the target brightness of the pixel point in the target part according to the brightness enhancement value and the original brightness, including: obtaining the target brightness of the pixel point in the target part according to the updated brightness enhancement value and the original brightness.
[0021] In one possible implementation, the brightness enhancement module is further used to: obtain a second difference between the brightness enhancement value and the preset brightness threshold; and obtain the updated brightness enhancement value based on the second difference, the original brightness, and a preset channel value, wherein the preset channel value is determined based on a target part mask, and the target part mask is used to determine the target part to be beautified in the user image.
[0022] In a possible implementation manner, the preset brightness threshold is calculated according to the reference brightness.
[0023] In a possible implementation manner, the brightness determination module is used to obtain a reference brightness of the target part according to an original brightness of at least one pixel point at a central position of the target part.
[0024] In one possible implementation, the beautification module is used to: determine the intermediate color of the pixel points in the target part according to the target brightness; merge the intermediate color with the beautification color in the beautification material to obtain the target color of the pixel points in the target part; and obtain the target user image after beautifying the target part based on the target color.
[0025] In a possible implementation, the target part includes an eyebrow part, and the beautification operation includes an eyebrow shape rendering operation.
[0026] According to one aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to: execute the above-mentioned image processing method.
[0027] According to one aspect of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the above-mentioned image processing method is implemented.
[0028] In the disclosed embodiment, by receiving a beautification operation on a user image and determining the target part to be beautified in the user image, a reference brightness is determined according to the brightness of the center position of the target part, and then the brightness of the pixel points in the target part is increased according to the reference brightness to obtain the target brightness, thereby generating a target user image after beautification of the target part based on the beautification material input in the beautification operation and the target brightness. Through the above process, the target part in the user image can be faded by increasing the brightness, reducing the influence of the original color of the target part on the beautification process, and improving the beautification effect of the target user image.
[0029] It should be understood that the above general description and the following detailed description are exemplary and explanatory only and do not limit the present disclosure. Other features and aspects of the present disclosure will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used to illustrate the technical solutions of the present disclosure together with the specification.
[0031] Figure 1 A flowchart of an image processing method according to an embodiment of the present disclosure is shown.
[0032] Figure 2 An image of beautified material according to an embodiment of the present disclosure is shown.
[0033] Figure 3 An image of beautified material according to an embodiment of the present disclosure is shown.
[0034] Figure 4 A schematic diagram of a target site mask according to an embodiment of the present disclosure is shown.
[0035] Figure 5 A schematic diagram showing a preset face image according to an embodiment of the present disclosure.
[0036] Figure 6 A schematic diagram showing a user image according to an embodiment of the present disclosure.
[0037] Figure 7 A schematic diagram of an intermediate user image according to an embodiment of the present disclosure is shown.
[0038] Figure 8 A schematic diagram showing a user image according to an embodiment of the present disclosure.
[0039] Fig. 9 A schematic diagram of an intermediate user image according to an embodiment of the present disclosure is shown.
[0040] Fig.10 A schematic diagram showing a target user image according to an embodiment of the present disclosure.
[0041] Fig.11 A schematic diagram showing a target user image according to an embodiment of the present disclosure.
[0042] Fig.12 A schematic diagram showing a target user image according to an embodiment of the present disclosure.
[0043] Fig.13 A schematic diagram showing a target user image according to an embodiment of the present disclosure.
[0044] Fig.14 A block diagram of an image processing apparatus according to an embodiment of the present disclosure is shown.
[0045] Fig.15 A block diagram of an electronic device according to an embodiment of the present disclosure is shown.
[0046] Fig.16 A block diagram of an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0047] Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.
[0048] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0049] The term "and / or" herein is only a description of the association relationship of the associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "at least one" herein represents any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C can represent including any one or more elements selected from the set consisting of A, B, and C.
[0050] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.
[0051] Figure 1A flowchart of an image processing method according to an embodiment of the present disclosure is shown, and the method can be applied to an image processing device or an image processing system, etc. The image processing device can be a terminal device, a server or other processing device, etc. Among them, the terminal device can be a user equipment (User Equipment, UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (Personal Digital Assistant, PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. In one example, the image processing method can be applied to a cloud server or a local server, and the cloud server can be a public cloud server or a private cloud server, which can be flexibly selected according to the actual situation.
[0052] In some possible implementations, the image processing method may also be implemented by a processor calling computer-readable instructions stored in a memory.
[0053] like Figure 1 As shown, in a possible implementation, the image processing method may include:
[0054] Step S11, receiving a beautification operation for a user image, and determining a target part to be beautified in the user image.
[0055] Among them, the user image can be any image containing the user's target part. The user image can contain one or more users, and can also contain one or more user's target parts. Its implementation form can be flexibly determined according to actual conditions and is not limited in the present disclosed embodiments.
[0056] The target part may be any part of the user's image that needs to be beautified. The parts included in the target part and its implementation form may also be flexibly determined according to the actual situation of the beautification operation. For example, for the beautification operation of eyebrow rendering operation, the target part may be the eyebrow part; for the beautification operation of hair dyeing operation, the target part may be the hair part; for the beautification operation of lip makeup operation, the target part may be the lip part, etc.
[0057] A beautification operation may be any operation that beautifies a target part of a user image, such as an eyebrow rendering operation, a hair dyeing operation, a lip makeup operation, an eye makeup operation, or a contouring operation. The operation content included in the beautification operation can be flexibly determined according to actual conditions and is not limited to the following disclosed embodiments. In one possible implementation, the beautification operation may include an operation of instructing to beautify a target part of a user in a user image; in some possible implementations, the beautification operation may also include inputting one or more parameters, such as beautification materials or adjusting parameters.
[0058] The beautification material can be any material input during the beautification operation to beautify the target part of the user's image. The beautification material can be the same or different in color from the target part in the user's image. The form of the beautification material can be flexibly selected and set according to actual conditions, and is not limited in the embodiments of the present disclosure. In some possible implementations, a variety of beautification materials can also be provided to the user, and the selected beautification material can be determined based on the user's selection. In the beautification operation, a single beautification material can be input or selected, or multiple beautification materials can be input or selected at the same time. Figure 2 and Figure 3 The images of the beautified material according to an embodiment of the present disclosure are respectively shown as follows: Figure 2 As shown, in one example, the beautification material may be a first eyebrow material having an eyebrow peak; Figure 3 As shown, in one example, the beautification material may also be a second eyebrow material with a gentle eyebrow shape.
[0059] The adjustment parameters may be relevant parameters input during the beautification operation for beautifying the target part of the user image. The adjustment parameters may include various parameter types. In some possible implementations, the adjustment parameters may include: at least one of the intensity, highlight, midtone, glossiness, or grayness of the color of the target part of the user image. The process of beautifying the target part may be flexibly changed with different beautification materials, and is not limited in the embodiments of the present disclosure.
[0060] The method of determining the target part is not limited in the embodiments of the present disclosure and is not limited to the following disclosed embodiments. In a possible implementation, the position of the target part in the user image can be determined by a target part mask.
[0061] The target part mask may be a mask image of the target part, and its implementation form may be flexibly changed according to different target parts. Figure 4 A schematic diagram of a target part mask according to an embodiment of the present disclosure is shown. As shown in the figure, in one example, the target part mask may be a mask image of an eyebrow part.
[0062] The method of determining the target part in the user image according to the target part mask can be flexibly determined according to the actual situation. In one example, the position of the target part in the user image can be identified to obtain the initial position of the target part in the user image. The identification method is not limited in the embodiment of the present disclosure, for example, key point identification or direct identification of the entire eyebrow part can be performed.
[0063] In one example, the target part in the user image can be determined based on the initial position. In one example, the exact position of the target part in the user image can also be further determined based on the initial position. For example, the target part mask can be fused with the target part in the preset face image to obtain a standard material image, and then the target part in the standard material image can be extracted according to the initial position to obtain an extracted material of the target part. When the transparency of the pixel point in the extracted material belongs to the preset transparency range, the pixel point corresponding to the pixel point in the user image is confirmed as a pixel point belonging to the target part, and then the target part in the user image can be determined.
[0064] The preset face image may be a standard face image template, which may include complete and comprehensive face parts, and the positions of the face parts in the preset face image are standard. The implementation form of the preset face image may be flexibly determined according to actual conditions, and any standard face used in the field of face image processing may be used as the implementation form of the preset face image. Figure 5 A schematic diagram of a preset face image according to an embodiment of the present disclosure is shown (in order to protect the object in the image, some parts of the face in the figure are mosaiced). It can be seen from the figure that in one example, the face parts included in the preset face image are clear, complete and consistent with the objective distribution of each face part in the face. At the same time, since the position of each face part in the preset face image is standard, the target part mask can be directly fused with the position corresponding to the target part in the preset face image to obtain a standard material image.
[0065] Step S12, determining a reference brightness of the target part according to the brightness of the center position of the target part.
[0066] The center position of the target part can be flexibly determined according to the actual situation of the target part. In one example, when the target part is the eyebrow part, the center position can be the center position between the left eyebrow and the right eyebrow. In one example, when the target part is the eyebrow part, the center position can also be the center point position of the left eyebrow or the center point position of the right eyebrow, etc., which can be flexibly set according to the actual situation. The reference brightness can be used as a reference to determine the enhancement value of the brightness of each pixel in the target part.
[0067] In a possible implementation, step S12 may include: obtaining a reference brightness of the target part according to an original brightness of at least one pixel at the center position of the target part.
[0068] The original brightness of the pixel in the target part may be the original brightness of the pixel in the user image. The original brightness may be determined according to the color value of the pixel in the user image, or may be directly read from the user image. Therefore, in a possible implementation, the method proposed in the embodiment of the present disclosure may further include:
[0069] The original brightness of the pixel in the target part is determined according to the original color of the pixel in the target part.
[0070] The original color of the pixel in the target part can be the original color value of the pixel in the user image, such as the RGB color value. The method of determining the original brightness according to the original color can be flexibly selected according to the actual situation, such as calculating according to the channel value of each color channel in the original color to obtain the brightness value as the original brightness; or converting the original color to a color space containing brightness, such as HSL (hue H, saturation S and brightness L) color space, or HSV (hue H, saturation S and brightness V) color space, etc., and then determining the original brightness based on the brightness or brightness component in the color space.
[0071] In one example, the original brightness of the pixel at the exact center of the target part can be used as the reference brightness; in another example, the average or weighted average of the original brightness of multiple pixels at the center of the target part can be used as the reference brightness, etc. The method of confirming the reference brightness can be flexibly selected according to actual conditions.
[0072] Through the embodiments of the present disclosure, the original brightness of one or more pixel points in the center position of the target part can be used to determine the reference brightness, thereby improving the diversity of methods for determining the reference brightness, and then improving the flexibility and application scope of the image processing process.
[0073] Step S13, according to the reference brightness, the brightness of the pixel points in the target part is increased to obtain the target brightness of the pixel points in the target part.
[0074] Among them, the pixel points in the target part can be every pixel point contained in the target part, or some of the pixel points in the target part. The target brightness can be the brightness obtained after the brightness of the pixel points in the target part is enhanced. How to determine which pixel points to enhance the brightness, and how to enhance the brightness of the pixel points according to the reference brightness, its implementation method can refer to the following public embodiments, which will not be expanded here. For example, the brightness of the pixel points can be enhanced according to the difference between the reference brightness and the original brightness of the pixel points in the target part.
[0075] Step S14, generating a target user image after beautifying the target part according to the beautification material and the target brightness input in the beautification operation.
[0076] The implementation form of the beautification material can refer to the above-mentioned disclosed embodiment, which will not be described in detail here. The target user image can be an image obtained by beautifying the target part of the user image based on the target brightness and the beautification material. The method of generating the target user image can be flexibly determined according to the actual situation. For example, the target brightness can be converted into a corresponding color, and then the converted color is merged with the color of each pixel in the beautification material to obtain the target user image, or the color of each pixel in the beautification material is converted into brightness, and then merged with the target brightness to obtain the target user image.
[0077] Some possible implementations of step S14 can be found in the following disclosed embodiments, which will not be expanded here.
[0078] In the disclosed embodiment, by receiving a beautification operation on a user image and determining the target part to be beautified in the user image, a reference brightness is determined according to the brightness of the center position of the target part, and then the brightness of the pixel points in the target part is increased according to the reference brightness to obtain the target brightness, thereby generating a target user image after beautification of the target part based on the beautification material input in the beautification operation and the target brightness. Through the above process, the target part in the user image can be faded by increasing the brightness, reducing the influence of the original color of the target part on the beautification process, and improving the beautification effect of the target user image.
[0079] In a possible implementation, step S13 may include:
[0080] Determine the brightness enhancement value of the pixel point in the target part according to the original brightness and the reference brightness;
[0081] According to the brightness enhancement value and the original brightness, the target brightness of the pixel in the target part is obtained.
[0082] The brightness enhancement value may be an enhancement value or a value range for enhancing the brightness of a pixel. In some possible implementations, the brightness enhancement value may be determined according to a numerical relationship between the original brightness and the reference brightness, for example, according to a difference between the original brightness and the reference brightness or an absolute value of the difference.
[0083] The calculation method for determining the brightness improvement value can be flexibly selected according to actual conditions. Please refer to the following disclosed embodiments for details, which will not be expanded here.
[0084] The method of obtaining the target brightness according to the brightness enhancement value and the original brightness can also be flexibly selected according to the actual situation. For example, the original brightness and the brightness enhancement value can be fused or weighted to obtain the target brightness. The fusion method can also be selected according to the actual situation, such as superposition or multiplication. In an example, the original brightness and the brightness enhancement value can be added to obtain the target brightness.
[0085] Through the embodiments of the present disclosure, the brightness enhancement value of the pixel point can be determined according to the original brightness and the reference brightness, and then the target brightness of the pixel point can be determined based on the brightness enhancement value. Compared with directly determining the target brightness according to the original brightness and the reference brightness, the method proposed in the embodiments of the present disclosure can determine the target brightness more conveniently and is convenient for simultaneously determining the target brightness of multiple pixel points, thereby improving the efficiency and convenience of image processing.
[0086] In a possible implementation, determining the brightness enhancement value of a pixel point in the target part according to the original brightness and the reference brightness may include:
[0087] When the original brightness of the pixel in the target part is lower than the reference brightness, the brightness enhancement value of the pixel in the target part is obtained based on a first difference between the reference brightness and the original brightness.
[0088] Among them, the first difference can be the difference result obtained by subtracting the original brightness from the reference brightness. When the original brightness of the pixel in the target part is lower than the reference brightness, it indicates that the original brightness of the pixel in the target part is darker. In this case, if the pixel is beautified directly, it may be affected by the original color of the pixel and cause the beautification effect to be poor. Therefore, when the original brightness of the pixel is lower than the reference brightness, it can be determined that the pixel needs to be enhanced in brightness, and the brightness enhancement value of the pixel can be obtained based on the first difference.
[0089] The calculation relationship between the first difference and the brightness improvement value can be flexibly set according to actual conditions. Please refer to the following disclosed embodiments for details, which will not be expanded here.
[0090] In some possible implementations, when the original brightness of a pixel in the target part is higher than or equal to the reference brightness, it can be indicated that the pixel itself has a higher brightness, and thus the original brightness of the pixel in the target part can be used as the target brightness.
[0091] Through the embodiments of the present disclosure, it is possible to determine whether the brightness of a pixel needs to be enhanced by comparing the original brightness of the pixel with the reference brightness, thereby effectively reducing the number of pixels that need to be enhanced in brightness during image processing and improving image processing efficiency.
[0092] In a possible implementation, obtaining the brightness enhancement value of the pixel point in the target part based on the first difference between the reference brightness and the original brightness may include:
[0093] Obtaining a first difference between the reference brightness and the original brightness;
[0094] According to the first difference and the preset channel value, the brightness enhancement value of the pixel point in the target part is obtained.
[0095] Among them, the method for obtaining the first difference can refer to the above-mentioned disclosed embodiments, which will not be repeated here.
[0096] The preset channel value may be a channel value determined according to the target part mask. The implementation of the target part mask may refer to the above-mentioned disclosed embodiments and will not be described in detail here. The preset channel value may be a channel value of the target part mask on a color-related channel. In one example, the alpha channel value of each pixel in the target part mask may be used as the preset channel value.
[0097] The calculation process of obtaining the brightness improvement value according to the first difference and the preset channel value is not limited to the following disclosed embodiments and can be flexibly adjusted according to actual conditions. In one example, the process of obtaining the brightness improvement value can be expressed by the following formula (1):
[0098] add_bright=pow((ref_luminance-V),x)*mask_alpha (1)
[0099] Among them, add_bright is the brightness enhancement value, ref_luminance is the reference brightness, V is the original brightness of the pixel in the target area, x is the preset calculation value, mask_alpha is the preset channel value, and pow(a,b) indicates the result of calculating a to the power of b.
[0100] Through the embodiments of the present disclosure, the first difference and the preset channel value included in the target part mask can be used to jointly determine the brightness enhancement value of the pixel point in the target part. On the basis of fully utilizing the first difference formed by the reference brightness and the original brightness, the channel value of the target part mask of the target part determined from the user image is also effectively utilized, so that the obtained brightness enhancement value has a higher correlation with the position of the pixel point in the user image, thereby enhancing the overall brightness enhancement effect of the entire target part, thereby making the subsequent beautification effect of the target part more natural.
[0101] In a possible implementation, determining the brightness enhancement value of the pixel point in the target part according to the reference brightness may also include:
[0102] When the brightness enhancement value is greater than the preset brightness threshold, the brightness enhancement value is updated based on a second difference between the brightness enhancement value and the preset brightness threshold to obtain an updated brightness enhancement value.
[0103] The preset brightness threshold may be a brightness threshold flexibly set according to actual conditions, and the specific value may be flexibly selected according to actual conditions, and is not limited to the following disclosed embodiments. In a possible implementation, the preset brightness threshold may be calculated based on the reference brightness.
[0104] The calculation relationship between the preset brightness threshold and the reference brightness can also be flexibly set according to actual conditions, and is not limited to the following disclosed embodiments. In one example, the calculation relationship between the preset brightness threshold and the reference brightness can be expressed by the following formula (2):
[0105] V_threshold=ref_luminance*y (2)
[0106] Among them, V_threshold is the preset brightness threshold, ref_luminance is the reference brightness, and y is the preset ratio value.
[0107] Through the embodiments of the present disclosure, the preset brightness threshold can be further determined according to the reference brightness, so that when the reference brightness is determined, the brightness of the pixels in the target part can be better enhanced, which can reduce the acquisition of additional data and better improve the beautification effect of the subsequent target part.
[0108] The second difference value may be the difference result obtained by subtracting the preset brightness threshold from the brightness boost value. When the brightness boost value is greater than the preset brightness threshold, it indicates that the brightness boost of the pixel is too high, which may easily lead to a more abrupt brightness boost effect at certain positions of the target part, which may then affect the subsequent beautification effect of the target part. Therefore, in order to reduce the occurrence of such a situation, the brightness boost value may be updated according to the second difference value between the brightness boost value and the preset brightness threshold, so as to limit the brightness boost value of the pixel in the target part.
[0109] The calculation relationship between the second difference and the updated brightness enhancement value can be flexibly set according to actual conditions. Please refer to the following disclosed embodiments for details, which will not be expanded here.
[0110] In some possible implementations, when the brightness boost value is less than or equal to a preset brightness threshold, it can be indicated that the brightness boost value of the pixel is relatively reasonable, and thus the brightness boost value can be directly used as the updated brightness boost value.
[0111] When the updated brightness enhancement value is obtained, the target brightness of the pixel in the target part can be obtained according to the updated brightness enhancement value and the original brightness. The specific method of obtaining the target brightness can refer to the method of obtaining the target brightness according to the brightness enhancement value and the original brightness in the above-mentioned disclosed embodiment, which will not be repeated here.
[0112] Through the embodiments of the present disclosure, the brightness enhancement value of the pixels in the target part can be limited within a certain numerical range by comparing the brightness enhancement value with a preset brightness threshold, thereby reducing the situation where some pixels at the edge of the target part appear too bright due to the brightness enhancement, and then the beautified target part as a whole has a better transition, thereby improving the natural beautification effect.
[0113] In a possible implementation, updating the brightness boost value based on a second difference between the brightness boost value and a preset brightness threshold to obtain an updated brightness boost value includes:
[0114] Obtaining a second difference between the brightness boost value and a preset brightness threshold;
[0115] An updated brightness enhancement value is obtained according to the second difference, the original brightness and the preset channel value.
[0116] The method for obtaining the second difference and the method for implementing the preset channel value may refer to the above-mentioned disclosed embodiments and will not be described in detail here.
[0117] The calculation process of obtaining the updated brightness boost value according to the second difference, the original brightness of the pixel point and the preset channel value is not limited to the following disclosed embodiments and can be flexibly adjusted according to actual conditions. In one example, the process of obtaining the updated brightness boost value can be expressed by the following formula (3):
[0118] add_bright_new=V_threshold+(add_bright-V_threshold)*V*mask_alpha(3)
[0119] Among them, add_bright_new is the updated brightness improvement value, add_bright is the brightness improvement value, V_threshold is the preset brightness threshold, V is the original brightness of the pixel in the target part, and mask_alpha is the preset channel value.
[0120] Through the embodiments of the present disclosure, the second difference, the original brightness and the preset channel value contained in the target part mask can be used to jointly update the brightness enhancement value of the pixel points in the target part, thereby limiting the brightness enhancement value of the pixel points in the target part to a more reasonable range, thereby improving the overall beautification effect of the target part.
[0121] Figure 6 A schematic diagram showing a user image according to an embodiment of the present disclosure (in order to protect the object in the image, part of the face of the person in each figure is mosaiced, and the images in the following disclosed embodiments are similar, and will not be repeated here), Figure 7 For Figure 6 A schematic diagram of an intermediate user image obtained by enhancing the brightness of pixels in the eyebrow area of the first user in FIG. Figure 6 and Figure 7 Since it is displayed as a grayscale image, the brightness change is not obvious, but it can still be seen through comparison. Figure 7 The first user's eyebrow position relative to Figure 6 The eyebrow area of the first user has a significantly improved brightness and a lighter color. Therefore, the image processing method proposed in the above disclosed embodiments can effectively improve the brightness of the target area.
[0122] Similarly, Figure 8 A schematic diagram showing a user image according to an embodiment of the present disclosure is shown. Fig. 9 For Figure 8 Schematic diagram of the intermediate user image obtained after improving the brightness of the pixels in the eyebrow area of the second user in the figure. By comparison, it can be seen that in different user images, the image processing method proposed in the embodiment of the present disclosure can better improve the brightness of the target area.
[0123] In a possible implementation, step S14 may include:
[0124] According to the target brightness, determine the middle color of the pixel points in the target part;
[0125] The intermediate color is merged with the beautification color in the beautification material to obtain the target color of the pixel point in the target part;
[0126] Based on the target color, a target user image after beautifying the target part is obtained.
[0127] Among them, the intermediate color can be the color obtained after converting the target brightness into a brightness and a color value. The method of obtaining the intermediate color according to the target brightness can be flexibly determined according to the actual situation. For example, the intermediate color can be obtained by performing a reverse calculation based on the relationship between the channel values and the brightness in the color, or the color space where the target brightness is located, such as the HSV space or the HSL space, is converted to a color space, such as the RGB space, to obtain the intermediate color of the pixel.
[0128] The beautification color may be the color of each pixel in the beautification material, and the target color may be the color obtained by beautifying the pixel in the target part according to the beautification color. In a possible implementation, the target color may be obtained by blending the intermediate color with the beautification color, and the fusion method may be flexibly selected according to actual conditions and is not limited to the following disclosed embodiments.
[0129] In a possible implementation, the target color can be obtained by mixing the intermediate color and the beautification color in a multiplication manner, wherein the multiplication can mix the intermediate color and the beautification color as two layers in the form of multiplication, so that the colors of the two layers are darkened in a smooth nonlinear manner. In an example, the process of fusing the intermediate color and the beautification color by multiplication can be expressed by the following formula (4):
[0130] result_color=fade_color*material_color (4)
[0131] Among them, result_color is the target color after fusion, fade_color is the intermediate color, and material_color is the beautification color.
[0132] After determining the target color, the target color can be used as the color of the pixel points in the beautified target part to obtain the beautified target user image, or the color of the pixel points in the target part can be further rendered based on the target color to obtain the beautified target user image. The specific implementation method can be flexibly selected according to the actual situation and is not limited in the embodiments of the present disclosure.
[0133] Through the embodiments of the present disclosure, color beautification of pixels in the target area can be achieved based on the enhanced target brightness, and then the influence of the original color of the pixels in the target area on the beautification process can be reduced by enhancing the brightness, thereby improving the beautification effect and naturalness.
[0134] Based on the above disclosed embodiments, a target user image in which a target part in the user image is beautified can be obtained. Figure 10-13 Schematic diagrams of target user images according to an embodiment of the present disclosure are respectively shown, wherein: Fig.10 To pass Figure 2 The first eyebrow material pair Figure 6 The target user image obtained after performing eyebrow rendering operation on the first user image in , Fig.11 To pass Figure 3 The second eyebrow material pair Figure 6 The target user image obtained after performing eyebrow rendering operation on the first user image in , Fig.12 To pass Figure 2 The first eyebrow material pair Figure 8 The target user image obtained after performing eyebrow rendering operation on the second user image in Fig.13 To pass Figure 3 The second eyebrow material pair Figure 8 The target user image is obtained after performing an eyebrow rendering operation on the second user image in .
[0135] Although the grayscale image cannot clearly reflect the changes in the eyebrow area, it can still be seen through comparison that, through the image processing methods proposed in the above-mentioned disclosed embodiments, an image of the target user with a more realistic and natural eyebrow rendering can be obtained.
[0136] Fig.14 A block diagram of an image processing device according to an embodiment of the present disclosure is shown. As shown in the figure, the image processing device 20 may include:
[0137] The receiving module 21 is used to receive a beautification operation for a user image and determine a target part to be beautified in the user image.
[0138] The brightness determination module 22 is used to determine the reference brightness of the target part according to the brightness of the center position of the target part.
[0139] The brightness enhancement module 23 is used to enhance the brightness of the pixel points in the target part according to the reference brightness, so as to obtain the target brightness of the pixel points in the target part.
[0140] The beautification module 24 is used to generate a target user image after beautifying the target part according to the beautification material and target brightness input in the beautification operation.
[0141] In a possible implementation, the device is also used to: determine the original brightness of the pixel points in the target part according to the original color of the pixel points in the target part; the brightness enhancement module is used to: determine the brightness enhancement value of the pixel points in the target part according to the original brightness and the reference brightness; and obtain the target brightness of the pixel points in the target part according to the brightness enhancement value and the original brightness.
[0142] In a possible implementation, the brightness enhancement module is further used to obtain a brightness enhancement value of the pixel in the target part based on a first difference between the reference brightness and the original brightness when the original brightness of the pixel in the target part is lower than the reference brightness.
[0143] In one possible implementation, the brightness enhancement module is further used to: obtain a first difference between a reference brightness and an original brightness; and obtain a brightness enhancement value of a pixel point in a target part based on the first difference and a preset channel value, wherein the preset channel value is determined based on a target part mask, and the target part mask is used to determine a target part to be beautified in a user image.
[0144] In one possible implementation, the brightness enhancement module is also used to: when the brightness enhancement value is greater than a preset brightness threshold, based on a second difference between the brightness enhancement value and the preset brightness threshold, update the brightness enhancement value to obtain an updated brightness enhancement value; obtain the target brightness of the pixel point in the target part according to the brightness enhancement value and the original brightness, including: obtaining the target brightness of the pixel point in the target part according to the updated brightness enhancement value and the original brightness.
[0145] In one possible implementation, the brightness enhancement module is further used to: obtain a second difference between the brightness enhancement value and a preset brightness threshold; obtain an updated brightness enhancement value based on the second difference, the original brightness, and the preset channel value, wherein the preset channel value is determined based on a target part mask, and the target part mask is used to determine the target part to be beautified in the user image.
[0146] In a possible implementation manner, the preset brightness threshold is calculated according to the reference brightness.
[0147] In a possible implementation manner, the brightness determination module is used to obtain a reference brightness of the target part according to an original brightness of at least one pixel point at a central position of the target part.
[0148] In one possible implementation, the beautification module is used to: determine the intermediate color of the pixel points in the target part according to the target brightness; merge the intermediate color with the beautification color in the beautification material to obtain the target color of the pixel points in the target part; and obtain the target user image after beautifying the target part based on the target color.
[0149] In a possible implementation, the target part includes an eyebrow part, and the beautification operation includes an eyebrow shape rendering operation.
[0150] The present disclosure relates to the field of augmented reality. By acquiring the image information of the target object in the real environment, the relevant features, states and attributes of the target object are detected or identified by various visual related algorithms, so as to obtain an AR effect that combines virtuality and reality and matches the specific application. Exemplarily, the target object may involve the face, limbs, gestures, actions, etc. related to the human body, or markers, markers related to objects, or sand tables, display areas or display items related to venues or places. Visual related algorithms may involve visual positioning, SLAM, three-dimensional reconstruction, image registration, background segmentation, key point extraction and tracking of objects, and position or depth detection of objects. Specific applications may not only involve interactive scenes such as guided tours, navigation, explanations, reconstruction, virtual effect superposition and display related to real scenes or objects, but also special effects processing related to people, such as makeup beautification, limb beautification, special effects display, virtual model display and other interactive scenes. The relevant features, states and attributes of the target object can be detected or identified by a convolutional neural network. The above-mentioned convolutional neural network is a network model obtained by model training based on a deep learning framework.
[0151] Application scenario examples
[0152] In the field of computer vision, how to obtain more realistic and natural eyebrow rendering images has become a problem that needs to be solved urgently.
[0153] The present application example proposes an image processing method, including the following process:
[0154] The first step is to calculate the brightness of the pixel at the center of the eyebrows in the user image as the reference brightness and record it as ref_luminance.
[0155] In the second step, the eyebrow part mask is used as the target part mask to obtain the eyebrow part in the user image.
[0156] The third step is to traverse each pixel point in the eyebrow area and perform the following processing:
[0157] Convert the original color of the pixel from the RGB color space to the HSV color space, and convert them to the range of [0.0, 1.0] to obtain the original brightness of the pixel;
[0158] If the original brightness of the pixel is less than ref_luminance, the brightness of the pixel is increased, and the brightness increase value add_bright is obtained by referring to formula (1) in the above disclosed embodiments;
[0159] If the brightness of the brightness enhancement value add_bright is greater than the preset brightness threshold, add_bright is limited by formula (2) in the above disclosed embodiments to obtain an updated brightness enhancement value, so as to reduce the occurrence of an abrupt effect of lightening the eyebrows due to over-brightening;
[0160] The original brightness of the pixel is added to the brightness boost value add_bright or the updated brightness boost value to obtain the target brightness, and then the target brightness is converted to the RGB color space to obtain the intermediate color fade_color of the pixel after fading the eyebrows.
[0161] In the fourth step, the beautification color in the eyebrow material is mixed with the intermediate color fade_color by using formula (4) in the above-mentioned disclosed embodiments to obtain the target user image after eyebrow rendering.
[0162] Through the application example disclosed in the present invention, a variety of selectable eyebrow effects can be provided to users, and according to the eyebrow material selected by the user, the eyebrow part can be processed with corresponding makeup effects to obtain the eyebrow effect required by the user. The method proposed in the application example disclosed in the present invention can support both real-time eyebrow rendering and eyebrow rendering of preset images.
[0163] The image processing method proposed in the application example of the present disclosure can be applied to beautify the eyebrows in the user's image, and can also be extended to beautify other parts, such as lip makeup or hair dyeing. Depending on the type of beautification operation, the image processing method proposed in the application example of the present disclosure can be flexibly expanded and modified accordingly.
[0164] It can be understood that the above-mentioned various method embodiments mentioned in the present disclosure can be combined with each other to form a combined embodiment without violating the principle logic. Due to space limitations, the present disclosure will not go into details.
[0165] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.
[0166] The present disclosure also provides a computer-readable storage medium on which computer program instructions are stored, and the computer program instructions implement the above method when executed by a processor. The computer-readable storage medium may be a volatile computer-readable storage medium or a non-volatile computer-readable storage medium.
[0167] The embodiment of the present disclosure further proposes an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured as the above method.
[0168] In practical applications, the above-mentioned memory can be a volatile memory (volatile memory), such as RAM; or a non-volatile memory (non-volatile memory), such as ROM, flash memory, hard disk drive (HDD) or solid-state drive (SSD); or a combination of the above types of memory, and provide instructions and data to the processor.
[0169] The processor may be at least one of ASIC, DSP, DSPD, PLD, FPGA, CPU, controller, microcontroller, and microprocessor. It is understandable that for different devices, the electronic device used to implement the processor function may also be other, which is not specifically limited in the embodiments of the present disclosure.
[0170] The electronic device may be provided as a terminal, a server, or a device in other forms.
[0171] Based on the same technical concept as the aforementioned embodiment, the embodiment of the present disclosure further provides a computer program, which implements the aforementioned method when executed by a processor.
[0172] Fig.15 800 is a block diagram of an electronic device according to an embodiment of the present disclosure. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, or the like.
[0173] Reference Fig.15 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .
[0174] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.
[0175] The memory 804 is configured to store various types of data to support operations on the electronic device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0176] The power supply component 806 provides power to the various components of the electronic device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 800.
[0177] The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the electronic device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0178] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.
[0179] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.
[0180] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the electronic device 800, the relative positioning of the components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also detect the position change of the electronic device 800 or a component of the electronic device 800, the presence or absence of contact between the user and the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0181] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related personnel information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0182] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.
[0183] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 804 including computer program instructions, which can be executed by a processor 820 of an electronic device 800 to perform the above method.
[0184] Fig.16 1 is a block diagram of an electronic device 1900 according to an embodiment of the present disclosure. For example, the electronic device 1900 may be provided as a server. Fig.16, the electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932 for storing instructions executable by the processing component 1922, such as an application. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute instructions to perform the above method.
[0185] The electronic device 1900 may also include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output (I / O) interface 1958. The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™ or the like.
[0186] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions, which can be executed by the processing component 1922 of the electronic device 1900 to perform the above method.
[0187] The present disclosure may be a system, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.
[0188] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.
[0189] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0190] The computer program instructions for performing the operation of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be personalized by utilizing the state personnel information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.
[0191] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0192] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0193] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0194] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or action, or can be implemented with a combination of special hardware and computer instructions.
[0195] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. An image processing method, characterized in that: include: receiving a beautification operation for a user image, and determining a target part to be beautified in the user image; Determining a reference brightness of the target part according to the brightness of the center position of the target part; According to the reference brightness, the brightness of the pixel points in the target part is increased to obtain the target brightness of the pixel points in the target part; Generating a target user image after beautifying the target part according to the beautification material input in the beautification operation and the target brightness; The method further comprises: determining the original brightness of the pixel points in the target part according to the original color of the pixel points in the target part; The step of increasing the brightness of the pixel points in the target part according to the reference brightness to obtain the target brightness of the pixel points in the target part includes: Determining a brightness enhancement value of a pixel point in the target part according to the original brightness and the reference brightness; Obtaining a target brightness of a pixel point in the target part according to the brightness enhancement value and the original brightness; The step of determining the brightness enhancement value of the pixel point in the target part according to the reference brightness further includes: When the brightness boost value is greater than the preset brightness threshold, the brightness boost value is updated based on a second difference between the brightness boost value and the preset brightness threshold to obtain an updated brightness boost value, so as to limit the brightness boost value of the pixel point in the target part; The step of obtaining a target brightness of a pixel point in the target part according to the brightness enhancement value and the original brightness includes: Obtaining a target brightness of a pixel point in the target part according to the updated brightness enhancement value and the original brightness; The process of obtaining the updated brightness boost value is expressed by the following formula: add_bright_new=V_threshold+(add_bright-V_threshold)*V*mask_alpha, wherein add_bright_new is the updated brightness improvement value, add_bright is the brightness improvement value, V_threshold is the preset brightness threshold, V is the original brightness of the pixel in the target part, and mask_alpha is the preset channel value.
2. The method according to claim 1, characterized in that The step of determining the brightness enhancement value of the pixel point in the target part according to the original brightness and the reference brightness includes: When the original brightness of the pixel in the target part is lower than the reference brightness, a brightness enhancement value of the pixel in the target part is obtained based on a first difference between the reference brightness and the original brightness.
3. The method according to claim 2, characterized in that The step of obtaining a brightness enhancement value of a pixel point in the target portion based on a first difference between the reference brightness and the original brightness includes: Acquire a first difference between the reference brightness and the original brightness; According to the first difference and the preset channel value, a brightness enhancement value of the pixel point in the target part is obtained, wherein the preset channel value is determined according to the target part mask, and the target part mask is used to determine the target part to be beautified in the user image.
4. The method according to claim 1, characterized in that: The updating of the brightness enhancement value based on the second difference between the brightness enhancement value and the preset brightness threshold to obtain an updated brightness enhancement value includes: Obtaining a second difference between the brightness boost value and the preset brightness threshold; The updated brightness enhancement value is obtained according to the second difference, the original brightness and the preset channel value, wherein the preset channel value is determined according to the target part mask, and the target part mask is used to determine the target part to be beautified in the user image.
5. The method according to claim 1, characterized in that The preset brightness threshold is calculated according to the reference brightness.
6. The method according to any one of claims 1 to 5, characterized in that Determining the reference brightness of the target part according to the brightness of the center position of the target part includes: The reference brightness of the target part is obtained according to the original brightness of at least one pixel at the center position of the target part.
7. The method according to any one of claims 1 to 5, characterized in that The step of generating a target user image after beautifying the target part according to the beautification material input in the beautification operation and the target brightness includes: Determining the middle color of the pixel points in the target part according to the target brightness; The intermediate color is merged with the beautification color in the beautification material to obtain the target color of the pixel point in the target part; Based on the target color, a target user image after beautifying the target part is obtained.
8. The method according to any one of claims 1 to 5, characterized in that The target part includes an eyebrow part, and the beautification operation includes an eyebrow shape rendering operation.
9. An image processing device, characterized in that: include: A receiving module, used for receiving a beautification operation for a user image and determining a target part to be beautified in the user image; A brightness determination module, used to determine a reference brightness of the target part according to the brightness of the center position of the target part; A brightness enhancement module, used to enhance the brightness of the pixel points in the target part according to the reference brightness, so as to obtain a target brightness of the pixel points in the target part; A beautification module, used to generate a target user image after beautifying the target part according to the beautification material input in the beautification operation and the target brightness; The device is also used to: determine the original brightness of the pixel points in the target part according to the original color of the pixel points in the target part; the brightness enhancement module is used to: determine the brightness enhancement value of the pixel points in the target part according to the original brightness and the reference brightness; Obtaining a target brightness of a pixel point in the target part according to the brightness enhancement value and the original brightness; The brightness enhancement module is further used to: when the brightness enhancement value is greater than a preset brightness threshold, based on a second difference between the brightness enhancement value and the preset brightness threshold, update the brightness enhancement value to obtain an updated brightness enhancement value, so as to limit the brightness enhancement value of the pixel point in the target part; The step of obtaining the target brightness of the pixel in the target part according to the brightness enhancement value and the original brightness includes: obtaining the target brightness of the pixel in the target part according to the updated brightness enhancement value and the original brightness; The process of obtaining the updated brightness boost value is expressed by the following formula: add_bright_new=V_threshold+(add_bright-V_threshold)*V*mask_alpha, wherein add_bright_new is the updated brightness improvement value, add_bright is the brightness improvement value, V_threshold is the preset brightness threshold, V is the original brightness of the pixel in the target part, and mask_alpha is the preset channel value.
10. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to call the instructions stored in the memory to execute the method described in any one of claims 1 to 8.
11. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 8 is implemented.
