Image hair dyeing special effect processing method, system and equipment and storage medium

By fading the hair area of ​​high-saturation avatars with grayscale and brightness adjustment, and adjusting the special effect image in combination with the target color, the problem of low naturalness of hair dyeing on high-saturation avatars is solved, real and natural hair dyeing effects and better detail retention is achieved.

CN120125679APending Publication Date: 2025-06-10BIGO TECH PTE LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510137528.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-07
Publication Date
2025-06-10

AI Technical Summary

Technical Problem

When the existing hair dye special effects treatment solution applies hair dye special effects on high saturation avatars, the naturalness is low and the hair details cannot be preserved, resulting in the hair dye special effects not being real enough.

Method used

By obtaining the target avatar and hair mask, adjusting the grayscale and brightness of the hair area for fading, generating an initial special effect image, and adjusting the specified parameters of the initial special effect image based on the target color to generate the final hair dye special effect processing result.

Benefits of technology

It implements real and natural hair dyeing effects on hair colors of avatars of different saturation, retaining more details of the original hair, and improving the processing effect and user experience of hair dyeing effects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120125679A_ABST
    Figure CN120125679A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses an image hair dyeing special effect processing method, system and device and a storage medium. According to the technical scheme provided by the embodiment of the invention, the method comprises the steps: obtaining a target head portrait and a divided hair mask corresponding to the target head portrait; adjusting the gray scale and brightness of the hair area of the target head portrait based on the target head portrait and the hair mask so as to carry out color fading processing on the hair area of the target head portrait and generate an initial special effect image; and obtaining a target color of a to-be-applied hair dyeing special effect of the target head portrait, adjusting a specified parameter of a hair area of the initial special effect image based on the target color, and generating a hair dyeing special effect processing result of the target head portrait. By adopting the technical means, the real and natural hair dyeing special effect can be applied to the head portrait hair colors with different saturations, so that the hair dyeing special effect can retain more details of the original hair, the processing effect of the hair dyeing special effect is improved, and the use experience of a user is further improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of image processing technology, and in particular, to an image hair dyeing special effect processing method, system, device and storage medium. Background Art

[0002] At present, with the continuous development of short video and live broadcast scenarios, many special effect play methods have emerged. The hair dyeing special effect is one of the most interesting and interactive special effects. Users can experience a natural and realistic virtual hair dyeing effect in real time by applying different hair dyeing special effects. In related virtual hair dyeing special effect solutions, generally, light adjustment and rendering operations are performed on the hair area segmented from the avatar, and a dyeing effect is applied on the basis of the original hair color distribution of the avatar, so as to adjust the hair color of the avatar and apply a hair dyeing special effect to the user's avatar.

[0003] However, the related hair dyeing special effect processing solution applies a dyeing effect on the basis of the original hair color distribution of the avatar. For users with a relatively high hair color saturation (dark hair color) of the avatar, directly applying a dyeing effect on the original hair color makes it difficult to obtain a hair dyeing special effect with a relatively low saturation (light hair color), and the naturalness of the hair dyeing effect is relatively low, the hair details cannot be retained, and the hair dyeing special effect is not real enough. Summary of the Invention

[0004] The embodiments of the present application provide an image hair dyeing special effect processing method, system, device and storage medium, which can apply real and natural hair dyeing special effects to avatars with different saturations of hair colors, and solve the technical problem that the naturalness of the hair dyeing special effects applied to high-saturation avatars is relatively low.

[0005] In a first aspect, the embodiments of the present application provide an image hair dyeing special effect processing method, including:

[0006] Obtaining a target avatar and a hair mask segmented from the target avatar;

[0007] Based on the target avatar and the hair mask, adjusting the gray level and brightness of the hair area of the target avatar to perform a fading process on the hair area of the target avatar, and generating an initial special effect image;

[0008] Obtaining the target color of the hair dyeing special effect to be applied to the target avatar, and adjusting the specified parameters of the hair area of the initial special effect image based on the target color to generate the processing result of the hair dyeing special effect of the target avatar.

[0009] In a second aspect, the embodiments of the present application provide an image hair dyeing special effect processing system, including:

[0010] An obtaining module, configured to obtain a target avatar and a hair mask segmented from the target avatar;

[0011] A fading module, configured to adjust the grayscale and brightness of the hair area of the target avatar based on the target avatar and the hair mask, so as to perform a fading process on the hair area of the target avatar and generate an initial special effect image;

[0012] An adjustment module, configured to obtain the target color of the hair dyeing special effect to be applied to the target avatar, and adjust the specified parameters of the hair area of the initial special effect image based on the target color to generate the processing result of the hair dyeing special effect of the target avatar.

[0013] In a third aspect, an embodiment of the present application provides an image hair dyeing special effect processing device, including:

[0014] A memory and one or more processors;

[0015] The memory is configured to store one or more programs;

[0016] When the one or more programs are executed by the one or more processors, the one or more processors implement the image hair dyeing special effect processing method as described in the first aspect.

[0017] In a fourth aspect, an embodiment of the present application provides a non-volatile computer-readable storage medium, where the non-volatile computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are configured to execute the image hair dyeing special effect processing method as described in the first aspect when executed by a computer processor.

