Hierarchical rendering method, device and equipment for portrait image

By using intelligent differentiated color rendering technology, a neural network is used to generate portrait segmentation masks and scene identifiers, and filters are matched for parallel rendering. This solves the problems of lost portrait details and fragmented color styles in existing technologies, and achieves professional-grade image beautification effects with rich color layers and prominent subjects.

CN121482237APending Publication Date: 2026-02-06GUANGZHOU MENGDONG INFORMATION TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202511682661.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-17
Publication Date
2026-02-06

AI Technical Summary

Technical Problem

Existing image processing technologies cannot effectively preserve portrait details under complex lighting conditions, resulting in the subject not being prominent enough and background details being lost. Furthermore, after layered processing, the portrait and background colors and styles are disconnected, and the edge transitions are harsh.

Method used

By performing intelligent and correlated differentiated color rendering on portraits and backgrounds, a neural network model is used to generate portrait segmentation masks and scene type identifiers. Foreground and background filters are matched and rendered in parallel. Transparency gradient processing is performed during the fusion process to ensure color harmony.

Benefits of technology

It effectively preserves portrait details under complex lighting conditions, optimizes skin tone, ensures appropriate background atmosphere, and achieves professional-grade beautification effects with rich color layers and prominent subject, avoiding a harsh look. It is highly automated and lowers the barrier to entry for users.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121482237A_ABST
    Figure CN121482237A_ABST
Patent Text Reader

Abstract

The invention relates to a hierarchical rendering method, device and equipment for a portrait image, and belongs to the technical field of image processing, and the method, device and equipment can effectively retain the details of the portrait and optimize the skin color under a complex illumination condition through the intelligent and correlated differential color rendering of the portrait and the background, and at the same time can ensure that the background atmosphere is properly foiled, thereby improving the user experience. Finally, a professional beautification effect with rich color levels and prominent subjects is obtained, and the defect of poor universality of picture beautification in the prior art is overcome. Besides, by establishing a matching relationship for the foreground rendering strategy and the background rendering strategy, coordination and unification of styles of the foreground rendering strategy and the background rendering strategy after hierarchical processing are ensured, so that the final synthesized image is natural in transition, and the stiff feeling brought by a traditional local adjustment technology is avoided. The whole process is high in automation degree, a user can complete professional image beautification without manually adjusting complex parameters, the use threshold is remarkably reduced, meanwhile, the processing efficiency is high, and smooth user experience can be provided.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image processing, in particular to a layered rendering method, device and equipment for portrait images. BACKGROUND

[0002] With the popularity of mobile Internet and visual social media, users' demand for image beautification is growing, which has developed from simple global filter application to pursuit of more professional layered toning and subject highlighting effect.

[0003] In the prior art, one common image processing method is global filter technology. This technology applies uniform color transformation to all pixels in the image. However, this global processing method cannot distinguish the color needs of the portrait subject and the background in the image, often leading to color flattening of the picture and insufficient highlighting of the portrait subject. Especially in complex lighting scenes such as backlight, it is easy to cause the portrait face to be too dark, and the background details are also lost.

[0004] Another type of technology is local adjustment technology based on portrait segmentation. This technology can separate and process the portrait and the background, but its adjustment dimension is relatively single, usually limited to simple brightness enhancement, background blurring or replacement of the portrait or the background. This way lacks targeted and layered color style design, which easily leads to color style fragmentation of the portrait and the background, hard edge transition, and unnatural "paste feeling".

[0005] Therefore, the prior art has the technical problem of poor image beautification universality and inability to meet user needs. SUMMARY

[0006] Therefore, the present application aims to provide a layered rendering method, device and equipment for portrait images to overcome the problem of poor image beautification universality and inability to meet user needs.

[0007] To achieve the above purpose, the present application adopts the following technical solutions: On the one hand, a layered rendering method for portrait images comprises: Step 1: obtaining a to-be-processed image and performing analysis and processing on the to-be-processed image to generate a portrait segmentation mask, a scene type identifier and a lighting parameter; Step 2: separating the to-be-processed image into at least one foreground portrait layer and one background layer according to the portrait segmentation mask; Step 3: matching a foreground rendering filter for the foreground portrait layer and a background rendering filter for the background layer in a pre-set associated filter library based on the scene type identifier and the lighting parameter, wherein the background rendering filter is color coordinated with the foreground rendering filter; Step four, using the matched foreground rendering filter and the background rendering filter, rendering the foreground portrait layer and the background layer in parallel to obtain a rendered foreground portrait layer and a rendered background layer; Step five, fusing the rendered foreground portrait layer and the rendered background layer to generate a target image.

[0008] Optionally, the analysis and processing of the to-be-processed image to generate a portrait segmentation mask, a scene type identifier, and a lighting parameter include: performing pixel-level segmentation on the to-be-processed image using a neural network model to generate the portrait segmentation mask; when the to-be-processed image is a static image, directly outputting the portrait segmentation mask; when the to-be-processed image is a frame image in a video sequence, performing temporal smoothing processing on the portrait segmentation mask of the current frame using the segmentation result of the previous frame to optimize the continuity of the segmentation edge; synchronously identifying the scene type identifier and calculating the lighting parameter by analyzing the global features of the to-be-processed image.

[0009] Optionally, the separation of the to-be-processed image into at least one foreground portrait layer and one background layer according to the portrait segmentation mask includes: dividing a high-confidence pixel region in the portrait segmentation mask into the foreground portrait layer; dividing a low-confidence pixel region in the portrait segmentation mask into the background layer; performing feathering processing on a transition region in the portrait segmentation mask and attributing it to the foreground portrait layer.

