Portrait scene fine-grained hair region segmentation and foreground extraction method and system
Patent Information
- Application Number
- CN202611024342.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-10
- Publication Date
- 2026-10-20
AI Technical Summary
[0003]本发明的目的在于提供一种面向人像场景细粒度毛发区域分割与前景提取方法及系统,以解决现有技术在毛发区域分割中难以准确刻画发丝级细节、在毛发与背景过渡区域容易产生错分漏分及边缘生硬、分割结果与实际毛发边界偏差难以动态修正、以及前景提取质量在不同区域之间波动较大稳定性不足的问题,从而在准确捕捉发丝级细节的基础上,对分割结果与实际毛发边界的偏差进行自适应优化,并保证前景提取质量的稳定性,实现准确、自然且稳定的人像前景提取
[0014]与现有技术相比,本发明通过采集人像场景的图像数据并构建包含毛发纹理、边缘清晰度和前景背景对比度的毛发特征数据集,能够充分捕捉发丝纤细、边缘半透明的细粒度特征,为准确刻画毛发区域奠定基础;通过设置对应毛发边缘分布和前景背景过渡分布的第一监测点组与第二监测点组,分别获取边缘偏差和过渡偏差,并将两者按各自权重系数进行归一化加权得到综合偏差修正量,据此对前景背景融合权重进行更新并确定优化分割结果,使分割结果与实际毛发边界之间的偏差得到动态修正,有效克服了传统方法在过渡区域错分、漏分及边缘生硬的问题,显著提升了发丝级毛发边界的分割精度;通过将人像前景区域划分为多个区域分段并采用模糊控制算法针对各分段的局部差异动态调整处理参数,同时基于分割误差方差和前景透明度波动率生成质量稳定性信息,使前景提取在不同区域之间的质量波动得到有效抑制,提升了前景提取的完整性、自然度和稳定性,从而在光照变化、背景复杂或发色与背景相近等场景下均能获得准确、自然且稳定的人像前景提取效果。
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, specifically to a method and system for fine-grained hair region segmentation and foreground extraction in portrait scenes. Background Technology
[0002] With the widespread adoption of applications such as portrait photography, video calls, virtual backgrounds, and image editing, the precision requirements for foreground extraction in portraits are becoming increasingly stringent. Among these, hair segmentation and extraction have consistently been a critical factor limiting the overall quality. Hair in portrait scenes is characterized by its fine strands, dense density, semi-transparent edges, and intricate interweaving with the background. Its boundaries often exhibit blurred transitions rather than sharp outlines, making it difficult for traditional segmentation methods based on color thresholding or edge detection to accurately depict hair-level details. This leads to issues such as missegmentation, omissions, and harsh edges in the transition areas between hair and background. While some existing semantic segmentation methods can roughly locate hair regions, they typically output fixed segmentation results without further optimization mechanisms for edges and transition areas. In scenarios with varying lighting, complex backgrounds, or hair color similar to the background, there is a significant deviation between the segmentation results and the actual hair boundaries, and it is difficult to dynamically correct this deviation, thus affecting the completeness and naturalness of the foreground extraction. Furthermore, existing methods often use uniform processing parameters when handling different regions, failing to differentiate based on edge sharpness and local differences in segmentation error. This results in significant fluctuations in the quality of foreground extraction across different regions, leading to insufficient stability. Therefore, how to adaptively optimize the deviation between the segmentation result and the actual hair boundary while accurately capturing hair-level details, and ensure the stability of the foreground extraction quality, has become an urgent problem to be solved in this technical field. Summary of the Invention
[0003] The purpose of this invention is to provide a method and system for fine-grained hair region segmentation and foreground extraction in portrait scenes, to solve the problems of existing technologies in hair region segmentation, such as difficulty in accurately depicting hair-level details, easy missegmentation and omission in the transition area between hair and background, harsh edges, difficulty in dynamically correcting the deviation between the segmentation result and the actual hair boundary, and large fluctuations in foreground extraction quality and insufficient stability in different regions. Therefore, based on accurately capturing hair-level details, the method adaptively optimizes the deviation between the segmentation result and the actual hair boundary, and ensures the stability of foreground extraction quality, thereby achieving accurate, natural and stable portrait foreground extraction.
[0004] To achieve the above objectives, this invention provides a method for fine-grained hair region segmentation and foreground extraction in portrait scenes. The method includes the following steps: acquiring image data of the portrait scene and generating a corresponding hair feature dataset; analyzing the hair feature dataset based on a preset hair segmentation model to determine the initial segmentation result of the hair region; obtaining real-time deviation information between the initial segmentation result and the actual hair boundary state, and adaptively optimizing the initial segmentation result based on the deviation information to obtain an optimized segmentation result; and performing foreground extraction processing on the portrait scene based on the optimized segmentation result to generate foreground extraction quality stability information.
[0005] Optionally, the step of collecting image data of a portrait scene and generating a corresponding hair feature dataset includes: acquiring the luminance component, chromaticity component, and local gradient information of a color image of a portrait scene; performing multi-scale feature extraction on the image data, suppressing background texture interference, and extracting hair-level detail-related features; and constructing a hair feature dataset containing hair texture, edge sharpness, and foreground-background contrast based on the extracted features.
[0006] Optionally, the step of analyzing the hair feature dataset based on a preset hair segmentation model to determine the initial segmentation result of the hair region includes: performing semantic segmentation analysis on the hair feature dataset using the preset hair segmentation model to identify the response characteristics and edge blur distribution of the hair region in the portrait scene; generating an initial segmentation result by multi-scale feature fusion based on the response characteristics and edge blur distribution of the hair region; and using the initial segmentation result as the initial segmentation result when it meets the preset segmentation accuracy constraint conditions, otherwise outputting an alarm message indicating segmentation initialization failure.
[0007] Optionally, the step of obtaining real-time deviation information between the initial segmentation result and the actual hair boundary state, and adaptively optimizing the initial segmentation result based on the deviation information to obtain an optimized segmentation result, includes: based on the human hair distribution, setting a first monitoring point group and a second monitoring point group with the initial segmentation result as a reference, wherein the first monitoring point group corresponds to the hair edge distribution and the second monitoring point group corresponds to the foreground-background transition distribution; calculating the segmentation deviation between the initial segmentation result and the first and second monitoring point groups, respectively obtaining edge deviation and transition deviation, and generating real-time deviation information; based on the edge deviation and the transition deviation, performing normalized weighting according to their respective weight coefficients to obtain a comprehensive deviation correction amount, and using the comprehensive deviation correction amount to update the foreground-background fusion weights corresponding to the initial segmentation result, determining the optimized segmentation result based on the updated foreground-background fusion weights; iteratively updating until the segmentation deviation meets a preset convergence threshold to obtain the optimized segmentation result.
[0008] Optionally, updating the foreground-background fusion weights using the comprehensive deviation correction amount further includes: updating the hair edge-related component in the foreground-background fusion weights based on the edge deviation of the first monitoring point group until the edge deviation is balanced; updating the foreground-background transition-related component in the foreground-background fusion weights based on the transition deviation of the second monitoring point group until the transition deviation meets the preset balance condition, and determining the optimized segmentation result.
[0009] Optionally, the step of performing foreground extraction processing on the portrait scene based on the optimized segmentation result to generate foreground extraction quality stability information includes: dividing the portrait foreground region into multiple regional segments according to the changes in edge sharpness and segmentation error change rate in the distribution of hair in the portrait; collecting extraction fluctuation data of each regional segment in real time, and dynamically adjusting the foreground extraction processing parameters using a fuzzy control algorithm based on the differences in extraction fluctuation data between each segment; and calculating a quality stability index based on the segmentation error variance and foreground transparency fluctuation rate according to the adjusted processing parameters to generate quality stability information.
[0010] Optionally, the extracted volatility data includes the segmentation error and foreground transparency of the foreground extraction. The generation of quality stability information for the foreground extraction includes: statistically analyzing the segmentation error and foreground transparency of each region segment, and calculating the variance of the segmentation error and the volatility of the foreground transparency between each segment; if the variance and volatility are both within a preset stability range, then the quality stability information indicates that the foreground extraction is stable; if the variance or volatility exceeds the preset stability range, then the quality stability information indicates that the foreground extraction is unstable, and a dynamic adjustment command is triggered.
[0011] This invention also provides a fine-grained hair region segmentation and foreground extraction system for portrait scenes. The system includes: a data acquisition module for acquiring image data of the portrait scene and generating a corresponding hair feature dataset; a segmentation analysis module for analyzing the hair feature dataset based on a preset hair segmentation model to determine the initial segmentation result of the hair region; a segmentation optimization module for obtaining real-time deviation information between the initial segmentation result and the actual hair boundary state, and adaptively optimizing the initial segmentation result based on the deviation information to obtain an optimized segmentation result; and a foreground extraction module for performing foreground extraction processing on the portrait scene based on the optimized segmentation result to generate foreground extraction quality stability information.
[0012] Optionally, the segmentation optimization module includes: a deviation analysis unit, used to set a first monitoring point group and a second monitoring point group based on the human face hair distribution, corresponding to the hair edge distribution and the foreground-background transition distribution respectively, and calculate the segmentation deviation between the initial segmentation result and each monitoring point group to obtain the edge deviation and the transition deviation respectively; and an optimization calculation unit, used to obtain a comprehensive deviation correction amount by normalizing and weighting the edge deviation and the transition deviation according to their respective weight coefficients, and use the comprehensive deviation correction amount to update the foreground-background fusion weights corresponding to the initial segmentation result, and obtain the optimized segmentation result based on the updated foreground-background fusion weights.
[0013] Optionally, the foreground extraction module includes: a segmentation unit, used to divide the foreground region of the portrait into multiple regional segments based on the changes in edge sharpness and the rate of change in segmentation error in the distribution of hair in the portrait; and a quality assessment unit, used to collect extraction fluctuation data of each regional segment, dynamically adjust the processing parameters of foreground extraction based on a fuzzy control algorithm, and generate quality stability information based on the segmentation error variance and the fluctuation rate of foreground transparency.
[0014] Compared with existing technologies, this invention collects image data of portrait scenes and constructs a hair feature dataset that includes hair texture, edge sharpness, and foreground-background contrast. This dataset can fully capture fine-grained features such as the fineness of hair strands and the semi-transparentness of edges, laying the foundation for accurate hair region characterization. By setting a first monitoring point group and a second monitoring point group corresponding to the hair edge distribution and the foreground-background transition distribution, edge deviation and transition deviation are obtained respectively. These two deviations are then normalized and weighted according to their respective weight coefficients to obtain a comprehensive deviation correction amount. Based on this, the foreground-background fusion weights are updated, and the optimized segmentation result is determined, thus reducing the deviation between the segmentation result and the actual hair boundary. Dynamic correction effectively overcomes the problems of missegmentation, omission, and harsh edges in transition areas of traditional methods, significantly improving the segmentation accuracy of hair boundaries at the hair-thin level. By dividing the portrait foreground region into multiple segments and using a fuzzy control algorithm to dynamically adjust processing parameters for local differences in each segment, and generating quality stability information based on the segmentation error variance and foreground transparency volatility, the quality fluctuation of foreground extraction between different regions is effectively suppressed, improving the integrity, naturalness, and stability of foreground extraction. Thus, accurate, natural, and stable portrait foreground extraction results can be obtained in scenarios with changes in lighting, complex backgrounds, or similar hair color to the background. Attached Figure Description
[0015] Figure 1 The flowchart illustrates the fine-grained hair region segmentation and foreground extraction method for portrait scenes provided by this invention. Figure 2 This is a schematic diagram of the fine-grained hair region segmentation and foreground extraction system for portrait scenes provided by the present invention. Figure 3 This is a flowchart illustrating the adaptive optimization process in the fine-grained hair region segmentation and foreground extraction method for portrait scenes provided by the present invention. Detailed Implementation
[0016] To make the objectives, technical solutions, and advantages of this application clearer, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0017] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0018] To more clearly illustrate the technical solution of the present invention, the present invention will be further described in detail below with reference to specific embodiments. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of the present invention can be combined with each other.
[0019] This embodiment captures detailed hair strands by acquiring portrait scene image data and constructing a hair feature dataset. It dynamically corrects the segmentation results by adaptively optimizing the deviation between the initial segmentation result and the actual hair boundary, improving the segmentation accuracy of hair strand-level boundaries. Furthermore, it generates quality stability information through foreground extraction processing to suppress quality fluctuations between different regions, thereby achieving accurate, natural, and stable portrait foreground extraction results. The method flow of this embodiment can be found in [link to relevant documentation]. Figure 1 This includes steps S1 to S4.
[0020] Collect image data of human portrait scenes to generate corresponding hair feature datasets; In step S1, image data can be acquired through a portrait photography device, a camera on a video call terminal, or existing portrait image files. The acquisition object is a complete portrait scene including the person's hair, face, and background. For example, the acquired image data is represented in the form of a pixel matrix, with each pixel carrying color and brightness information. Understandably, hair in a portrait scene is characterized by fine strands, dense density, semi-transparent edges, and interweaving with the background, often exhibiting blurred boundaries. Therefore, after acquisition, the image data needs to be characterized at the feature level so that subsequent processing can focus on the hair region. Specifically, the acquired image data is characterized by features related to the hair region and organized into a hair feature dataset according to a unified data structure. This allows for the quantification of fine-grained information about the hair region, providing an input basis for subsequent segmentation analysis. Furthermore, the hair feature dataset can be indexed by the spatial location of the image during storage, so that the analysis results can be correlated with specific regions in the image in subsequent steps.
[0021] Based on a preset hair segmentation model, the hair feature dataset is analyzed to determine the initial segmentation result of the hair region. In step S2, the preset hair segmentation model is a pre-trained model capable of distinguishing hairy and non-hairy regions in an image. Before deployment, it has been trained and its parameters fixed using a large number of portrait samples with hair annotations. The training process itself is not part of the processing flow of this embodiment. For example, the model receives a hair feature dataset as input and outputs the response degree of each region in the image as hair, thereby determining the initial segmentation result of the hair region. The initial segmentation result characterizes the approximate range and boundary position of the hair region in the portrait scene. Understandably, due to the semi-transparent and transitional characteristics of hair edges, the initial segmentation result often struggles to accurately match the boundary between the hair strand and the background, resulting in a certain deviation between its boundary and the actual hair boundary. Therefore, the initial segmentation result serves as a benchmark for subsequent adaptive optimization rather than the final result. Furthermore, to ensure the usability of the initial segmentation result, after obtaining it, the degree of agreement between its coverage area and the expected hair region can be checked. If the preset segmentation accuracy requirement is met, the subsequent optimization steps are initiated; otherwise, the segmentation analysis is retried to avoid incorporating significantly deviated segmentation results into subsequent processing.
[0022] The real-time deviation information between the initial segmentation result and the actual hair boundary state is obtained, and the initial segmentation result is adaptively optimized based on the deviation information to obtain an optimized segmentation result; In step S3, the actual hair boundary state refers to the actual boundary between hair and background in a portrait scene, which can be reflected by the color gradient, brightness transition, and local gradient changes of the hair edge in the image. Specifically, the boundary determined by the initial segmentation result is compared with the actual hair boundary state to obtain real-time deviation information. This deviation information reflects the degree to which the initial segmentation result deviates from the actual boundary at the hair edge and foreground-background transition. Further, the initial segmentation result is adaptively optimized based on the real-time deviation information. That is, while maintaining the overall range of the initial segmentation result, dynamic correction is performed on edges and transition areas with large deviations, so that the corrected segmentation boundary gradually fits the actual hair boundary, ultimately obtaining the optimized segmentation result. Understandably, adaptive optimization is a process that continuously adjusts as the deviation information changes. When the deviation gradually decreases and tends to stabilize as optimization progresses, the optimized segmentation result is closer to the real hair boundary at the hair-level detail, thereby overcoming the problems of missegmentation, omission, and harsh edges in the transition area of the initial segmentation result.
[0023] Based on the optimized segmentation results, foreground extraction is performed on the portrait scene to generate foreground extraction quality stability information.
[0024] In step S4, foreground extraction refers to separating the portrait along with its hair area from the background based on the optimized segmentation results, resulting in a portrait foreground without a background. For example, the optimized segmentation results determine the precise boundaries between the hair and human foreground and the background. Based on this, a natural transition is performed at the foreground boundaries, ensuring the extracted foreground remains soft and natural at the hair edges, thereby improving the completeness and naturalness of the foreground extraction. Furthermore, the stability of the extraction effect is evaluated simultaneously with foreground extraction. This involves statistically analyzing the performance of foreground extraction in different regions, examining its consistency across areas such as dense hair areas, edge transition areas, and areas with similar backgrounds, thereby generating quality stability information for foreground extraction. Understandably, quality stability information characterizes the fluctuation of the foreground extraction result across the entire portrait. When the extraction quality of each region tends to be consistent, it indicates that the foreground extraction is stable; conversely, it indicates quality fluctuations and can trigger corresponding adjustments, thus ensuring stable portrait foreground extraction results even under scenarios with changing lighting, complex backgrounds, or hair colors similar to the background.
[0025] In some embodiments, by acquiring the brightness, chromaticity, and local gradient information of the image and performing multi-scale feature extraction, hair-level details are preserved while suppressing background texture interference. This leads to the construction of a hair feature dataset that can comprehensively characterize hair texture, edge sharpness, and foreground-background contrast, laying the foundation for accurate characterization of hair regions in the future.
[0026] Acquire the luminance components, chrominance components, and local gradient information of a color image of a portrait scene; In this step, the acquired color image of the portrait scene undergoes color space conversion to separate the luminance and chrominance components. The luminance component reflects the brightness variations of the image, while the chrominance component reflects the color difference between the hair and the background. Specifically, local gradient information is obtained by calculating the grayscale changes between adjacent pixels, used to characterize the intensity jumps at the edges of the hair strands. Understandably, hair strands are fine and have semi-transparent edges; their difference from the background is often reflected simultaneously in luminance, color, and gradient. Therefore, comprehensively acquiring these three types of information provides a more sufficient basis for depicting the hair area.
[0027] Multi-scale feature extraction is performed on the image data to suppress background texture interference and extract hair-level detail-related features; In this step, multi-scale feature extraction refers to analyzing image data at different scales. Larger scales are used to grasp the overall distribution of hair regions, while smaller scales are used to capture the details of individual hair strands. For example, by comparing features at different scales, hair strand responses that are stable across multiple scales can be preserved, while background textures that only appear at a single scale and are unrelated to hair can be suppressed. This reduces background interference while highlighting hair-level detail-related features.
[0028] Based on the extracted features, a hair feature dataset containing hair texture, edge sharpness, and foreground-background contrast is constructed.
[0029] In this step, based on the extracted hair-level detail features, three types of features are further summarized: hair texture, edge sharpness, and foreground-background contrast. Hair texture represents the direction and density of hair strands, edge sharpness represents the sharpness of hair edges, and foreground-background contrast represents the distinguishability of hair from the background. Specifically, these three types of features are organized into a hair feature dataset according to the spatial location of the image, allowing for a unified expression of fine-grained information on texture, edge, and contrast in the hair region. Understandably, this hair feature dataset comprehensively reflects the key characteristics of the hair region, providing reliable input for determining the initial segmentation results based on a pre-defined hair segmentation model.
[0030] In some embodiments, a semantic segmentation analysis of the hair feature dataset is performed by a preset hair segmentation model to identify the response characteristics and edge fuzzy distribution of the hair region. An initial segmentation result is generated by multi-scale feature fusion, and a segmentation accuracy constraint is applied to the result. This provides an accurate and reliable segmentation benchmark for subsequent adaptive optimization while ensuring the expression of hair-level details.
[0031] The hair feature dataset is semantically segmented using a pre-defined hair segmentation model to identify the response characteristics and edge blur distribution of hair regions in portrait scenes. In this step, semantic segmentation analysis refers to determining whether each spatial location in the hair feature dataset belongs to a hair region or a non-hair region, thereby distinguishing hair from the background at the pixel level. Specifically, hair region response characteristics refer to the strength of the response of the preset hair segmentation model to each location belonging to hair; a stronger response indicates a higher probability that the location belongs to hair. Edge blur distribution refers to the distribution of response intensity that gradually transitions from high to low at the boundary between hair and background. Understandably, because hair strands are thin and the edges are semi-transparent, the response at the hair edge is often not an abrupt change but a gradual transition. Therefore, identifying the edge blur distribution can reflect the degree of blurring of the hair boundary, providing a basis for subsequent processing in the transition region.
[0032] Based on the response characteristics and edge blur distribution of the hair region, multi-scale feature fusion is used to generate the initial segmentation result; In this step, multi-scale feature fusion refers to integrating information reflecting the response characteristics and edge blur distribution of the hair region at different scales. Information at larger scales is used to determine the overall contour of the hair region, while information at smaller scales is used to depict individual hair strands and edge details. For example, information at each scale is fused according to its representational effect on the hair region, ensuring that both the overall contour and hair-level details are considered in the same segmentation result. This generates an initial segmentation result representing the extent and boundary position of the hair region. Understandably, through multi-scale feature fusion, the initial segmentation result can cover the main area of the hair region while preserving hair strand details in areas of edge blur, avoiding the problem of difficulty in simultaneously capturing the overall contour and details at a single scale.
[0033] If the initial segmentation result meets the preset segmentation accuracy constraint, it is used as the initial segmentation result; otherwise, an alarm message indicating that the segmentation initialization failed is output.
[0034] In this step, the preset segmentation accuracy constraint is used as a criterion to measure the usability of the initial segmentation result. It can be set based on the completeness of the hair region coverage and the degree of agreement between the boundary and the expected hair region. Specifically, when the initial segmentation result meets the preset segmentation accuracy constraint, it indicates that the result's representation of the hair region meets the basic requirements for subsequent optimization, and it is output as the initial segmentation result and entered into subsequent processing. When the initial segmentation result does not meet the preset segmentation accuracy constraint, it indicates that the result's representation of the hair region deviates significantly. In this case, an alarm message indicating segmentation initialization failure is output to prompt a re-segmentation analysis or a check of the input. Understandably, by imposing segmentation accuracy constraints and issuing timely alarms when they are not met, it is possible to avoid bringing significantly deviated segmentation results into subsequent adaptive optimization, thereby ensuring the reliability of the overall processing flow.
[0035] In some embodiments, by setting a first monitoring point group and a second monitoring point group corresponding to the hair edge distribution and the foreground-background transition distribution respectively, edge deviation and transition deviation are obtained. These two deviations are then normalized and weighted to obtain a comprehensive deviation correction amount. Based on this, the foreground-background fusion weights are updated, dynamically correcting the deviation between the segmentation result and the actual hair boundary. This significantly improves the segmentation accuracy of hair boundaries at the hair-level detail. The optimization process of this embodiment can be found in [reference needed]. Figure 3 .
[0036] Based on the distribution of human hair, a first monitoring point group and a second monitoring point group are set with the initial segmentation result as the reference. The first monitoring point group corresponds to the hair edge distribution, and the second monitoring point group corresponds to the foreground and background transition distribution. In this step, the distribution of human hair refers to the spatial distribution of hair areas within the portrait scene, which can be represented by the hair area range determined by the initial segmentation results. Specifically, based on the initial segmentation results, several locations along the hair edge at the boundary between hair and non-hair areas are selected as the first monitoring point group to characterize the hair edge distribution; several locations in areas where hair and background intertwine and color and brightness gradually transition are selected as the second monitoring point group to characterize the foreground-background transition distribution. Understandably, deviations at hair edges mainly manifest as misalignments of boundary positions, while deviations at the foreground-background transition mainly manifest as inappropriate transition widths. Therefore, dividing the monitoring points into two groups corresponding to edges and transitions respectively can specifically reflect two different types of deviations, providing a basis for subsequent corrections.
[0037] Calculate the segmentation deviation between the initial segmentation result and the first monitoring point group and the second monitoring point group, respectively obtain the edge deviation of the first monitoring point group and the transition deviation of the second monitoring point group, and generate real-time deviation information; In this step, segmentation deviation refers to the degree of deviation between the boundary determined by the initial segmentation result and the actual hair boundary state at each monitoring point. Specifically, at the first monitoring point group, the edge position of the initial segmentation result is compared with the actual hair edge position to obtain the edge deviation reflecting the degree of boundary misalignment; at the second monitoring point group, the width of the initial segmentation result in the transition region is compared with the actual foreground-background transition width to obtain the transition deviation reflecting the degree of transition mismatch. Furthermore, the edge deviation and transition deviation at each monitoring point are summarized to generate real-time deviation information, so as to reflect the latest situation of the initial segmentation result deviating from the actual boundary at the hair edge and foreground-background transition.
[0038] Based on the edge deviation and the transition deviation, normalize and weight them according to their respective weight coefficients to obtain the comprehensive deviation correction amount. Then, use the comprehensive deviation correction amount to update the foreground and background fusion weights corresponding to the initial segmentation result. Based on the updated foreground and background fusion weights, determine the optimized segmentation result. In this step, the foreground-background blending weight refers to the proportion of the foreground when blending the foreground and background at the hair boundary. A larger value indicates that the area is more likely to be classified as foreground, while a smaller value indicates that the area is more likely to be classified as background. By adjusting this weight, the distribution of foreground and background at the hair boundary can be changed, thereby bringing the segmentation boundary closer to the actual hair boundary. Understandably, edge deviation is measured by the intensity or position of the hair edge, while transition deviation is measured by the width of the transition region. These two measurements are not consistent, and direct addition would not reflect their true contributions. Therefore, both must first be normalized relative to their respective reference values to transform them into comparable dimensionless quantities. Then, they are weighted and summed according to their respective weight coefficients, with the sum of these weight coefficients being one, to ensure that the weighted result represents a reasonable compromise between the two.
[0039] As an optional implementation, the above normalization weighting process can be quantified and the foreground-background fusion weights updated in the following manner, but this embodiment is not limited to this:
[0040] Where αopt is the updated foreground-background fusion weight, αinit is the original foreground-background fusion weight, Δei is the edge deviation of the i-th monitoring point, Δti is the transition deviation of the i-th monitoring point, eref is the reference edge sharpness, tref is the reference transition width, w1 and w2 are the weight coefficients of edge deviation and transition deviation respectively, satisfying w1+w2=1, μ is an adjustment factor used to control the magnitude of a single update, and N is the total number of monitoring points. In the formula, Δei / eref represents the normalization of edge deviation relative to reference edge sharpness, and Δti / tref represents the normalization of transition deviation relative to reference transition width. Both are dimensionless after normalization. They are then multiplied by the weight coefficients, summed, and averaged over all monitoring points to obtain the normalized weighted comprehensive deviation correction. Finally, after scaling by the adjustment factor, it is superimposed on the original foreground-background fusion weight.
[0041] For example, suppose the foreground / background fusion weight before the update is 0.6, the weight coefficient for edge deviation is 0.6, the weight coefficient for transition deviation is 0.4, the adjustment factor is 0.5, the reference edge sharpness is 10 gray levels, the reference transition width is 5 pixels, and the total number of monitoring points is 4. The edge deviations at the four monitoring points are 2, 3, 1, and 2 gray levels respectively, and the transition deviations are 1, 0.5, 1.5, and 1 pixel respectively. Then the normalized weighted deviations of each monitoring point are 0.20, 0.22, 0.18, and 0.20 respectively, and the sum of the four is 0.80. Taking the average, we get 0.20, and multiplying it by the adjustment factor of 0.5, we get a comprehensive deviation correction of 0.10. Based on this, the foreground / background fusion weight before the update is updated from 0.6 to 0.70, indicating that the proportion of the foreground at this point is increased accordingly, and the segmentation boundary moves closer to the actual hair boundary. Furthermore, based on the updated foreground-background fusion weights, the foreground and background at the hair boundary are redistributed to obtain the optimized segmentation result after this update.
[0042] Iterative updates continue until the segmentation deviation meets the preset convergence threshold, yielding optimized segmentation results.
[0043] In this step, a preset convergence threshold is used as the criterion for measuring whether the segmentation deviation has been sufficiently reduced. Specifically, after updating the foreground-background fusion weights once, the edge deviation and transition deviation between the updated segmentation result and the actual hair boundary are recalculated at the first and second monitoring point groups, and normalized weighting and updating are performed again, repeating this iterative process. Understandably, as the iteration progresses, the edge deviation and transition deviation gradually decrease. When the segmentation deviation decreases to no more than the preset convergence threshold, it indicates that the segmentation boundary has sufficiently matched the actual hair boundary. At this point, the iteration is terminated, and the current segmentation result is output as the optimized segmentation result, thereby obtaining a segmentation result that highly matches the real hair boundary at the hair-level detail.
[0044] In some embodiments, based on adaptive optimization, the update of foreground and background fusion weights is divided into two stages, one for the edge and one for the transition. The edge deviation is balanced first, and the transition deviation is balanced later. This avoids the two types of deviations from interfering with each other during the correction process, thereby ensuring the accuracy of hair edges while taking into account the naturalness of the transition area, and further improving the segmentation accuracy of hair-level hair boundaries.
[0045] Based on the edge deviation of the first monitoring point group, the hair edge-related component in the foreground-background fusion weight is updated until the edge deviation is balanced. In this step, the hair edge-related component refers to the portion of the foreground-background fusion weights that directly affects the foreground and background allocation at the hair edge. Specifically, based on the edge deviation of the first monitoring point group, only this hair edge-related component is adjusted to make the edge deviations at each of the first monitoring points more consistent, thus achieving edge deviation balance. Understandably, adjusting the hair edge-related component separately first allows the hair edge position to accurately match the actual hair edge without affecting the transition area, providing a stable benchmark for subsequent adjustments to the transition area.
[0046] Based on the transition deviation of the second monitoring point group, the foreground-background transition-related components in the foreground-background fusion weights are updated until the transition deviation meets the preset equilibrium condition, and the optimized segmentation result is determined.
[0047] In this step, the foreground-background transition-related component refers to the portion of the foreground-background fusion weight that directly affects the foreground and background allocation in the hair-background transition area. Specifically, after the hair edge-related component is updated, the foreground-background transition-related component is adjusted based on the transition deviation of the second monitoring point group, so that the width of the transition area gradually becomes reasonable until the transition deviation at each second monitoring point meets the preset equilibrium condition. Furthermore, because the hair edge-related component and the foreground-background transition-related component are updated in stages, the problem of mutual restraint when the two types of components are adjusted simultaneously is avoided, so that the accuracy of the hair edge and the naturalness of the transition area are both taken into account. The optimized segmentation result determined accordingly is more refined in terms of hair-level details.
[0048] In some embodiments, by dividing the foreground region of the portrait into multiple segments and using a fuzzy control algorithm to dynamically adjust the processing parameters based on the differences in the extracted fluctuation data between each segment, a quality stability index is calculated based on the segmentation error variance and the foreground transparency fluctuation rate, so that the quality fluctuation of foreground extraction between different regions is effectively suppressed and the stability of foreground extraction is improved.
[0049] Based on the changes in edge sharpness and segmentation error rate in the distribution of human hair, the foreground region of the human portrait is divided into multiple segments. In this step, the edge sharpness and segmentation error often vary at different locations within the foreground area of the portrait. For example, areas with dense hair tend to have lower edge sharpness and larger segmentation errors, while the main body area has higher edge sharpness and smaller segmentation errors. Specifically, based on the rate of change in edge sharpness and segmentation error, locations with similar edge sharpness and segmentation errors are grouped into the same segment, while locations with significant differences are grouped into different segments. This divides the foreground area of the portrait into multiple segments, allowing for subsequent processing tailored to the different characteristics of each segment.
[0050] Real-time acquisition of extraction fluctuation data for each region segment, and dynamic adjustment of foreground extraction processing parameters based on the differences in extraction fluctuation data between segments using a fuzzy control algorithm; In this step, the extracted fluctuation data refers to the data reflecting the fluctuations in the extraction effect of each region segment during the foreground extraction process. Specifically, the extracted fluctuation data of each region segment is collected in real time, and the differences in extracted fluctuation data between each segment are calculated. Further, the fuzzy control algorithm is a conventional control method that infers the input quantity based on fuzzy rules and outputs the control quantity. It can be implemented in the following ways, but is not limited to: First, the difference in extracted fluctuation data between each segment is used as the input quantity, and it is mapped to fuzzy levels such as small, moderate, and large according to a preset membership function, i.e., fuzzification processing is performed; then, inference is performed according to the pre-established fuzzy rules, which characterize the correspondence between the fuzzy level of the input quantity and the adjustment direction and magnitude of the processing parameters. For example, when the difference is large, the adjustment magnitude of the processing parameters is increased, and when the difference is moderate, the adjustment magnitude is kept small; finally, the inference result is defuzzified and converted into the specific adjustment amount of the processing parameters, and the processing parameters of foreground extraction are dynamically adjusted accordingly. It can be understood that the fuzzy control algorithm can smoothly adjust the processing parameters when the difference in extracted fluctuation data changes, avoiding sudden changes in the processing parameters that cause drastic fluctuations in the foreground extraction effect.
[0051] Based on the adjusted processing parameters, a quality stability index based on the segmentation error variance and foreground transparency volatility is calculated to generate quality stability information.
[0052] In this step, after foreground extraction is completed according to the adjusted processing parameters, the segmentation error and foreground transparency of each region are statistically analyzed. The segmentation error variance reflects the dispersion of segmentation errors between segments, while the foreground transparency volatility reflects the fluctuation of foreground transparency between segments. Specifically, a quality stability index is calculated based on the segmentation error variance and foreground transparency volatility. The smaller the segmentation error variance and the lower the foreground transparency volatility, the more stable the foreground extraction is, thus generating quality stability information characterizing the degree of quality stability of foreground extraction.
[0053] In some embodiments, the extracted fluctuation data is further defined to include the segmentation error and foreground transparency of the foreground extraction. By comparing the variance of the segmentation error and the volatility of the foreground transparency with a preset stability range, a determination result of whether the foreground extraction is stable or unstable is given. When unstable, a dynamic adjustment instruction is triggered to realize closed-loop monitoring of the foreground extraction quality and ensure the stability of the foreground extraction quality.
[0054] The segmentation error and foreground transparency of each region are statistically analyzed, and the variance of the segmentation error and the volatility of the foreground transparency between each segment are calculated. In this step, the aforementioned extracted fluctuation data includes the segmentation error and foreground transparency. The segmentation error characterizes the deviation between the segmentation result of each region and the actual hair boundary, while the foreground transparency characterizes the transparency of the foreground relative to the background in each region. Specifically, the segmentation error and foreground transparency of each region are statistically analyzed. The variance of the segmentation error between each segment is calculated to reflect the dispersion of the segmentation error, and the volatility of the foreground transparency between each segment is calculated to reflect the fluctuation of the foreground transparency.
[0055] If both the variance and volatility are within the preset stability range, then the quality stability information indicates that the foreground extraction is stable. In this step, the preset stability range is used as the criterion for measuring the stability of foreground extraction. Specifically, when both the variance of the segmentation error and the volatility of the foreground transparency fall within the preset stability range, it indicates that the segmentation error and foreground transparency between different regions are relatively consistent, and the quality fluctuation of foreground extraction across the entire portrait is small. Therefore, the quality stability information is determined as the stability of foreground extraction.
[0056] If the variance or volatility exceeds the preset stability range, the quality stability information indicates that the foreground extraction is unstable, and a dynamic adjustment instruction is triggered.
[0057] In this step, when either the variance of the segmentation error or the volatility of the foreground transparency exceeds the preset stability range, it indicates a significant difference in segmentation error or foreground transparency between different regions, and the quality of foreground extraction fluctuates significantly across different regions. Therefore, the quality stability information is determined to indicate that the foreground extraction is unstable. Furthermore, when foreground extraction is determined to be unstable, a dynamic adjustment command is triggered to prompt a readjustment of the foreground extraction processing parameters, thereby forming a closed-loop monitoring of the foreground extraction quality and ensuring the stability of the foreground extraction quality under various complex scenarios.
[0058] In some embodiments, a fine-grained hair region segmentation and foreground extraction system for portrait scenes, corresponding to the aforementioned method, is also provided. Through the coordinated operation of the data acquisition module 10, segmentation analysis module 20, segmentation optimization module 30, and foreground extraction module 40, fine-grained segmentation of the hair region and accurate foreground extraction are achieved, and foreground extraction quality stability information is generated. The system structure of this embodiment can be found in [reference needed]. Figure 2 .
[0059] Data acquisition module 10 is used to acquire image data of human portrait scenes and generate corresponding hair feature datasets; In this embodiment, the data acquisition module 10 is the part of the system responsible for acquiring images and generating a hair feature dataset. It can be connected to the camera of a portrait shooting device or video call terminal, or read existing portrait image files. Specifically, the data acquisition module 10 performs feature characterization related to the hair region on the acquired image data and organizes it into a hair feature dataset according to a unified data structure, providing input to the segmentation and analysis module 20.
[0060] The segmentation analysis module 20 is used to analyze the hair feature dataset based on a preset hair segmentation model to determine the initial segmentation result of the hair region. In this embodiment, the segmentation analysis module 20 is connected to the data acquisition module 10, and it has a built-in preset hair segmentation model. Specifically, the segmentation analysis module 20 performs semantic segmentation analysis on the hair feature dataset, identifies the response characteristics and edge fuzzy distribution of the hair region, and uses multi-scale feature fusion to generate the initial segmentation result of the hair region, and outputs the initial segmentation result to the segmentation optimization module 30.
[0061] The segmentation optimization module 30 is used to obtain real-time deviation information between the initial segmentation result and the actual hair boundary state, and to adaptively optimize the initial segmentation result based on the deviation information to obtain an optimized segmentation result. In this embodiment, the segmentation optimization module 30 is connected to the segmentation analysis module 20. It is used to acquire real-time deviation information between the initial segmentation result and the actual hair boundary state, and to adaptively optimize the initial segmentation result based on the deviation information to obtain an optimized segmentation result. The specific deviation calculation and optimization process is completed by its internal units. Understandably, the segmentation optimization module 30 outputs the optimized segmentation result to the foreground extraction module 40.
[0062] The foreground extraction module 40 is used to perform foreground extraction processing on the portrait scene based on the optimized segmentation results, and generate foreground extraction quality stability information.
[0063] In this embodiment, the foreground extraction module 40 is connected to the segmentation optimization module 30. It is used to perform foreground extraction processing on the portrait scene based on the optimized segmentation results, obtaining a portrait foreground without a background. Simultaneously, it evaluates the stability of the extraction effect and generates quality stability information for the foreground extraction. Understandably, the above modules are connected sequentially and work collaboratively to jointly achieve fine-grained segmentation and foreground extraction of the hair region in the portrait scene.
[0064] In some embodiments, the internal structure of the segmentation optimization module 30 is further described, which includes a deviation analysis unit 31 and an optimization calculation unit 32. The two cooperate to complete the adaptive optimization of the initial segmentation result, so that the deviation between the segmentation result and the actual hair boundary is dynamically corrected, thereby improving the segmentation accuracy of the hair-level hair boundary.
[0065] The deviation analysis unit 31 is used to set up a first monitoring point group and a second monitoring point group based on the human hair distribution, corresponding to the hair edge distribution and the foreground-background transition distribution, respectively, and to calculate the segmentation deviation between the initial segmentation result and each monitoring point group, so as to obtain the edge deviation and the transition deviation respectively. In this embodiment, the deviation analysis unit 31 uses the initial segmentation result as a reference, sets a first set of monitoring points corresponding to the hair edge distribution at the hair edge, and sets a second set of monitoring points corresponding to the foreground-background transition distribution in the transition area between the hair and the background. Specifically, the deviation analysis unit 31 compares the initial segmentation result with the actual hair boundary state at each monitoring point, obtains the edge deviation reflecting the degree of boundary misalignment at the first monitoring point set, obtains the transition deviation reflecting the degree of transition inappropriateness at the second monitoring point set, and outputs the edge deviation and transition deviation to the optimization calculation unit 32.
[0066] The optimization calculation unit 32 is used to obtain a comprehensive deviation correction amount by normalizing and weighting the edge deviation and the transition deviation according to their respective weight coefficients, and to update the foreground and background fusion weights corresponding to the initial segmentation result using the comprehensive deviation correction amount, and to obtain an optimized segmentation result based on the updated foreground and background fusion weights.
[0067] In this embodiment, the optimization calculation unit 32 first normalizes the edge deviation and transition deviation relative to their respective reference values, transforming them into comparable dimensionless quantities. Then, it weights and sums them according to their respective weight coefficients to obtain the comprehensive deviation correction amount, wherein the sum of the weight coefficients is one. Specifically, the optimization calculation unit 32 updates the foreground and background fusion weights using the comprehensive deviation correction amount, and redistributes the foreground and background at the hair boundary based on the updated foreground and background fusion weights. This process is repeated iteratively until the segmentation deviation meets the preset convergence threshold, thereby obtaining an optimized segmentation result that closely matches the actual hair boundary.
[0068] This embodiment further explains the internal structure of the foreground extraction module 40, which includes a segmentation unit 41 and a quality evaluation unit 42. The two work together to achieve segmented processing and quality evaluation of the foreground area of the portrait, so as to effectively suppress the quality fluctuation of foreground extraction in different areas and improve the stability of foreground extraction.
[0069] Segmentation unit 41 is used to divide the foreground area of the portrait into multiple segments based on the changes in edge sharpness and the rate of change in segmentation error in the distribution of hair in the portrait. In this embodiment, the segmentation unit 41 divides the foreground region of the portrait into multiple segments based on the changes in edge sharpness and segmentation error rate. Positions with similar edge sharpness and segmentation error are grouped into the same segment, while positions with significant differences are grouped into different segments. Understandably, the segmentation unit 41 provides these multiple segments to the quality evaluation unit 42 for processing based on the different characteristics of each segment.
[0070] The quality assessment unit 42 is used to collect the extraction fluctuation data of each region segment, dynamically adjust the processing parameters of foreground extraction based on the fuzzy control algorithm, and generate quality stability information based on the segmentation error variance and foreground transparency fluctuation rate.
[0071] In this embodiment, the quality assessment unit 42 collects extraction fluctuation data for each region segment in real time, and dynamically adjusts the foreground extraction processing parameters using a fuzzy control algorithm based on the differences in extraction fluctuation data between segments. Specifically, after completing foreground extraction according to the adjusted processing parameters, the quality assessment unit 42 statistically analyzes the segmentation error and foreground transparency of each region segment, calculates the variance of the segmentation error and the volatility of the foreground transparency between segments, and generates quality stability information accordingly. Understandably, when both the segmentation error variance and the foreground transparency volatility are within a preset stability range, the quality stability information indicates stable foreground extraction; otherwise, it indicates unstable foreground extraction and triggers a dynamic adjustment command.
[0072] The above description is merely an exemplary embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural transformations made using the contents of the present invention specification and drawings under the technical concept of the present invention, or direct / indirect applications in other related technical fields, are included within the patent protection scope of the present invention.
Claims
1. A method for portrait scene fine-grained hair region segmentation and foreground extraction, characterized in that, The method includes the following steps: Collect image data of human portrait scenes to generate corresponding hair feature datasets; Based on a preset hair segmentation model, the hair feature dataset is analyzed to determine the initial segmentation result of the hair region. The real-time deviation information between the initial segmentation result and the actual hair boundary state is obtained, and the initial segmentation result is adaptively optimized based on the deviation information to obtain an optimized segmentation result; Based on the optimized segmentation results, foreground extraction is performed on the portrait scene to generate foreground extraction quality stability information.
2. The method of claim 1, wherein the method comprises: The step of collecting image data of human portrait scenes and generating corresponding hair feature datasets includes: Acquire the luminance components, chrominance components, and local gradient information of a color image of a portrait scene; Multi-scale feature extraction is performed on the image data to suppress background texture interference and extract hair-level detail-related features; Based on the extracted features, a hair feature dataset containing hair texture, edge sharpness, and foreground-background contrast is constructed.
3. The method of claim 1, wherein the method comprises: The step of analyzing the hair feature dataset based on a preset hair segmentation model to determine the initial segmentation result of the hair region includes: The hair feature dataset is semantically segmented using a pre-defined hair segmentation model to identify the response characteristics and edge blur distribution of hair regions in portrait scenes. Based on the response characteristics and edge blur distribution of the hair region, multi-scale feature fusion is used to generate the initial segmentation result; If the initial segmentation result meets the preset segmentation accuracy constraint, it is used as the initial segmentation result; otherwise, an alarm message indicating that the segmentation initialization failed is output.
4. The method of claim 1, wherein the method further comprises: The steps of obtaining real-time deviation information between the initial segmentation result and the actual hair boundary state, and adaptively optimizing the initial segmentation result based on the deviation information to obtain an optimized segmentation result include: Based on the distribution of human hair, a first monitoring point group and a second monitoring point group are set with the initial segmentation result as the reference. The first monitoring point group corresponds to the hair edge distribution, and the second monitoring point group corresponds to the foreground and background transition distribution. Calculate the segmentation deviation between the initial segmentation result and the first monitoring point group and the second monitoring point group, respectively obtain the edge deviation of the first monitoring point group and the transition deviation of the second monitoring point group, and generate real-time deviation information; Based on the edge deviation and the transition deviation, normalize and weight them according to their respective weight coefficients to obtain the comprehensive deviation correction amount. Then, use the comprehensive deviation correction amount to update the foreground and background fusion weights corresponding to the initial segmentation result. Based on the updated foreground and background fusion weights, determine the optimized segmentation result. Iterative updates continue until the segmentation deviation meets the preset convergence threshold, yielding optimized segmentation results.
5. The method of claim 4, wherein the method further comprises: The step of updating the foreground-background fusion weights using the comprehensive deviation correction amount further includes: Based on the edge deviation of the first monitoring point group, the hair edge-related component in the foreground-background fusion weight is updated until the edge deviation is balanced. Based on the transition deviation of the second monitoring point group, the foreground-background transition-related components in the foreground-background fusion weights are updated until the transition deviation meets the preset equilibrium condition, and the optimized segmentation result is determined.
6. The method of portrait scene fine-grained hair region segmentation and foreground extraction according to any one of claims 1 to 5, characterized in that, The step of performing foreground extraction processing on the portrait scene based on the optimized segmentation result and generating foreground extraction quality stability information includes: Based on the changes in edge sharpness and segmentation error rate in the distribution of human hair, the foreground region of the human portrait is divided into multiple segments. Real-time acquisition of extraction fluctuation data for each region segment, and dynamic adjustment of foreground extraction processing parameters based on the differences in extraction fluctuation data between segments using a fuzzy control algorithm; Based on the adjusted processing parameters, a quality stability index based on the segmentation error variance and foreground transparency volatility is calculated to generate quality stability information.
7. The method of claim 6, wherein the method further comprises: The extracted fluctuation data includes the segmentation error and foreground transparency of the foreground extraction, and the step of generating quality stability information for the foreground extraction includes: The segmentation error and foreground transparency of each region are statistically analyzed, and the variance of the segmentation error and the volatility of the foreground transparency between each segment are calculated. If both the variance and volatility are within the preset stability range, then the quality stability information indicates that the foreground extraction is stable. If the variance or volatility exceeds the preset stability range, the quality stability information indicates that the foreground extraction is unstable, and a dynamic adjustment instruction is triggered.
8. A system for portrait scene fine-grained hair region segmentation and foreground extraction, characterized in that, The system includes: The data acquisition module is used to collect image data of human portrait scenes and generate corresponding hair feature datasets; The segmentation analysis module is used to analyze the hair feature dataset based on a preset hair segmentation model to determine the initial segmentation result of the hair region; The segmentation optimization module is used to obtain real-time deviation information between the initial segmentation result and the actual hair boundary state, and to adaptively optimize the initial segmentation result based on the deviation information to obtain an optimized segmentation result. The foreground extraction module is used to perform foreground extraction processing on the portrait scene based on the optimized segmentation results, and generate foreground extraction quality stability information.
9. The system for portrait scene fine-grained hair segmentation and foreground extraction of claim 8, wherein, The segmentation optimization module includes: The deviation analysis unit is used to set up a first monitoring point group and a second monitoring point group based on the human portrait hair distribution, corresponding to the hair edge distribution and the foreground-background transition distribution, respectively, and to calculate the segmentation deviation between the initial segmentation result and each monitoring point group, so as to obtain the edge deviation and the transition deviation respectively. The optimization calculation unit is used to obtain a comprehensive deviation correction amount by normalizing and weighting the edge deviation and the transition deviation according to their respective weight coefficients, and to update the foreground and background fusion weights corresponding to the initial segmentation result using the comprehensive deviation correction amount, and to obtain an optimized segmentation result based on the updated foreground and background fusion weights.
10. The system for portrait scene fine-grained hair segmentation and foreground extraction of claim 8, wherein, The foreground extraction module includes: The segmentation unit is used to divide the foreground area of a portrait into multiple segments based on the changes in edge sharpness and the rate of change in segmentation error in the distribution of hair in the portrait. The quality assessment unit is used to collect the extraction fluctuation data of each region segment, dynamically adjust the processing parameters of foreground extraction based on the fuzzy control algorithm, and generate quality stability information based on the segmentation error variance and foreground transparency volatility.