[0018] In a fifth aspect, an embodiment of the present application provides a computer program product, where the computer program product contains instructions, and when the instructions run on a computer or a processor, the computer or the processor executes the image hair dyeing special effect processing method as described in the first aspect.

[0019] In the embodiments of the present application, by obtaining a target avatar and a hair mask segmented from the corresponding target avatar; adjusting the grayscale and brightness of the hair area of the target avatar based on the target avatar and the hair mask, so as to perform a fading process on the hair area of the target avatar and generate an initial special effect image; obtaining the target color of the hair dyeing special effect to be applied to the target avatar, and adjusting the specified parameters of the hair area of the initial special effect image based on the target color to generate the processing result of the hair dyeing special effect of the target avatar. By adopting the above technical means, through adjusting the grayscale and brightness to perform a fading process on the hair area of the target avatar, and then adding the target color to the hair area of the initial special effect image after the fading process, a hair dyeing special effect processing result corresponding to the target color is generated. Thus, by the method of first performing a fading process and then adding the target color, a realistic and natural hair dyeing special effect is applied to the hair colors of avatars with different saturations, enabling the hair dyeing special effect to retain more details of the original hair, improving the processing effect of the hair dyeing special effect, and further enhancing the user experience. Description of the Drawings

[0020] Figure 1 It is a flowchart of an image hair coloring special effect processing method provided by an embodiment of the present application;

[0021] Figure 2 It is a flowchart of rendering and displaying the hair coloring special effect in an embodiment of the present application;

[0022] Figure 3 It is a flowchart of processing the hair coloring basic node in an embodiment of the present application;

[0023] Figure 4 It is a flowchart of hair coloring special effect processing based on triple hair coloring basic nodes in an embodiment of the present application;

[0024] Figure 5 It is a schematic diagram of the hair coloring special effect based on triple hair coloring basic nodes in an embodiment of the present application;

[0025] Figure 6 It is a flowchart of hair coloring special effect processing based on the hair coloring basic node and linear light overlay in an embodiment of the present application;

[0026] Figure 7 It is a schematic diagram of the hair coloring special effect based on the hair coloring basic node and linear light overlay in an embodiment of the present application;

[0027] Figure 8 It is a schematic structural diagram of an image hair coloring special effect processing system provided by an embodiment of the present application;

[0028] Figure 9 It is a schematic structural diagram of an image hair coloring special effect processing device provided by an embodiment of the present application. Detailed implementation manners

[0029] In order to make the objectives, technical solutions and advantages of the present application clearer, the following further describes the specific embodiments of the present application in detail with reference to the accompanying drawings. It can be understood that the specific embodiments described herein are only used to explain the present application, rather than limiting the present application. Additionally, it should be noted that for the sake of description, only parts related to the present application are shown in the accompanying drawings rather than all the content. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe the operations (or steps) as sequential processes, many of the operations can be implemented in parallel, concurrently or simultaneously. In addition, the order of the operations can be rearranged. When the operations are completed, the process can be terminated, but there can also be additional steps not included in the drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.

[0030] The image hair dyeing special effect processing method provided by this application aims to fade the hair area of the target avatar by adjusting the grayscale and brightness, and then add the target color to the hair area of the initial special effect image after the fading process to generate the hair dyeing special effect processing result corresponding to the target color. Thus, it can apply real and natural hair dyeing special effects to avatar hair colors with different saturations, enabling the hair dyeing special effect to retain more details of the original hair.

[0031] With the continuous development of short video and live broadcast scenarios, in order to improve the user experience, many novel special effect gameplay methods have emerged. The hair dyeing special effect is one of the most interesting and interactive special effects. Users can experience virtual hair dyeing in real time with natural and realistic effects by applying different hair dyeing special effects. The hair dyeing special effect in the live broadcast scenario is mainly realized through real-time image processing technology. This technology is based on computer vision and deep learning algorithms, which can accurately identify and track the hair area of users, and then apply effects such as color transformation or texture overlay on this basis to achieve the visual effect of virtual hair dyeing.

[0032] Among them, through deep learning, the algorithm can accurately separate the hair from other areas, which is a key step in realizing the hair dyeing special effect. In the process of hair dyeing special effect processing, fine image processing technologies such as light rendering and color adjustment are required to achieve a real and natural hair dyeing effect. In addition, in order to improve the realism and naturalness of the hair dyeing special effect, the hair strand details can also be enhanced by means such as image sharpening and adding texture special effects.

[0033] Currently, more and more applications support various high-saturation hair dyeing special effects. Their hair dyeing special effect processing scheme is to apply a dyeing effect based on the color distribution of the avatar's original hair color. The hair dyeing special effect implementation link cannot realistically and naturally dye a color that is much lighter than the user's actual hair color. That is, for users with a relatively high saturation (dark hair color) of the avatar's original hair color, directly applying a dyeing effect on the original hair color is difficult to obtain a hair dyeing special effect with a lower saturation (light hair color). Its hair dyeing effect has low naturalness, cannot retain hair details, and the hair dyeing special effect is not very realistic.