[0010] Optionally, the matching of a foreground rendering filter for the foreground portrait layer and a background rendering filter for the background layer based on the scene type identifier and the lighting parameter in a preset associated filter library includes: querying a preset associated filter library, the associated filter library containing multiple groups of preconfigured filter combinations, each filter combination consisting of a foreground rendering filter and a background rendering filter; wherein the foreground rendering filter is configured with a first group of color and light parameters optimized for portraits, and the background rendering filter is configured with a second group of color and light parameters that are color coordinated with the first group of parameters and used to enhance the atmosphere; selecting the filter combination corresponding to the scene type identifier and the lighting parameter from the associated filter library to complete the matching to obtain the matched foreground rendering filter and the background rendering filter.

[0011] Optionally, the step of using the matching foreground rendering filter and the background rendering filter to perform parallel rendering of the foreground portrait layer and the background layer includes: rendering the foreground portrait layer using the matching foreground rendering filter, and rendering the background layer using the matching background rendering filter. The step of rendering the foreground portrait layer using the matching foreground rendering filter includes: Load the basic filter parameters corresponding to the scene type identifier; During the rendering process using the basic filter parameters, real-time feature analysis is performed on the foreground portrait layer to extract at least one portrait feature index. The extracted portrait feature indicators are compared with a preset target effect range; Based on the comparison results, dynamic adjustment instructions for the basic filter parameters are generated, and the rendering effect is optimized in real time according to the instructions. The step of rendering the background layer using the matching background rendering filter includes: Load the basic parameters of the background rendering filter that match the scene type identifier and the foreground rendering filter; During the rendering process using the aforementioned basic parameters, real-time feature analysis is performed on the background layer to extract at least one background atmosphere feature index. The extracted background atmosphere feature indicators are compared with a preset background effect target range; Based on the comparison results, dynamic adjustment instructions for the background rendering filter parameters are generated, and the rendering effect of the background layer is optimized in real time according to the instructions.

[0012] Optionally, after step two and before step four, a detailed portrait rendering is also included; the detailed portrait rendering includes: The foreground portrait layer is subjected to face analysis to identify and segment multiple face component sub-regions, including the lip region and the eye region; A face component processing mapping table is established, which defines differentiated rendering parameter adjustment strategies for different face component sub-regions; During the rendering process of the foreground portrait layer, based on the face component processing map, a first set of rendering parameters aimed at enhancing the rosiness of the lip area is applied, and a second set of rendering parameters aimed at improving the clarity of the eye area is applied.

[0013] Optionally, the process of generating the scene type identifier includes: Scene semantic recognition is performed on the image to be processed, and an emotional semantic label is output. The emotional semantic label is used to characterize the overall emotional atmosphere of the image to be processed. The specific steps of matching the foreground rendering filter include: based on the emotional semantic tag, selecting a combination of the foreground rendering filter and the background rendering filter that is consistent with the emotional atmosphere represented by the emotional semantic tag from the associated filter library.

[0014] Optionally, the step of merging the rendered foreground portrait layer with the rendered background layer includes: The rendered foreground portrait layer is overlaid on the rendered background layer, wherein the non-transparent pixels of the foreground portrait layer directly cover the corresponding pixels of the background layer; For the edge transition area of ​​the foreground portrait layer, the pixel color values ​​of the foreground portrait layer and the background layer at corresponding positions are weighted and blended based on the transparency gradient defined by the original portrait segmentation mask; A global color consistency calibration is performed on the merged overall image to eliminate color temperature and white balance differences between the portrait and the background that may be caused by the layered processing.

[0015] On another front, a layered rendering device for portrait images includes: The processing module is used to acquire the image to be processed, analyze and process the image to generate a portrait segmentation mask, scene type identifier and lighting parameters; The separation module is used to separate the image to be processed into at least one foreground portrait layer and one background layer based on the portrait segmentation mask. The matching module is used to match a foreground rendering filter for the foreground portrait layer from a preset associated filter library based on the scene type identifier and lighting parameters, and to match a background rendering filter with a color that coordinates with the foreground rendering filter for the background layer. The rendering module is used to render the foreground portrait layer and the background layer in parallel using the matching foreground rendering filter and the background rendering filter, so as to obtain the rendered foreground portrait layer and the rendered background layer. The fusion output module is used to fuse the rendered foreground portrait layer with the rendered background layer to generate a target image.

[0016] On another front, a layered rendering device for portrait images includes a processor and a memory, wherein the processor is connected to the memory. The processor is used to call and execute the program stored in the memory; The memory is used to store the program, which is used at least for the layered rendering method of portrait images described in any of the preceding claims.

[0017] Compared with existing technologies, the technical solution provided in this application has the following beneficial effects: By performing intelligent and correlated differentiated color rendering on portraits and backgrounds, this application can effectively preserve portrait details and optimize skin tone under complex lighting conditions, while ensuring that the background atmosphere is appropriately enhanced, ultimately achieving a professional-grade beautification effect with rich color layers and a prominent subject, overcoming the shortcomings of poor universality in image beautification in existing technologies. Furthermore, by establishing a matching relationship between foreground and background rendering strategies, the coordination and unity of their styles after layered processing are ensured, resulting in a natural transition in the final synthesized image and avoiding the harshness brought about by traditional local adjustment techniques. The entire process is highly automated; users can complete professional-grade image beautification without manually adjusting complex parameters, significantly lowering the barrier to entry, while also providing a smooth user experience due to its high processing efficiency. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a schematic flowchart of a layered rendering method for portrait images provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of the structure of a layered rendering device for portrait images provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of a layered rendering device for portrait images provided in an embodiment of the present invention. Detailed Implementation

