Face image adaptive beautifying method and system, electronic equipment and storage medium
Through face detection and feature point positioning, the ambient light impact coefficient is calculated and the skin wear intensity is dynamically adjusted, which solves the problem of unclear face imaging in low-light and backlight environments, and realizes the adaptive beautification effect of face images.
Patent Information
- Application Number
- CN202411542450.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-05-27
AI Technical Summary
In low-light and backlight environments, the imaging of the face area is not clear enough, resulting in the fixed skin-wearing intensity that cannot adapt to different shooting environments, affecting the beauty effect.
Through face detection and feature point positioning, the complete face area image is obtained, the coefficient of influence of the current shooting ambient light on the face is calculated, and the skin wear intensity is dynamically adjusted according to this coefficient for skin wear processing.
It realizes adaptive beautification of face images in different shooting environments, improving the clarity and aesthetics of the image.
Smart Images

Figure CN120047307A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of face image technology, and in particular, to a method, a system, an electronic device, and a storage medium for adaptively beautifying a face image. Background Art
[0002] Taking pictures and video beauty are widely used in mobile phones and other photographic and video equipment. During the beauty process of the captured portrait images, skin smoothing can be performed on the face area. However, the portrait shooting effect is closely related to the ambient light. Especially in low-light and backlight environments, the imaging of the face area is often not clear enough. Therefore, a fixed skin smoothing intensity is not applicable to different shooting environments. Summary of the Invention
[0003] In view of the deficiencies in the above problems, the present invention provides a method, a system, an electronic device, and a storage medium for adaptively beautifying a face image.
[0004] To achieve the above object, the present invention provides a method for adaptively beautifying a face image, including:
[0005] Obtaining a face image;
[0006] Detecting the face image to obtain a complete face area image;
[0007] Calculating an influence coefficient of the current shooting ambient light on the face based on the complete face area image;
[0008] Performing skin smoothing on the input image based on the influence coefficient to obtain a skin-smoothed image.
[0009] Preferably, a 106-point landmark detection algorithm is used to perform feature point positioning on the face image to obtain face feature point information including the face position and the positions of each key point.
[0010] Preferably, calculating an influence coefficient of the current shooting ambient light on the face based on the complete face area image includes:
[0011] The width and height of the complete face area image are [w, h], and the value range is [0, 255]. A brightness histogram is statistically calculated Starting from pixel value 0, find the corresponding subscript brightness value x such that the cumulative number of pixel points satisfies the following formula:
[0012]
[0013] where y i represents the number of pixel points with a brightness value of i in the complete face area image, and faceShadowPerc is a preset percentage threshold;
[0014] Calculate the average luminance value of the complete face region image;
[0015] Determine whether the average luminance value is less than a preset luminance threshold. If it is less, correct the average luminance value;
[0016] If it is greater, calculate the influence coefficient based on the average luminance value.
[0017] Preferably, the correction formula is:
[0018] x = x + K * (lumaThr - y ave );
[0019] where K ∈ [0, 1] is a preset coefficient threshold; lumaThr is the preset luminance threshold; x is the corrected average luminance value.
[0020] Preferably, the formula for calculating the influence coefficient based on the average luminance value is:
[0021]
[0022] where lowThr is the preset lower bound value of the threshold, highThr is the preset upper bound value of the threshold, step is the preset step size, envCoeff is the influence coefficient.
[0023] Preferably, according to the preset lower bound value of the threshold minFactor and the preset upper bound value of the threshold maxFactor, the influence coefficient is constrained, and the constraint formula is:
[0024]
[0025] Preferably, the skin smoothing formula is:
[0026] I out = k * f(I);
[0027] where I out represents the skin-smoothed image, and f represents the skin smoothing method.
[0028] This application also provides a face image adaptive beautification system, including:
[0029] An acquisition module for acquiring a face image;
[0030] A detection module for detecting the face image to obtain a complete face region image;
[0031] A calculation module for calculating the influence coefficient of the current shooting ambient light on the face based on the complete face region image;
[0032] A skin smoothing module for performing skin smoothing on an input image based on the influence coefficient to obtain a skin-smoothed image.
[0033] The present invention also provides an electronic device including at least one processing unit and at least one storage unit. Among them, the storage unit stores a computer program, and when the program is executed by the processing unit, the processing unit is caused to execute the above method.
[0034] The present invention also provides a storage medium storing a computer program executable by an electronic device. When the program runs on the electronic device, the electronic device is caused to execute the above method.
[0035] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0036] The present invention performs face detection and face region extraction on an image, calculates the environmental light influence coefficient according to the face region, outputs the corresponding face skin smoothing intensity, and performs skin smoothing on the image, thereby enabling the captured image to have a better visual effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 is a flowchart of the method for adaptively beautifying a face image of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0041] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are some but not all of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0042] The present invention provides a method for adaptively beautifying a face image, including:
[0043] Obtain a face image;
[0044] Detect the face image to obtain a complete face region image;
[0045] Specifically, an input image containing a human face is obtained, and a face detection algorithm is used to detect the human face in the input face picture to obtain the complete face position information. Any face detection algorithm can be used in this process, and no restrictions are imposed here; in order to better select the locally interesting face region, a 106-point landmark detection algorithm for the scene can be used to locate the feature points of the picture, so as to obtain the face feature point information including the face position and the positions of each key point (including the specific positions of eyes, nose, mouth, eyebrows, and the outer contour of the face). No specific algorithm is restricted here either.
[0046] Calculate the influence coefficient of the current shooting ambient light on the human face based on the complete face region image;
[0047] Specifically, according to the complete face region image, calculate the influence coefficient of the current shooting ambient light on the human face, so as to better perform skin smoothing processing on the face image. The specific calculation process is as follows:
[0048] Step 1: The width and height of the complete face region image are [w, h], and the value range is [0, 255]. Count its brightness histogram Starting from pixel value 0, find the corresponding subscript brightness value x such that the cumulative number of pixel points satisfies the following formula:
[0049]
[0050] where y i represents the number of pixel points with brightness value i in the complete face region image, and faceShadowPerc is a preset percentage threshold;
[0051] Step 2: Calculate the average brightness value y of the small face picture ave , and judge whether the average brightness y ave is less than the preset brightness threshold lumaThr. When the average brightness is less than the preset threshold lumaThr, correct the calculated brightness value x, otherwise enter Step 3. The specific correction formula is as follows:
[0052] x = x + K * (lumaThr - y ave )
[0053] where K ∈ [0, 1] is a preset coefficient threshold.
[0054] Step 3: Set the threshold range [lowThr, highThr], and calculate the ambient light coefficient envCoeff according to the brightness value x obtained in Step 2:
[0055]
[0056] Among them, lowThr is the preset lower threshold value, highThr is the preset upper threshold value, and step is the preset step size. envCoeff is the influence coefficient.
[0057] Step 4: Optional additional constraint conditions. Constrain the environmental light coefficient envCoeff according to the preset lower threshold value minFactor and the preset upper threshold value maxFactor. For example, set minFactor = 0.2 to avoid the situation where the skin smoothing effect is too weak. At the same time, in low-light conditions, especially when the gain ISO value is relatively high, there are more noise points in the picture and the face distortion is more serious. The skin smoothing effect of the face should not be too strong. Here, a segmented maxFactor can be set according to the ISO value. The larger the ISO value, the smaller the maxFactor. For reference, the segmented value range corresponding to ISO and the upper and lower limit thresholds is as follows:
[0058] ISO: [0, 99, 100, 399, 400, 1199, 1200, 3199, 3200]
[0059] maxFactor: [1.0, 0.8, 0.8, 0.6, 0.6, 0.4, 0.4, 0.2]
[0060] minFactor: [0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2]
[0061] When 0 ≤ ISO < 99, [minFactor, maxFactor] = [0.2, 1.0]; when 99 ≤ ISO < 100, [minFactor, maxFactor] = [0.2, 0.8], and so on. The finally output envCoeff′ can be expressed as:
[0062]
[0063]
[0064] Optionally, the threshold range size can also be dynamically set according to other exposure parameters of the camera, such as the exposure index or illuminance index of the camera, as long as it is a parameter that can reflect the shooting brightness.
[0065] The skin smoothing formula is:
[0066] I out = k * f(I);
[0067] Among them, I outIt represents a skin-smoothing image, and f represents a skin-smoothing method, which can be implemented by any known method such as bilateral filtering. Optionally, skin segmentation is performed on the input image, and skin smoothing is only performed on the skin area. The skin segmentation method can be implemented by any known technique, which will not be elaborated in this invention.
[0068] This application also provides a face image adaptive beautification system, including:
[0069] An acquisition module for acquiring a face image;
[0070] A detection module for detecting the face image to obtain a complete face area image;
[0071] A calculation module for calculating the influence coefficient of the current shooting ambient light on the face based on the complete face area image;
[0072] A skin-smoothing module for performing skin-smoothing processing on the input image based on the influence coefficient to obtain a skin-smoothing image.
[0073] This invention also provides an electronic device, including at least one processing unit and at least one storage unit. Among them, the storage unit stores a computer program, and when the program is executed by the processing unit, the processing unit is enabled to execute the above method.
[0074] This invention also provides a storage medium, which stores a computer program executable by an electronic device. When the program runs on the electronic device, the electronic device is enabled to execute the above method.
[0075] The above are only the preferred embodiments of this invention and are not used to limit this invention. For those skilled in the art, this invention can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this invention shall be included within the protection scope of this invention.
Claims
1. A facial image adaptive beautification method, characterized in that: include: Get face image; Detecting the face image to obtain a complete face area image; Calculating the influence coefficient of the current shooting environment light on the face based on the complete face area image; Based on the influence coefficient, the input image is subjected to skin resurfacing processing to obtain a skin resurfacing image.
2. The method for adaptive beautification of facial images according to claim 1, characterized in that: The 106-point landmark detection algorithm locates feature points of the face image to obtain face feature point information including the face position and the positions of various key points.
3. The method for adaptive beautification of facial images according to claim 2, characterized in that: Calculating the influence coefficient of the current shooting environment light on the face based on the complete face area image includes: The width and height of the complete face area image are [w, h], the value range is [0, 255], and the brightness histogram is statistically Starting from pixel value 0, find the corresponding subscript brightness value x so that the cumulative number of pixels satisfies the following formula: Among them, y i represents the number of pixels with brightness value i in the complete face area image, and faceShadowPerc is a preset percentage threshold; Calculating the average brightness value of the complete face area image; Determine whether the average brightness value is less than a preset brightness threshold, and if so, correct the average brightness value; If it is greater than, the influence coefficient is calculated based on the average brightness value.
4. The method for adaptive beautification of facial images according to claim 3, characterized in that: The correction formula is: x=x+K*(lumaThr-y ave ); Wherein, K∈[0,1] is the preset coefficient threshold; lumaThr is the preset brightness threshold; and x is the corrected average brightness value.
5. The method for adaptive beautification of facial images according to claim 4, characterized in that: The influence coefficient is calculated based on the average brightness value as follows: Among them, lowThr is the preset lower threshold value, highThr is the preset upper threshold value, step is the preset step size, envCoeff is the influence coefficient.
6. The method for adaptive beautification of facial images according to claim 5, characterized in that: According to the preset lower threshold value minFactor and the preset upper threshold value maxFactor, the influence coefficient is constrained, and the constraint formula is:
7. The method for adaptive beautification of facial images according to claim 6, characterized in that: The microdermabrasion formula is: I out =k*f(I); Among them, I out represents the resurfacing image, and f represents the resurfacing method.
8. A facial image adaptive beautification system, characterized in that: include: An acquisition module, used for acquiring a face image; A detection module, used to detect the face image and obtain a complete face area image; A calculation module, used for calculating the influence coefficient of the current shooting environment light on the face based on the complete face area image; The skin resurfacing module is used to perform skin resurfacing processing on the input image based on the influence coefficient to obtain a skin resurfacing image.
9. An electronic device, characterized in that: The method comprises at least one processing unit and at least one storage unit, wherein the storage unit stores a computer program, and when the program is executed by the processing unit, the processing unit executes the method according to any one of claims 1 to 7.
10. A storage medium, characterized in that: It stores a computer program executable by an electronic device. When the program runs on the electronic device, the electronic device executes the method according to any one of claims 1 to 7.