[0034] Obviously, it is very difficult to obtain a hair dyeing effect that retains hair strand details and is natural through simple parameter adjustment in the relevant hair dyeing special effect processing scheme. It cannot dye a light color with low saturation or cannot naturally retain hair strand details. Because it mainly considers how to blend the target hair color on the original hair base color, it does not carefully consider the distribution difference between the original hair base color and the target light hair color. Simply blending once cannot remove the influence of the original dark hair color. Even by adjusting the brightness curve to increase the overall hair color brightness, a natural light hair color cannot be obtained.

[0035] Based on this, an image hair dyeing special effect processing method according to an embodiment of the present application is provided to solve the technical problem of low naturalness of the hair dyeing special effect applied to high-saturation avatars. It can exclude the limitation of the high-saturation original hair color, adapt to avatar hair colors with different saturations to apply the hair dyeing special effect, and produce a natural and realistic hair dyeing effect with hair details.

[0036] Embodiment:

[0037] Figure 1 The flowchart of an image hair dyeing special effect processing method provided by an embodiment of the present application is given. The image hair dyeing special effect processing method provided in this embodiment can be executed by an image hair dyeing special effect processing device. The image hair dyeing special effect processing device can be implemented in software and / or hardware. The image hair dyeing special effect processing device can be composed of two or more physical entities, or can be composed of one physical entity. Generally speaking, the image hair dyeing special effect processing device can be a processing device such as a computer, a mobile phone, or a tablet.

[0038] The following takes the image hair dyeing special effect processing device as the main body for executing the image hair dyeing special effect processing method for description. Refer to Figure 1 and the image hair dyeing special effect processing method specifically includes:

[0039] S110. Obtain a target avatar and a hair mask segmented from the corresponding target avatar.

[0040] In the process of processing the image hair dyeing special effect in the present application, the image hair dyeing special effect processing device receives the avatar picture that needs to apply the hair dyeing special effect uploaded or selected by the user, and defines this avatar picture as the target avatar. For example, in a live broadcast scenario, according to the hair dyeing special effect function triggered by the user, the target avatar of the user is collected in real time through the camera. Then, models such as an AI segmentation model and a deep learning model (such as a semantic segmentation model) are used to process the target avatar, automatically identify and segment the hair area of the target avatar, and generate a hair mask. The hair mask can be a binary image, where the hair area is white (or 1), and other areas are black (or 0). By accurately segmenting the hair area, an accurate basis can be provided for subsequent processing and the processing efficiency can be improved.

[0041] Exemplarily, refer to Figure 2, this application provides a rendering and display process for hair dyeing special effects in scenarios such as real-time live streaming and short videos. For the live video captured by the camera, the target image is obtained from the video frame. Then, the hair segmentation module is used to segment the hair region and non-hair region in real time to obtain the hair mask. Furthermore, the hair dyeing processing module receives the hair mask output by the upper-layer hair segmentation module and the target head image captured by the camera, and applies the corresponding hair dyeing special effects to the hair region based on the image hair dyeing special effect processing method of this application, and outputs the hair dyeing special effect processing result. The hair dyeing special effect processing result output by the hair dyeing processing module will be input to the fusion module, which is mainly used to fuse the hair dyeing special effect processing result and the pre-link rendering output result (beauty makeup result, original image, etc.), and then perform post-processing operations such as inter-frame smoothing and Kalman filtering. Finally, it is rendered and displayed on the screen for the user, so as to realize the rendering and display of the hair dyeing special effect processing result.

[0042] S120. Adjust the grayscale and brightness of the hair region of the target head image based on the target head image and the hair mask to perform a fading process on the hair region of the target head image and generate an initial special effect image.

[0043] Specifically, based on the obtained target head image and the hair mask segmented from the corresponding target head image, the hair dyeing processing module only performs grayscale processing on the hair region of the target head image according to the hair mask to reduce its color saturation. And on the basis of grayscale adjustment, the brightness of the hair region is appropriately adjusted to simulate the fading effect of the hair region of the target head image. The fading effect can be adjusted by setting a brightness attenuation factor and combining it with the target fading degree. Then, the faded hair region is merged with the original target head image to generate the initial special effect image after fading. Through grayscale and brightness adjustment, the saturation of the hair region is effectively reduced, providing a wider color space for subsequent application of hair dyeing special effects. At the same time, the fading process makes the hair dyeing special effect more natural on the hair and reduces the color abruptness.

[0044] Optionally, adjusting the grayscale and brightness of the hair region of the target head image based on the target head image and the hair mask includes:

[0045] Calculate the grayscale curve of the target head image, fuse the set first fading processing color information into the target head image based on the grayscale curve of the target head image to obtain the first image fusion result, and the first fading processing color information is white;

[0046] Convert the target head image into a first grayscale image, adjust the grayscale value of the hair region of the first grayscale image based on the hair mask to obtain the first hair grayscale processing result, and fuse the first hair grayscale processing result with the first image fusion result to obtain the second image fusion result;

[0047] Calculate the brightness curve based on the brightness information of the target avatar, calculate the first hair brightness processing result of the hair area of the target avatar based on the brightness curve and the hair mask of the target avatar, and fuse the first hair brightness processing result with the second image fusion result to obtain the initial special effect image.