[0020] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be described in detail below. Obviously, the described embodiments are merely some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other implementation methods obtained by those skilled in the art without creative effort are within the scope of protection of this invention.

[0021] As described in the background section, a common image processing method in the prior art is global filtering. This technique applies a uniform color transformation to all pixels in an image. However, this global processing method cannot distinguish the differences in color requirements between the subject and the background in an image, often resulting in flattened colors and an insufficiently prominent subject. Especially in complex lighting scenes such as backlighting, it can easily cause the subject's face to be too dark, while background details are also lost.

[0022] Another type of technology is local adjustment based on portrait segmentation. This technology can separate the portrait from the background for processing, but its adjustment dimensions are relatively simple, usually limited to simple brightness enhancement, background blurring, or replacement of the portrait or background. This approach lacks targeted, layered color style design, which can easily lead to a disconnect between the color style of the portrait and the background, harsh edge transitions, and an unnatural "pasted" feel.

[0023] Therefore, existing technologies suffer from poor universality in image enhancement and fail to meet user needs.

[0024] Based on this, embodiments of the present invention provide a layered rendering method, apparatus, and device for portrait images. By performing intelligent and correlated differentiated color rendering on the portrait and background, it effectively preserves portrait details and optimizes skin tone under complex lighting conditions, while ensuring the background atmosphere is appropriately enhanced. Ultimately, it achieves a professional-grade beautification effect with rich color layers and a prominent subject, overcoming the shortcomings of poor universality in existing image beautification techniques. Furthermore, by establishing a matching relationship between the foreground and background rendering strategies, it ensures the harmony and unity of their styles after layered processing, resulting in a natural transition in the final synthesized image and avoiding the harshness of traditional local adjustment techniques. The entire process is highly automated; users can complete professional-grade image beautification without manually adjusting complex parameters, significantly lowering the barrier to entry. Simultaneously, it offers high processing efficiency and a smooth user experience.

[0025] Figure 1 This is a flowchart illustrating a layered rendering method for portrait images provided in an embodiment of the present invention. This method can achieve accurate analysis, layered processing, collaborative rendering, and seamless fusion of portrait images in an integrated and automated process, and is particularly suitable for processing images under complex lighting conditions such as backlighting and night scenes.

[0026] Please see Figure 1 This embodiment may include the following steps: S101. Obtain the image to be processed, and analyze and process the image to generate a portrait segmentation mask, scene type identifier, and lighting parameters; In a specific application scenario, users can take a real-time photo using the camera of an electronic device or select an existing still image from their local photo album as the image to be processed. For example, a user might select a backlit portrait photo taken at dusk, which serves as the input data (the image to be processed) for analysis. The input image to be processed undergoes comprehensive analysis to extract key information needed for subsequent processing, including portrait segmentation masks, scene type identifiers, and lighting parameters.

[0027] The image to be processed can be analyzed and processed using a lightweight deep learning neural network model. This model has been trained on a large amount of portrait data and is capable of performing pixel-level semantic segmentation of images. When the image to be processed is input, the model classifies each pixel in the image to determine whether it belongs to "portrait" or "background". The output of the model is a single-channel grayscale image of the same size as the original image, i.e., a portrait segmentation mask. In this mask, the grayscale value of each pixel (e.g., from 0 to 255) represents the confidence level that the pixel belongs to a portrait. For example, pure white (255) indicates 100% certainty of a portrait, pure black (0) indicates 100% certainty of a background, and gray values ​​in the middle represent edge areas with higher uncertainty, such as hair strands, semi-transparent clothing, etc.

[0028] In some embodiments, the step of analyzing and processing the image to be processed to generate a portrait segmentation mask, a scene type identifier, and lighting parameters includes: The image to be processed is segmented at the pixel level using a neural network model to generate the portrait segmentation mask; When the image to be processed is a static image, the portrait segmentation mask is output directly; When the image to be processed is a frame image in a video sequence, the segmentation result of the previous frame is used to perform temporal smoothing processing on the portrait segmentation mask of the current frame in order to optimize the continuity of the segmentation edges. By analyzing the global features of the image to be processed, the scene type identifier is identified simultaneously and the lighting parameters are calculated.

[0029] For example, when the image to be processed is a single frame from a video stream, temporal smoothing can be used to avoid jitter or flickering in the segmentation results between consecutive frames. Specifically, the segmentation results of the previous frame or several frames can be cached, and the portrait segmentation mask calculated for the current frame can be corrected using algorithms such as Kalman filtering or a simple weighted average. This temporal smoothing process can significantly optimize the consistency of segmentation edges in the temporal dimension, resulting in a more stable and natural final rendered video. If the image to be processed is a static image, the currently calculated portrait segmentation mask can be used directly.

[0030] While performing portrait segmentation, the global features of the image can be analyzed in parallel to identify scene types and calculate lighting parameters. Scene type identification can be accomplished through another classification neural network model, which can identify various preset scene types such as "outdoor backlight," "indoor warm light," "night scene," "beach," and "snow scene," and output a scene type identifier. The calculation of lighting parameters does not necessarily require a complex model; it can be achieved by analyzing the image's brightness histogram. For example, by calculating the mean, variance, peak position, highlight area proportion, and shadow area proportion of the histogram, a series of quantified lighting parameters can be obtained, such as the overall brightness mean, contrast, highlight clipping degree, and shadow detail level. In the backlight photo of this embodiment, the scene type identifier may be output as "backlight outdoor," and the corresponding lighting parameters may be calculated, such as a brightness mean of 45 (within a range of 0-255), low contrast, and high shadow proportion.