[0048] As Figure 3 shown, in this application, by configuring a hair dyeing basic node on the hair dyeing processing module and processing the target avatar based on the hair dyeing basic node, a special effect image with a hair fading effect is generated, which is defined as the initial special effect image. The hair dyeing basic node takes the target avatar collected by the camera and the hair mask from the hair segmentation module as inputs, passes through 3 sub-nodes respectively, and finally obtains the initial special effect image.

[0049] Among them, the first sub-node constructs the grayscale curve of the target avatar. The grayscale curve describes the pixel distribution of different gray levels in the image. At the same time, the set fading processing color information is obtained, which is defined as the first fading processing color information, and the first fading processing color information is white. According to the grayscale curve, white (fading processing color information) is fused into the target avatar to obtain the first image fusion result. The purpose of this step is to fuse the light and dark changes of the target avatar with the first fading processing color information, so that the first image fusion result presents the same gloss change as the hair itself.

[0050] Specifically, calculating the grayscale curve of the target avatar includes:

[0051] Calculate the average grayscale value of the target avatar, obtain the preset grayscale value range adjustment parameter, calculate the grayscale curve of the target avatar based on the average grayscale value and the grayscale value range adjustment parameter. The grayscale value range adjustment parameter is used to adjust the grayscale light and dark changes of the hair area of the target avatar, and the grayscale curve is used to normalize the pixel grayscale of the target avatar.

[0052] The first sub-node calculates the average grayscale value of the pixel points of the input target avatar and uses the formula (1):

[0053] g_scale = clamp(strength * (1 + g_alpha), 0, 1.0) (1)

[0054] The grayscale curve g_scale is calculated. Here, clamp represents the normalization parameter value of (0, 1), and strength is the grayscale value range adjustment parameter, which can be adjusted according to the actual application scenario. It is used to adjust the value range of the grayscale curve so that the first image fusion result can conform to the grayscale brightness change of the first fading processing color information, thereby affecting the display of hair details. g_alpha represents the average grayscale value of the input image pixels. This grayscale curve takes into account the grayscale brightness change of the original input image (target avatar) to fuse the first fading processing color information and the target avatar, so that more of the first fading processing color information is fused in the areas with higher brightness of the target avatar, thus making the final fusion effect present a gloss change consistent with the hair itself. The fusion process of the first fading processing color information and the target avatar is shown in formula (2):

[0055] Blend1 = hair_color * (g_scale) + img_color * (1 - g_scale) (2)

[0056] img_color represents the input target avatar, hair_color represents the hair area of the target avatar, and Blend1 represents the first image fusion result.

[0057] Furthermore, the second child node converts the target avatar into a grayscale image and finely adjusts the hair mask using the grayscale brightness of the target avatar, making the pixel changes in the hair mask smoother. Then, the finely adjusted hair mask is used to fuse the target avatar with the first image fusion result Blend1 output by the previous child node, ensuring that the output only affects the hair area.

[0058] Specifically, formula (3) is used to convert the target avatar from an RGB image to a grayscale image gray, and with the help of the grayscale value of gray, formula (4) is used to finely adjust the hair mask mask. Clamp represents the normalization parameter value of (0, 1). Finally, formula (5) is used to fuse the previous first image fusion result Blend1 with the target avatar and retain the original image information except for the hair area to obtain the second image fusion result Blend2.

[0059] gray = ((0.114 * img_color.z) + (0.587 * img_color.y)) + (0.299 *

[0060] img_color.x) (3)

[0061] mask = clamp((mask * (1.0 - gray)), 0, 1) (4)

[0062] Blend2 = Blend1 * mask + img_color * (1.0 - mask) (5)

[0063] The third child node calculates the brightness curve of the target avatar based on the brightness information of the target avatar. The brightness curve describes the pixel distribution of different brightness levels in the target image. Furthermore, based on the brightness curve of the target avatar and the hair mask, the brightness of the hair area is adjusted to obtain the first hair brightness processing result, so that the brightness of the hair area meets the brightness effect required by the first fading processing color information (white). The first hair brightness processing result is fused with the second image fusion result to obtain the final initial special effect image. By further adjusting the brightness of the hair area on the basis of gray scale adjustment, the special effect image becomes more vivid and realistic.

[0064] Specifically, calculating the brightness curve based on the brightness information of the target avatar includes:

[0065] Convert the target avatar to the LAB space to extract the brightness information of the target avatar, obtain the preset brightness value range adjustment parameter, and calculate the brightness curve of the target avatar based on the brightness information and the brightness value range adjustment parameter. The brightness value range adjustment parameter is used to adjust the brightness change of the hair area of the target avatar.

[0066] Among them, when calculating the brightness curve through the brightness information of the target avatar, use the graphic image conversion formula to convert the target avatar image from the RGB space to the LAB space, so as to facilitate the separation of brightness information. Then use the brightness value range adjustment parameter brightness to adjust the overall brightness threshold, and calculate the brightness curve l_func.0 through the following calculation formula (6):

[0067] l = l / brightness

[0068] l_func.0 = (1.0 / (1.0 + exp(-1.0 * (l / 200.0)))) - 0.5) * 800.0 (6)

[0069] l represents the brightness information in the LAB space, and l_func.0 represents the proposed brightness curve. Furthermore, use this brightness curve l_func.0 to modify the brightness information of the hair area of the target avatar, so that while the overall brightness is uniformly increased, the brightness change is softer and more natural, and the modified brightness curve l_func.1 is obtained. Refer to the following formula (7):

[0070] l_func.1 = l_func.0 * mask + 255.0 * (1.0 - mask) (7)

[0071] Subsequently, the modified brightness curve l_func.1 is applied to Blend2 to adjust the brightness of the hair area (as shown in Formula 7 / 8).

[0072] Blend3 = l_func.1 * Blend2 / 255 (8)

[0073] Blend3 represents the initial special effect image after the fading process. The initial special effect image is processed through the hair dyeing basic node. Based on the gray value and brightness information of the target avatar, the color information (white) after the fading process is fused with the color of the target avatar, so that the subsequent produced hair dyeing effect retains the original light and dark changes of the hair strands of the target avatar itself, making the hair dyeing special effect softer and more natural.

[0074] Optionally, after fusing the first hair brightness processing result and the second image fusion result to obtain the initial special effect image, it further includes:

[0075] Based on the set second fading processing color information and the hair mask, adjust the gray scale and brightness of the hair area of the initial special effect image to perform a secondary fading process on the hair area of the initial special effect image, and the second fading processing color information is white.

[0076] After fusing the first hair brightness processing result and the second image fusion result to obtain the initial special effect image in this application, in order to further refine the fading effect of the hair area, by introducing a secondary fading process, based on the set second fading processing color information (white) and the hair mask, additional gray scale and brightness adjustments are made to the hair area of the initial special effect image.

[0077] The initial special effect image is also adjusted in gray scale and brightness through the above-mentioned hair dyeing basic node, and the specific adjustment process refers to the adjustment process of the above-mentioned target avatar. Through the secondary fading process, the fading effect of the hair area can be further enhanced to make it more in line with the expected visual effect. For example, after the target avatar is processed through the hair dyeing basic node, the hair area of the initial special effect image becomes silver-gray. Further performing a secondary fading process on the initial special effect image, inputting the initial special effect image combined with the hair mask into the hair dyeing basic node, then the hair area of the output initial special effect image will be closer to white, thereby enhancing the fading effect of the hair area. And the secondary fading process helps to make the fading effect more natural and realistic, reducing the color abruptness that may be caused by a single fading process. It should be noted that according to actual needs, the number of fading processes can be adaptively set, and this application does not make a fixed limit on the specific number of fading processes and will not elaborate here.

[0078] S130. Obtain the target color of the hair dyeing special effect to be applied to the target avatar, and based on the target color, adjust the specified parameters of the hair area of the initial special effect image to generate the hair dyeing special effect processing result of the target avatar.

[0079] Finally, based on the initial special effect image after the above fading process, combined with the hair coloring color of the hair coloring special effect that the user selects or inputs and wants to apply, it is defined as the target color. Map the color of the hair area after the fading process to the target color. By adjusting the specified parameters of the hair area of the initial special effect image based on the target color, such as adjusting the hue in the HSV space of the target avatar to match the target color while maintaining a certain saturation and brightness. The adjusted hair area is merged with other areas of the original target avatar again, thereby generating the final result of the hair coloring special effect processing.

[0080] Optionally, the specified parameters include grayscale and brightness;

[0081] Generating the processing result of the hair coloring special effect of the target avatar by adjusting the specified parameters of the hair area of the initial special effect image based on the target color includes:

[0082] Calculate the grayscale curve of the initial special effect image, and fuse the target color into the initial special effect image based on the grayscale curve of the initial special effect image to obtain the third image fusion result;

[0083] Convert the initial special effect image into a second grayscale image, adjust the grayscale value of the hair area of the second grayscale image based on the hair mask to obtain the second hair grayscale processing result, and fuse the second hair grayscale processing result with the third image fusion result to obtain the fourth image fusion result;

[0084] Calculate the brightness curve based on the brightness information of the initial special effect image, calculate the second hair brightness processing result of the hair area of the initial special effect image based on the brightness curve of the initial special effect image and the hair mask, and fuse the second hair brightness processing result with the fourth image fusion result to generate the processing result of the hair coloring special effect of the target avatar.

[0085] Based on the above initial special effect image, this application also adjusts the grayscale and brightness of the target avatar through the above hair coloring basic node to achieve fusing the target color into the initial special effect image. As Figure 4 shown, use the basic hair coloring node to color step by step (bleaching twice + coloring once), thereby dyeing the dark-colored hair of the target avatar to the natural target color (yellow). It should be noted that when adjusting the grayscale and brightness of the target avatar through the hair coloring basic node to achieve fusing the target color into the initial special effect image, the input image is the initial special effect image, and the target color information used is the color required for the final hair coloring special effect, such as yellow.

[0086] Specifically, referring to Figure 5, in the first stage, the basic hair dyeing node takes the target avatar captured by the camera and the hair mask output by the hair segmentation module as inputs. Through one operation of the basic hair dyeing node for fading treatment, the original hair base color of the user is faded to silver gray; then, through another operation of the basic hair dyeing node for fading treatment for secondary fading, the silver gray is faded to white gray; finally, by using the basic hair dyeing node once again to directly apply the target color on the faded white gray, the clear and natural hair dyeing special effect treatment result can be achieved.

[0087] Optionally, the specified parameter includes a pixel value;