[0031] S102. Based on the portrait segmentation mask, the image to be processed is separated into at least one foreground portrait layer and one background layer.

[0032] For example, the image to be processed can be separated based on the portrait segmentation mask to obtain a foreground portrait layer and a background layer.

[0033] In some embodiments, separating the image to be processed into at least one foreground portrait layer and one background layer based on the portrait segmentation mask includes: The high-confidence pixel region in the portrait segmentation mask is divided into the foreground portrait layer; The low-confidence pixel region in the portrait segmentation mask is divided into the background layer; The transition region in the portrait segmentation mask is feathered and then assigned to the foreground portrait layer.

[0034] Specifically, two confidence thresholds can be set, such as a high confidence threshold (e.g., 0.7) and a low confidence threshold (e.g., 0.3). For regions in the portrait segmentation mask where pixel values ​​(normalized to the 0-1 range) are greater than or equal to the high confidence threshold, the corresponding pixels in the image to be processed are completely copied to their corresponding positions in the foreground portrait layer, while their corresponding positions in the background layer are set to completely transparent. Conversely, for regions where the mask values ​​are less than or equal to the low confidence threshold, the corresponding pixels in the image to be processed are copied to the background layer, while their corresponding positions in the foreground portrait layer are set to completely transparent.

[0035] For pixel regions with mask values ​​between the low-confidence threshold and the high-confidence threshold, this area typically represents the edges of a portrait (such as hair strands). To achieve a natural blending effect, this transitional region is feathered. Specifically, pixels in this region are assigned to the foreground portrait layer, but their opacity (alpha channel value) is no longer completely opaque; instead, it is mapped based on their original confidence value in the portrait segmentation mask. For example, a pixel with a confidence of 0.5 might have its opacity set to 50% in the foreground portrait layer. This processing preserves the semi-transparency information of the edges, laying the foundation for subsequent blending steps.

[0036] As an alternative, a Gaussian blur with a radius of 1 to 2 pixels can be applied to this edge area to make its transparency change smoother.

[0037] S103. Based on the scene type identifier and lighting parameters, match a foreground rendering filter for the foreground portrait layer from the preset associated filter library, and match a background rendering filter with color coordination with the foreground rendering filter for the background layer.

[0038] For example, an associated filter library can be pre-stored. This library does not simply contain isolated filters, but consists of multiple pre-designed filter combinations. Each filter combination contains a foreground rendering filter (e.g., a first portrait strategy) and a background rendering filter with coordinated colors (e.g., a first background strategy), and they are bound together by a matching relationship.

[0039] In some embodiments, the step of matching a foreground rendering filter for the foreground portrait layer from a preset associated filter library based on the scene type identifier and lighting parameters, and matching a background rendering filter with color coordination with the foreground rendering filter for the background layer, includes: Query a pre-configured associated filter library, which contains multiple pre-configured filter combinations, each of which consists of a foreground rendering filter and a background rendering filter; The foreground rendering filter is configured with a first set of color and lighting parameters optimized for portraits, and the background rendering filter is configured with a second set of color and lighting parameters that coordinate with the first set of parameters and are used to enhance the atmosphere. From the associated filter library, select the filter combination corresponding to the scene type identifier and lighting parameters to complete the matching, and obtain the matched foreground rendering filter and background rendering filter.

[0040] For example, the parameter configuration of the foreground rendering filter (i.e., the strategy in the portrait rendering strategy library) is mainly geared towards portrait optimization. This includes color lookup tables specifically for correcting and beautifying skin tones, lighting adjustment parameters for enhancing facial contours, and sharpening and noise reduction settings for preserving portrait details. Conversely, the parameter configuration of the background rendering filter (i.e., the strategy in the background rendering strategy library) is primarily used to enhance the scene's atmosphere and ensure that its hue, saturation, and brightness relationships remain harmonious and consistent with the portrait style processed by the corresponding foreground filter.

[0041] In this embodiment, a set of filters specifically designed for processing this scene can be queried and matched in the associated filter library based on the scene type identifier of "backlit outdoor". In this set, the foreground rendering filter matched for the portrait layer is the "backlit repair filter", while the background rendering filter matched for the background layer is the associated "warm-toned background filter".

[0042] The process then moves to the next step: layered rendering.

[0043] S104. Using the matching foreground rendering filter and background rendering filter, the foreground portrait layer and the background layer are rendered in parallel to obtain the rendered foreground portrait layer and the rendered background layer.

[0044] In some embodiments, the step of using the matching foreground rendering filter and the background rendering filter to perform parallel rendering of the foreground portrait layer and the background layer includes: rendering the foreground portrait layer using the matching foreground rendering filter, and rendering the background layer using the matching background rendering filter. The step of rendering the foreground portrait layer using the matching foreground rendering filter includes: Load the basic filter parameters corresponding to the scene type identifier; During the rendering process using the basic filter parameters, real-time feature analysis is performed on the foreground portrait layer to extract at least one portrait feature index. The extracted portrait feature indicators are compared with a preset target effect range; Based on the comparison results, dynamic adjustment instructions for the basic filter parameters are generated, and the rendering effect is optimized in real time according to the instructions. The step of rendering the background layer using the matching background rendering filter includes: Load the basic parameters of the background rendering filter that match the scene type identifier and the foreground rendering filter; During the rendering process using the aforementioned basic parameters, real-time feature analysis is performed on the background layer to extract at least one background atmosphere feature index. The extracted background atmosphere feature indicators are compared with a preset background effect target range; Based on the comparison results, dynamic adjustment instructions for the background rendering filter parameters are generated, and the rendering effect of the background layer is optimized in real time according to the instructions.

[0045] For example, when processing a foreground portrait layer, you can first load the basic parameters of the "Backlight Repair Filter". These basic parameters may include: increasing the midtone brightness of the image by 20% to brighten overly dark areas in the backlight; and increasing the local contrast of shadow areas by 15% to restore details in the shadows.

[0046] It should be noted that in this application, the rendering process does not statically apply these basic parameters. During the application of filters, the rendering module also performs real-time content feature analysis on the foreground portrait layer. Specifically, it calculates at least one portrait feature index, such as the average skin tone value, skin tone saturation, and contrast between highlights and shadows on the face, and then compares these real-time extracted indices with a preset target effect range. For example, the preset healthy skin tone target range may be a specific color range. If the real-time analysis finds that the average skin tone of the current portrait is too cool (the blue component is too high) and exceeds the target range, the system will generate a dynamic adjustment instruction. Based on this instruction, the rendering module will fine-tune the parameters of the "backlight repair filter" in real time. For example, it may adjust the gain of the red channel in the filter's color balance parameters to 1.05, keep the green channel at 1.0, and adjust the gain of the blue channel to 0.95, thereby brightening the skin tone while warming it, making it more natural and rosy. This closed-loop process of dynamic fine-tuning ensures that the rendering result can adapt to the specific portrait content, rather than being uniform.

[0047] Meanwhile, for the background layer, the rendering module applies a matching "warm-toned background filter." Its basic parameters may include: reducing the overall background saturation by 10% to highlight the foreground portrait; adding a vignette effect around the image, such as reducing edge brightness by 15% to enhance focus; and shifting the hue of specific areas like the sky towards warmer tones, such as increasing the output intensity of the orange channel by 10%. Similarly, background rendering can also include dynamic adjustment mechanisms, such as dynamically adjusting the vignette intensity based on the average brightness of the background to avoid over-darkening an already dark background.

[0048] After processing, we obtain a rendered foreground portrait layer and a rendered background layer. Next, in the following steps, we perform layer blending to naturally combine the two processed layers into a single, complete image.

[0049] S105. The rendered foreground portrait layer and the rendered background layer are merged to generate the target image.

[0050] In some embodiments, merging the rendered foreground portrait layer with the rendered background layer includes: The rendered foreground portrait layer is overlaid on the rendered background layer, wherein the non-transparent pixels of the foreground portrait layer directly cover the corresponding pixels of the background layer; For the edge transition area of ​​the foreground portrait layer, the pixel color values ​​of the foreground portrait layer and the background layer at corresponding positions are weighted and blended based on the transparency gradient defined by the original portrait segmentation mask; A global color consistency calibration is performed on the merged overall image to eliminate color temperature and white balance differences between the portrait and the background that may be caused by the layered processing.

[0051] For example, in this embodiment, an edge soft blending algorithm can be used. First, the rendered foreground portrait layer is overlaid on the rendered background layer. For the completely opaque core area in the foreground portrait layer, its pixel value directly covers the corresponding pixel in the background layer. For the edge transition area, pixels with semi-transparency were assigned a weighted average based on their transparency value (Alpha value) in step S103. The final color value C_final of the blended pixels can be calculated using the following formula:

[0052] Among them, C foreground It is the color value of that pixel in the rendered foreground portrait layer, C background α is the color value of the rendered background layer at that pixel, and α is the opacity value of that pixel in the foreground portrait layer (ranging from 0 to 1). To make the transition smoother, a feather (blur) with a radius of 2 pixels can be applied to the alpha channel of the foreground portrait layer before blending.

[0053] After fusion, some optional post-processing operations can be performed. For example, a global color calibration can be performed on the entire merged image to further ensure that the white balance and color temperature of the portrait and background are consistent. In addition, detail enhancement algorithms can be applied, such as applying a 15% sharpening mask to high-frequency detail areas such as hair and eyes to make the image clearer.

[0054] Finally, the target image is output. The final processed image can be displayed on the screen of an electronic device or saved to memory.

[0055] It is understood that by employing the technical solution provided in this invention, through intelligent and correlated differentiated color rendering of the portrait and background, this application can effectively preserve portrait details and optimize skin tone under complex lighting conditions, while ensuring that the background atmosphere is appropriately enhanced. Ultimately, it achieves a professional-grade beautification effect with rich color layers and a prominent subject, overcoming the shortcomings of poor universality in existing image beautification techniques. Furthermore, by establishing a matching relationship between the foreground and background rendering strategies, it ensures the coordination and unity of their styles after layered processing, resulting in a natural transition in the final synthesized image and avoiding the harshness brought about by traditional local adjustment techniques. The entire process is highly automated; users can complete professional-grade image beautification without manually adjusting complex parameters, significantly lowering the barrier to entry. Simultaneously, its high processing efficiency provides a smooth user experience.

[0056] Based on a general inventive concept, and building upon the above embodiments, the present invention also provides another embodiment.

[0057] In some embodiments, after step two and before step four, a detailed portrait rendering is further included; the detailed portrait rendering includes: The foreground portrait layer is subjected to face analysis to identify and segment multiple face component sub-regions, including the lip region and the eye region; A face component processing mapping table is established, which defines differentiated rendering parameter adjustment strategies for different face component sub-regions; During the rendering process of the foreground portrait layer, based on the face component processing map, a first set of rendering parameters aimed at enhancing the rosiness of the lip area is applied, and a second set of rendering parameters aimed at improving the clarity of the eye area is applied.