[0088] Adjust the specified parameter of the hair area of the initial special effect image based on the target color to generate the hair dyeing special effect treatment result of the target avatar, including:

[0089] Based on the linear light blending mode, combine the pixel values of the target color and the initial special effect image to generate the hair dyeing special effect treatment result of the target avatar.

[0090] As Figure 6 shown, different from the above technical solution of adding the target color by using the basic hair dyeing node to adjust the grayscale and brightness of the avatar, after completing the fading treatment of the target avatar through the basic hair dyeing node, the present application can also apply the target color to the hair area of the initial special effect image by linearly adding the target color, that is, one fading treatment + one coloring operation, and use the linear light blending mode to make the coloring effect softer and clearer. Specifically, referring to Figure 7 , in the first stage, the basic hair dyeing node takes the target avatar captured by the camera and the hair mask output by the hair segmentation module as inputs, and performs a fading treatment operation through the basic hair dyeing node once. In the second stage, by using the linear light blending mode to perform pixel-level enhancement of the hair area of the initial special effect image to increase the overall brightness, the hair dyeing special effect treatment result is fused.

[0091] Among them, the linear light blending mode directly blends the initial special effect image (base) and the target color (blend) using formulas (9) and (10) as follows, which can save a series of calculations of brightness and grayscale information consumption and also achieve the clear and natural effect of the hair.

[0092]

[0093] BlendLinearBurnf(base,blend) = max(base + blend - 1.0,0.0) (10)

[0094] BlendLinearDodge(base,blend)=min(base+blend,1.0)

[0095] Among them, x represents different pixel values of the initial special effect image.

[0096] Finally, through color mapping and parameter adjustment, the authenticity and naturalness of the hair dyeing special effect on the hair are ensured. The final processing result retains the details and texture of the hair, making the hair dyeing special effect more realistic. It should be noted that the process of adding the target color to the initial special effect image based on the hair dyeing basic node or the linear light blending mode can be executed after one or multiple fading processing operations on the hair dyeing basic node. This application does not make a fixed restriction on the selection of the specific fading processing operation and the coloring operation process, so it will not be elaborated here.

[0097] As described above, by obtaining the target avatar and the hair mask segmented from the corresponding target avatar; adjusting the grayscale and brightness of the hair area of the target avatar based on the target avatar and the hair mask to perform a fading process on the hair area of the target avatar to generate an initial special effect image; obtaining the target color of the hair dyeing special effect to be applied to the target avatar, and adjusting the specified parameters of the hair area of the initial special effect image based on the target color to generate the hair dyeing special effect processing result of the target avatar. By using the above technical means, the hair area of the target avatar is faded by adjusting the grayscale and brightness, and then the target color is added to the hair area of the initial special effect image after the fading process to generate the hair dyeing special effect processing result corresponding to the target color. Thus, by the method of first fading and then adding the target color, a realistic and natural hair dyeing special effect can be applied to the hair colors of avatars with different saturations, enabling the hair dyeing special effect to retain more details of the original hair, improving the processing effect of the hair dyeing special effect, and further enhancing the user experience.

[0098] Based on the above embodiments, Figure 8 This is a schematic structural diagram of an image hair dyeing special effect processing system provided by this application. Refer to Figure 8 This embodiment provides an image hair dyeing special effect processing system which specifically includes: an acquisition module 21, a fading module 22, and an adjustment module 23.

[0099] Among them, the acquisition module 21 is configured to acquire the target avatar and the hair mask segmented from the corresponding target avatar;

[0100] The fading module 22 is configured to adjust the grayscale and brightness of the hair area of the target avatar based on the target avatar and the hair mask to perform a fading process on the hair area of the target avatar to generate an initial special effect image;

[0101] The adjustment module 23 is configured to acquire the target color of the hair dyeing special effect to be applied to the target avatar, and adjust the specified parameters of the hair area of the initial special effect image based on the target color to generate the hair dyeing special effect processing result of the target avatar.

[0102] Specifically, adjusting the grayscale and brightness of the hair area of the target avatar based on the target avatar and the hair mask includes:

[0103] Calculating the grayscale curve of the target avatar, fusing the set first fading color information into the target avatar based on the grayscale curve of the target avatar to obtain the first image fusion result, and the first fading color information is white;

[0104] Converting the target avatar into a first grayscale image, adjusting the grayscale value of the hair area of the first grayscale image based on the hair mask to obtain the first hair grayscale processing result, and fusing the first hair grayscale processing result with the first image fusion result to obtain the second image fusion result;

[0105] Calculating the brightness curve based on the brightness information of the target avatar, calculating the first hair brightness processing result of the hair area of the target avatar based on the brightness curve of the target avatar and the hair mask, and fusing the first hair brightness processing result with the second image fusion result to obtain the initial special effect image.

[0106] Among them, calculating the grayscale curve of the target avatar includes:

[0107] Calculating the average grayscale value of the target avatar, obtaining the preset grayscale value range adjustment parameter, calculating the grayscale curve of the target avatar based on the average grayscale value and the grayscale value range adjustment parameter, and the grayscale value range adjustment parameter is used to adjust the grayscale brightness change of the hair area of the target avatar, and the grayscale curve is used to normalize the pixel grayscale of the target avatar.