[0058] In this embodiment, based on the segmentation of the main human figure, a refined segmentation and differentiated processing of the sub-regions inside the human figure is introduced to obtain a higher level of detail fidelity and texture.

[0059] In this embodiment, after obtaining the overall region of the portrait through the segmentation model, an additional portrait parsing model (also known as a face component segmentation or body parsing model) is activated. This model is specifically designed to further identify and segment multiple sub-regions with different semantic and textural features within the determined portrait region. For example, for a half-body portrait photograph, this model can accurately delineate the outlines of sub-regions such as "facial skin," "hair," "eyes," "lips," "eyebrows," and "clothing," and generate a corresponding mask for each sub-region.

[0060] The layer separation steps are basically the same as those in the above embodiments, which still involve separating the image into a foreground portrait layer and a background layer.

[0061] The key difference lies in the layered rendering process. After matching basic rendering strategies (such as the "backlight repair filter" and "warm-toned background filter" in the above embodiments) to the portrait layer and background layer, the rendering module performs a more complex, sub-region-based fine-grained rendering process when processing the foreground portrait layer.

[0062] Specifically, the rendering module first applies a basic "backlight repair filter" to the entire portrait layer to brighten and adjust the lighting. Then, it uses sub-region masks generated by the portrait analysis model to fine-tune the parameters of different sub-regions. This fine-tuning strategy can be defined in a "face component processing map" or a similar configuration structure, which defines specific rendering parameter adjustment strategies for different face component sub-regions.

[0063] For example, the mapping table could contain the following rules: For the "Facial Skin" sub-area: On top of the base filter, an additional process is applied designed to enhance skin tone evenness, such as reducing minor blemishes through bilateral filtering, while ensuring that the intensity of surface blur is limited to a low level to preserve the natural texture of the skin. For the "hair" sub-region: In this area, the local contrast and sharpness parameters are increased by an additional 5-10% to make the edges of the hair strands clearer and the sense of layering stronger, so as to avoid the hair becoming blurry due to the decrease in contrast when brightening the portrait as a whole.

[0064] For the "dark clothing" sub-region: If the system detects that the clothing color is dark, it will determine that the texture details may be lost in backlit scenes. Therefore, it will selectively increase the brightness of the shadow areas in this region, while possibly slightly reducing the saturation, in order to clearly display the folds and texture details of the clothing without affecting the overall visual appeal.

[0065] For the “lips” area: Based on the mapping table, apply the first set of rendering parameters to this area to enhance its rosiness, such as slightly increasing the saturation and brightness of the red channel in this area to make the lips look healthier and more vibrant.

[0066] For the "eye" area: Based on the mapping table, apply a second set of rendering parameters to this area to improve clarity. For example, perform small-scale sharpening on the iris and pupil areas and appropriately brighten the whites of the eyes to make the eyes look brighter and more expressive.

[0067] These refined adjustments to sub-regions are all fine-tuning based on the overall rendering strategy, thus ensuring stylistic consistency. The portrait layer processed in this way will exhibit far superior internal detail compared to a simple uniform treatment. For example, while brightening the face, the texture of the hair and the details of the clothing are well preserved and enhanced.

[0068] Finally, by merging this finely rendered portrait layer with the rendered background layer, the resulting target image will exhibit extremely high image quality and professional-grade detail.

[0069] Based on a general inventive concept, and building upon the above embodiments, the present invention also provides another embodiment.

[0070] In some embodiments, the process of generating the scene type identifier includes: Scene semantic recognition is performed on the image to be processed, and an emotional semantic label is output. The emotional semantic label is used to characterize the overall emotional atmosphere of the image to be processed. The specific steps of matching the foreground rendering filter include: based on the emotional semantic tag, selecting a combination of the foreground rendering filter and the background rendering filter that is consistent with the emotional atmosphere represented by the emotional semantic tag from the associated filter library.

[0071] In this embodiment, in addition to recognizing human faces and physical scenes (such as indoor / outdoor), a deeper semantic understanding is performed on the image content to determine the "emotional tendency" of the scene and generate an emotional semantic label. This semantic understanding can be based on a comprehensive judgment of multimodal information. For example, an object recognition model and a facial expression recognition model can be integrated within the analysis module.

[0072] Suppose the input image is a photo of a birthday party. The object recognition model can identify objects strongly associated with celebrations, such as "cake," "candles," "balloons," and "ribbons." Simultaneously, the facial expression recognition model can detect faces in the image and analyze their expressions as "smiling" or "laughing." The analysis module comprehensively analyzes these recognition results and, based on preset rules or a higher-order semantic model, determines the overall emotional tendency of the scene as "cheerful and lively," generating corresponding emotional semantic labels.

[0073] When performing "match rendering," the system no longer relies solely on physical scene identifiers like "indoor," but instead prioritizes using the emotional semantic tag "cheerful, lively" to query the associated filter library. A "mood-color mapping model" is pre-stored in memory; this model, based on principles of color psychology, associates different emotional tendencies with corresponding color schemes.

[0074] For example, a "cheerful and lively" mood is mapped to a color scheme dominated by high saturation, high brightness, and warm colors (such as orange and yellow). A "tranquil and melancholic" mood is mapped to a color scheme dominated by low saturation, low brightness, and cool colors (such as blue and cyan). A "romantic and warm" mood is mapped to soft pink and purple tones, possibly with a soft-focus effect.

[0075] Based on the query results, the system recommended a high-saturation, warm-toned color scheme for the "cheerful and lively" mood. Therefore, the system selected the filter combination that best matched this color scheme from the associated filter library. Ultimately, a "high-saturation warm-toned filter" was chosen as the foreground rendering strategy for the portrait layer, and a "bright spot atmosphere filter" designed to enhance the joyful atmosphere was matched as the background rendering strategy.

[0076] In subsequent rendering steps, the portrait layer is processed to achieve vibrant colors and healthy, energetic skin tones; the background layer is enhanced with simulated lens flare or dreamy light effects created by decorative string lights, and the overall tone is adjusted to be warmer. The final merged image is not only optimized at the physical level (such as lighting and sharpness) but also greatly enhanced at the emotional level, fully showcasing the joyful atmosphere of the birthday party. This strategy based on emotion mapping achieves a higher level of artistic and personalized processing that goes beyond simple physical scene optimization.

[0077] Based on a general inventive concept, the present invention also provides a layered rendering apparatus for portrait images, used to implement the above-described method embodiments.

[0078] Figure 2 This is a schematic diagram of the structure of a layered rendering device for portrait images provided in an embodiment of the present invention, as shown below. Figure 2 As shown, the apparatus provided in this embodiment of the invention may include the following structure: The processing module 21 is used to acquire the image to be processed, analyze and process the image to be processed, and generate a portrait segmentation mask, scene type identifier and lighting parameters; The separation module 22 is used to separate the image to be processed into at least one foreground portrait layer and one background layer according to the portrait segmentation mask; The matching module 23 is used to match a foreground rendering filter for the foreground portrait layer in a preset associated filter library based on the scene type identifier and lighting parameters, and to match a background rendering filter with color coordination with the foreground rendering filter for the background layer. Rendering module 24 is used to render the foreground portrait layer and the background layer in parallel using the matching foreground rendering filter and the background rendering filter, so as to obtain the rendered foreground portrait layer and the rendered background layer. The fusion output module 25 is used to fuse the rendered foreground portrait layer with the rendered background layer to generate a target image.

[0079] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0080] The technical solution provided in this application has the following beneficial effects: By performing intelligent and correlated differentiated color rendering on portraits and backgrounds, this application can effectively preserve portrait details and optimize skin tone under complex lighting conditions, while ensuring that the background atmosphere is appropriately enhanced. Ultimately, it achieves a professional-grade beautification effect with rich color layers and a prominent subject, overcoming the shortcomings of poor universality in existing image beautification technologies. Furthermore, by establishing a matching relationship between the foreground and background rendering strategies, it ensures the coordination and unity of their styles after layered processing, resulting in a natural transition in the final synthesized image and avoiding the harshness brought by traditional local adjustment techniques. The entire process is highly automated; users can complete professional-grade image beautification without manually adjusting complex parameters, significantly lowering the barrier to entry. At the same time, it offers high processing efficiency and a smooth user experience.

[0081] Based on a general inventive concept, the present invention also provides a layered rendering device for portrait images, used to implement the above-described method embodiments.

[0082] Figure 3 This is a schematic diagram of the structure of a layered rendering device for portrait images according to an embodiment of the present invention. (See attached diagram.) Figure 3 The device provided in this embodiment of the invention may include: a processor 31 and a memory 32, wherein the processor is connected to the memory. The processor is used to call and execute the program stored in the memory; The memory is used to store the program, which is used at least for the layered rendering method of portrait images described in any of the preceding claims.

[0083] It is understood that the same or similar parts in the above embodiments can be referred to each other, and the contents not described in detail in some embodiments can be referred to the same or similar contents in other embodiments.

[0084] It should be noted that in the description of this invention, the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this invention, unless otherwise stated, "a plurality of" means at least two.

[0085] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process, and the scope of the preferred embodiments of the invention includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as will be understood by those skilled in the art to which embodiments of the invention pertain.

[0086] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0087] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.

[0088] Furthermore, the functional units in the various embodiments of the present invention can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.

[0089] The storage media mentioned above can be read-only memory, disk, or optical disk, etc.

[0090] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0091] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.

Claims

1. A layered rendering method for portrait images, characterized in that, include: Step 1: Obtain the image to be processed, and analyze and process the image to generate a portrait segmentation mask, scene type identifier, and lighting parameters; Step 2: Based on the portrait segmentation mask, the image to be processed is separated into at least one foreground portrait layer and one background layer; Step 3: Based on the scene type identifier and lighting parameters, match a foreground rendering filter for the foreground portrait layer from the preset associated filter library, and match a background rendering filter with color coordination with the foreground rendering filter for the background layer. Step 4: Using the matching foreground rendering filter and background rendering filter, render the foreground portrait layer and the background layer in parallel to obtain the rendered foreground portrait layer and the rendered background layer. Step 5: Blend the rendered foreground portrait layer with the rendered background layer to generate the target image.

2. The method according to claim 1, characterized in that, The step of analyzing and processing the image to be processed to generate a portrait segmentation mask, scene type identifier, and lighting parameters includes: The image to be processed is segmented at the pixel level using a neural network model to generate the portrait segmentation mask; When the image to be processed is a static image, the portrait segmentation mask is output directly; When the image to be processed is a frame image in a video sequence, the segmentation result of the previous frame is used to perform temporal smoothing processing on the portrait segmentation mask of the current frame in order to optimize the continuity of the segmentation edges. By analyzing the global features of the image to be processed, the scene type identifier is identified simultaneously and the lighting parameters are calculated.