[0108] Calculating the brightness curve based on the brightness information of the target avatar includes:

[0109] Converting the target avatar into the LAB space to extract the brightness information of the target avatar, obtaining the preset brightness value range adjustment parameter, calculating the brightness curve of the target avatar based on the brightness information and the brightness value range adjustment parameter, and the brightness value range adjustment parameter is used to adjust the brightness change of the hair area of the target avatar.

[0110] In addition, after fusing the first hair brightness processing result with the second image fusion result to obtain the initial special effect image, it further includes:

[0111] Adjusting the grayscale and brightness of the hair area of the initial special effect image based on the set second fading color information and the hair mask to perform secondary fading processing on the hair area of the initial special effect image, and the second fading color information is white.

[0112] Specifically, the specified parameters include grayscale and brightness;

[0113] Adjusting the specified parameters of the hair area of the initial special effect image based on the target color to generate the hair dyeing special effect processing result of the target avatar, including:

[0114] Calculate the grayscale curve of the initial special effect image, and fuse the target color into the initial special effect image based on the grayscale curve of the initial special effect image to obtain the third image fusion result;

[0115] Convert the initial special effect image into a second grayscale image, adjust the grayscale value of the hair area of the second grayscale image based on the hair mask to obtain the second hair grayscale processing result, and fuse the second hair grayscale processing result with the third image fusion result to obtain the fourth image fusion result;

[0116] Calculate the brightness curve based on the brightness information of the initial special effect image, calculate the second hair brightness processing result of the hair area of the initial special effect image based on the brightness curve of the initial special effect image and the hair mask, and fuse the second hair brightness processing result with the fourth image fusion result to generate the hair coloring special effect processing result of the target avatar.

[0117] On the other hand, the specified parameter includes the pixel value;

[0118] Adjust the specified parameter of the hair area of the initial special effect image based on the target color to generate the hair coloring special effect processing result of the target avatar, including:

[0119] Perform pixel value combination on the target color and the initial special effect image based on the linear light blending mode to generate the hair coloring special effect processing result of the target avatar.

[0120] As described above, by obtaining the target avatar and the hair mask segmented from the corresponding target avatar; adjusting the grayscale and brightness of the hair area of the target avatar based on the target avatar and the hair mask to fade the hair area of the target avatar to generate the initial special effect image; obtaining the target color of the hair coloring special effect to be applied to the target avatar, and adjusting the specified parameter of the hair area of the initial special effect image based on the target color to generate the hair coloring special effect processing result of the target avatar. By adopting the above technical means, the hair area of the target avatar is faded by adjusting the grayscale and brightness, and then the target color is added to the hair area of the faded initial special effect image to generate the hair coloring special effect processing result corresponding to the target color. Thus, by the method of first fading and then adding the target color, a realistic and natural hair coloring special effect is applied to the hair color of the avatar with different saturations, so that the hair coloring special effect can retain more details of the original hair, improve the processing effect of the hair coloring special effect, and further improve the user experience.

[0121] The image hair coloring special effect processing system provided by the embodiments of the present application can be configured to execute the image hair coloring special effect processing method provided by the above embodiments, and has the corresponding functions and beneficial effects.

[0122] On the basis of the above actual example, the embodiments of the present application also provide an image hair coloring special effect processing device, refer to Figure 9, the image hair dyeing special effect processing device includes: a processor 31, a memory 32, a communication module 33, an input device 34, and an output device 35. The memory, as a computer-readable storage medium, can be configured to store software programs, computer-executable programs, and modules, such as the program instructions / modules corresponding to the image hair dyeing special effect processing method described in any embodiment of the present application (for example, the acquisition module, the fading module, and the adjustment module in the image hair dyeing special effect processing system). The communication module is configured to perform data transmission. The processor executes various functional applications and data processing of the device by running the software programs, instructions, and modules stored in the memory, that is, to implement the above-mentioned image hair dyeing special effect processing method. The input device can be configured to receive input digital or character information, and generate key signal inputs related to the user settings and function control of the device. The output device may include a display device such as a display screen. The above-provided image hair dyeing special effect processing device can be configured to execute the image hair dyeing special effect processing method provided in the above embodiment, and has corresponding functions and beneficial effects.

[0123] Based on the above embodiments, an embodiment of the present application further provides a non-volatile computer-readable storage medium. The non-volatile computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are configured to execute an image hair dyeing special effect processing method when executed by a computer processor. The storage medium can be any of various types of memory devices or storage devices. Of course, for the non-volatile computer-readable storage medium provided in the embodiment of the present application, its computer-executable instructions are not limited to the above-mentioned image hair dyeing special effect processing method, and can also execute related operations in the image hair dyeing special effect processing method provided in any embodiment of the present application.

[0124] Based on the above embodiments, an embodiment of the present application further provides a computer program product. Essentially, or the part that contributes to the prior art, or all or part of the technical solution of the present application can be embodied in the form of a software product. The computer program product is stored in a storage medium and includes several instructions for causing a computer device, a mobile terminal, or a processor therein to execute all or part of the steps of the image hair dyeing special effect processing method described in each embodiment of the present application.

Claims