3. The method according to claim 1, characterized in that, The step of separating the image to be processed into at least one foreground portrait layer and one background layer based on the portrait segmentation mask includes: The high-confidence pixel region in the portrait segmentation mask is divided into the foreground portrait layer; The low-confidence pixel region in the portrait segmentation mask is divided into the background layer; The transition region in the portrait segmentation mask is feathered and then assigned to the foreground portrait layer.

4. The method according to claim 1, characterized in that, The step of matching a foreground rendering filter for the foreground portrait layer from a preset associated filter library based on the scene type identifier and lighting parameters, and matching a background rendering filter with color coordination with the foreground rendering filter for the background layer, includes: Query a pre-configured associated filter library, which contains multiple pre-configured filter combinations, each of which consists of a foreground rendering filter and a background rendering filter; The foreground rendering filter is configured with a first set of color and lighting parameters optimized for portraits, and the background rendering filter is configured with a second set of color and lighting parameters that coordinate with the first set of color and lighting parameters and are used to enhance the atmosphere. From the associated filter library, select the filter combination corresponding to the scene type identifier and lighting parameters to complete the matching, and obtain the matched foreground rendering filter and background rendering filter.

5. The method according to claim 1, characterized in that, The step of using the matching foreground rendering filter and the background rendering filter to perform parallel rendering of the foreground portrait layer and the background layer includes: rendering the foreground portrait layer using the matching foreground rendering filter, and rendering the background layer using the matching background rendering filter. The step of rendering the foreground portrait layer using the matching foreground rendering filter includes: Load the basic filter parameters corresponding to the scene type identifier; During the rendering process using the basic filter parameters, real-time feature analysis is performed on the foreground portrait layer to extract at least one portrait feature index. The extracted portrait feature indicators are compared with a preset target effect range; Based on the comparison results, dynamic adjustment instructions for the basic filter parameters are generated, and the rendering effect is optimized in real time according to the instructions. The step of rendering the background layer using the matching background rendering filter includes: Load the basic parameters of the background rendering filter that match the scene type identifier and the foreground rendering filter; During the rendering process using the aforementioned basic parameters, real-time feature analysis is performed on the background layer to extract at least one background atmosphere feature index. The extracted background atmosphere feature indicators are compared with a preset background effect target range; Based on the comparison results, dynamic adjustment instructions for the background rendering filter parameters are generated, and the rendering effect of the background layer is optimized in real time according to the instructions.

6. The method according to claim 1, characterized in that, After step two and before step four, the process includes detailed portrait rendering; the detailed portrait rendering includes: The foreground portrait layer is subjected to face analysis to identify and segment multiple face component sub-regions, including the lip region and the eye region; A face component processing mapping table is established, which defines differentiated rendering parameter adjustment strategies for different face component sub-regions; During the rendering of the foreground portrait layer, based on the face component processing map, a first set of rendering parameters aimed at enhancing the rosiness of the lip area is applied, and a second set of rendering parameters aimed at improving the clarity of the eye area is applied.

7. The method according to claim 1, characterized in that, The process of generating the scene type identifier includes: Scene semantic recognition is performed on the image to be processed, and an emotional semantic label is output. The emotional semantic label is used to characterize the overall emotional atmosphere of the image to be processed. The specific steps of matching foreground rendering filters include: based on the emotional semantic tags, selecting a combination of foreground rendering filters and background rendering filters from the associated filter library that are consistent with the emotional atmosphere represented by the emotional semantic tags.

8. The method according to claim 1, characterized in that, The step of merging the rendered foreground portrait layer with the rendered background layer includes: The rendered foreground portrait layer is overlaid on the rendered background layer, wherein the non-transparent pixels of the foreground portrait layer directly cover the corresponding pixels of the background layer; For the edge transition area of ​​the foreground portrait layer, the pixel color values ​​of the foreground portrait layer and the background layer at corresponding positions are weighted and blended based on the transparency gradient defined by the original portrait segmentation mask; A global color consistency calibration is performed on the merged overall image to eliminate color temperature and white balance differences between the portrait and the background that may be caused by the layered processing.

9. A layered rendering device for portrait images, characterized in that, include: The processing module is used to acquire the image to be processed, analyze and process the image to generate a portrait segmentation mask, scene type identifier and lighting parameters; The separation module is used to separate the image to be processed into at least one foreground portrait layer and one background layer based on the portrait segmentation mask. The matching module is used to match a foreground rendering filter for the foreground portrait layer from a preset associated filter library based on the scene type identifier and lighting parameters, and to match a background rendering filter with a color that coordinates with the foreground rendering filter for the background layer. The rendering module is used to render the foreground portrait layer and the background layer in parallel using the matching foreground rendering filter and the background rendering filter, so as to obtain the rendered foreground portrait layer and the rendered background layer. The fusion output module is used to fuse the rendered foreground portrait layer with the rendered background layer to generate a target image.

10. A layered rendering device for portrait images, characterized in that, It includes a processor and a memory, wherein the processor is connected to the memory: The processor is used to call and execute the program stored in the memory; The memory is used to store the program, which is at least used to execute the layered rendering method for portrait images according to any one of claims 1-8.

Citation Information

Patent Citations

  • Image rendering method and device, electronic equipment and computer readable storage medium

    CN110047122A

  • System and method for generating human-scene integrated picture of mobile terminal based on artificial intelligence

    CN118799207A

  • Special effect video generation method and device, computer equipment and storage medium

    CN119135990A

  • Direct volume rendering in virtual and / or augmented reality

    US20190272027A1

  • Image rendering method and apparatus

    WO2022095757A1