1. A method for processing hair dyeing special effects on an image, characterized in that: include: Obtain a target head image and a hair mask segmented from the target head image; Adjusting the grayscale and brightness of the hair region of the target avatar based on the target avatar and the hair mask to perform fading processing on the hair region of the target avatar to generate an initial special effect image; A target color of the hair dyeing special effect to be applied to the target avatar is obtained, and a specified parameter of the hair area of ​​the initial special effect image is adjusted based on the target color to generate a hair dyeing special effect processing result of the target avatar.

2. The method for processing hair dyeing effects on an image according to claim 1, characterized in that: The step of adjusting the grayscale and brightness of the hair region of the target head portrait based on the target head portrait and the hair mask comprises: Calculating a grayscale curve of the target avatar, and fusing the set first fading color information to the target avatar based on the grayscale curve of the target avatar to obtain a first image fusion result, wherein the first fading color information is white; Converting the target head portrait into a first grayscale image, adjusting the grayscale value of the hair region of the first grayscale image based on the hair mask to obtain a first hair grayscale processing result, and fusing the first hair grayscale processing result with the first image fusion result to obtain a second image fusion result; A brightness curve is calculated based on the brightness information of the target avatar, a first hair brightness processing result of a hair area of ​​the target avatar is calculated based on the brightness curve of the target avatar and the hair mask, and the first hair brightness processing result is fused with the second image fusion result to obtain an initial special effect image.

3. The method for processing hair dyeing effects on an image according to claim 2, characterized in that: The calculating the grayscale curve of the target avatar includes: Calculate the average grayscale value of the target avatar, obtain a preset grayscale value range adjustment parameter, and calculate the grayscale curve of the target avatar based on the average grayscale value and the grayscale value range adjustment parameter, the grayscale value range adjustment parameter is used to adjust the grayscale brightness change of the hair area of ​​the target avatar, and the grayscale curve is used to normalize the pixel grayscale of the target avatar.

4. The method for processing hair dyeing effects on an image according to claim 2, characterized in that: The calculating of the brightness curve based on the brightness information of the target avatar includes: The target avatar is converted into LAB space to extract brightness information of the target avatar, a preset brightness value range adjustment parameter is obtained, and a brightness curve of the target avatar is calculated based on the brightness information and the brightness value range adjustment parameter, wherein the brightness value range adjustment parameter is used to adjust the brightness change of the hair area of ​​the target avatar.

5. The method for processing hair dyeing special effects on an image according to claim 2, characterized in that: After fusing the first hair brightness processing result with the second image fusion result to obtain an initial special effect image, the method further includes: The grayscale and brightness of the hair region of the initial special effect image are adjusted based on the set second fading color information and the hair mask to perform secondary fading on the hair region of the initial special effect image, wherein the second fading color information is white.

6. The method for processing hair dyeing effects according to any one of claims 1 to 5, characterized in that: The specified parameters include grayscale and brightness; The step of adjusting the designated parameters of the hair region of the initial special effect image based on the target color to generate a hair dyeing special effect processing result of the target avatar includes: Calculating a grayscale curve of the initial special effect image, and fusing the target color into the initial special effect image based on the grayscale curve of the initial special effect image to obtain a third image fusion result; Converting the initial special effect image into a second grayscale image, adjusting the grayscale value of the hair region of the second grayscale image based on the hair mask to obtain a second hair grayscale processing result, and fusing the second hair grayscale processing result with the third image fusion result to obtain a fourth image fusion result; A brightness curve is calculated based on the brightness information of the initial special effects image, a second hair brightness processing result of the hair area of ​​the initial special effects image is calculated based on the brightness curve of the initial special effects image and the hair mask, and the second hair brightness processing result is fused with the fourth image fusion result to generate a hair dyeing special effects processing result of the target avatar.

7. The method for processing hair dyeing effects on an image according to any one of claims 1 to 5, characterized in that: The specified parameters include pixel values; The step of adjusting the designated parameters of the hair region of the initial special effect image based on the target color to generate a hair dyeing special effect processing result of the target avatar includes: The target color and the initial special effect image are combined in pixel value based on a linear light mixing mode to generate a hair dyeing special effect processing result of the target avatar.

8. An image hair dyeing special effects processing system, characterized in that: include: An acquisition module configured to acquire a target head image and a hair mask segmented from the target head image; a fading module, configured to adjust the grayscale and brightness of the hair region of the target avatar based on the target avatar and the hair mask, so as to perform fading processing on the hair region of the target avatar and generate an initial special effect image; The adjustment module is configured to obtain a target color of the hair dyeing special effect to be applied to the target avatar, adjust the specified parameters of the hair area of ​​the initial special effect image based on the target color, and generate a hair dyeing special effect processing result of the target avatar.

9. An image hair dyeing special effects processing device, characterized in that: include: memory and one or more processors; The memory is configured to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the image hair dyeing special effects processing method as described in any one of claims 1-7.

10. A non-volatile computer-readable storage medium, characterized in that: The non-volatile computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a computer processor, they are configured to execute the image hair dyeing special effects processing method as described in any one of claims 1-7.

11. A computer program product, characterized in that The computer program product includes instructions, and when the instructions are executed on a computer or a processor, the computer or the processor executes the image hair dyeing special effects processing method as described in any one of claims 1-7.