CN112541860A - Skin color beautifying correction method and device - Google Patents

Skin color beautifying correction method and device Download PDF

Info

Publication number
CN112541860A
CN112541860A CN201910900282.3A CN201910900282A CN112541860A CN 112541860 A CN112541860 A CN 112541860A CN 201910900282 A CN201910900282 A CN 201910900282A CN 112541860 A CN112541860 A CN 112541860A
Authority
CN
China
Prior art keywords
skin color
image
skin
value
brightness
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910900282.3A
Other languages
Chinese (zh)
Inventor
胡煦辉
严卫健
刘俊秀
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Kaiyang Electronics Co ltd
Original Assignee
Shenzhen Kaiyang Electronics Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Kaiyang Electronics Co ltd filed Critical Shenzhen Kaiyang Electronics Co ltd
Priority to CN201910900282.3A priority Critical patent/CN112541860A/en
Publication of CN112541860A publication Critical patent/CN112541860A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/90Dynamic range modification of images or parts thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20024Filtering details
    • G06T2207/20028Bilateral filtering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30196Human being; Person

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)

Abstract

The invention provides a skin color beautifying and correcting method, which comprises the following steps: converting the image from RGB space to YCbCr space, and obtaining Cb mean value and Cr mean value of the whole image; when the difference value of the Cb mean value and the Cr mean value exceeds a preset value, carrying out illumination compensation processing on the image; establishing a skin color model, and performing skin color segmentation to determine a skin color area in the image; and sequentially carrying out skin color whitening and skin color smoothing treatment on the skin color area. The invention can effectively reduce missing detection and false detection by performing illumination compensation judgment before skin color detection, performs skin color segmentation by using the skin color model to determine the skin color area in the image, and performs whitening and smoothing treatment on the skin color. The non-skin color pixel points keep the original color and brightness information, and only the brightness and tone information of the skin color pixel points are adjusted, so that the overall aesthetic feeling of the image is improved.

Description

Skin color beautifying correction method and device
Technical Field
The invention relates to the technical field of image and video processing, in particular to a skin color beautifying and correcting method and device.
Background
Beautifying of skin color is a new application of image enhancement in the field of human life, and the main purpose of the method is to detect skin areas in images and perform beautifying operations such as whitening and skin grinding on skin pixel points. With the increasing use of electronic digital products, such demands are increasing. As the image resolution of products such as digital cameras and mobile phones is higher and higher, the problems of spots, moles, wrinkles and the like on skin areas such as human faces in high-resolution images are also clearly displayed, and in order to improve the aesthetic feeling of images and videos, the beautifying requirement on the skin areas is generated.
In the prior art, different photographing modes can be selected by using photographing software, so that the skin is whitened, the color contrast is improved, and the like. However, such software processes the entire image, i.e. the background and skin area of the image are equally beautified, which may result in a certain degree of distortion or an aesthetically unappealing background contrast. In addition, the photos can be processed in detail by using the software for beautifying the images, but the software has higher use skill, and the users can realize natural beautification of the skin area by learning and practicing for a long time.
Disclosure of Invention
In view of this, an embodiment of the present invention provides a skin color beautification correction method, including:
converting the image from RGB space to YCbCr space, and obtaining Cb mean value and Cr mean value of the whole image;
when the difference value of the Cb mean value and the Cr mean value exceeds a preset value, carrying out illumination compensation processing on the image;
establishing a skin color model, and performing skin color segmentation to determine a skin color area in the image;
and sequentially carrying out skin color whitening and skin color smoothing treatment on the skin color area.
Further, the illumination compensation processing on the image specifically includes:
converting the image into a grey-scale map;
counting the pixel points of each gray value and arranging the pixel points according to the gray value from high to low to obtain the average value of the pixel points which are 5 percent before arrangement;
determining an illumination compensation coefficient according to the average gray value;
and multiplying the original pixel value by the illumination compensation coefficient to obtain the pixel value after illumination compensation processing.
Further, the conversion of the image from the RGB space to the YCbCr space uses the following conversion formula:
Figure BDA0002211606920000021
further, the whitening treatment of the skin color specifically includes:
using the convex curve transformation formula Y' 255(1-c)×YcAdjusting the brightness value, wherein c is more than 0 and less than 1, Y is the brightness value before adjustment, Y 'is the brightness value after adjustment, and delta Y-Y' -Y is the increment of skin color brightness;
the proportional relation between brightness and tone is not changed before and after adjustment
Figure BDA0002211606920000022
Figure BDA0002211606920000023
Determining the increment delta Cr of Cr and the increment delta Cb of Cb;
using the formula Cb' ═ Cb + α × (128-Cb) and
Figure BDA0002211606920000024
Figure BDA0002211606920000025
determining skin color adjustment coefficients alpha and beta;
and when the skin color adjustment coefficients alpha and beta simultaneously meet the preset condition, finishing the adjustment of the YCbCr parameters.
Further, the value c in the convex curve transformation formula is 0.7; the convex curve transformation formula is that Y' is 5.27 multiplied by Y0.7
Further, the smoothing of the skin color specifically includes:
carrying out Skin color detection on the whitened image to obtain a first binary image Skin 1;
performing Skin color detection on the original image which is not subjected to whitening processing to obtain a second binary image Skin 2:
determining a spot region SpotMap in the image as (1-Skin2) from the first binary image Skin1 and the second binary image Skin2 as Skin 1;
carrying out double-sideband filtering processing on the skin color part in the original image which is not subjected to whitening processing, and subtracting the RGB value of the original image and the filtered image to obtain a detail image Idetail;
carrying out double-sideband filtering processing on the image subjected to whitening processing according to the spot area spotMap to obtain a filtered image Ifilter;
and restoring the detail characteristics in the skin area to obtain a whitened and smoothed image Ifinal, (1-skin2). Idetail + Ifilter.
Further, the skin color model is a skin color clustering ellipse model with the formula of
Figure BDA0002211606920000031
In the formula, (ecx, ecy) represents the coordinates of the center of the ellipse, a and b represent the major and minor semi-axes of the ellipse respectively, theta represents the rotation angle of the ellipse model coordinates, and x and y represent the blue chromaticity component and the red chromaticity component after rotation; cb 'and Cr' represent a blue chrominance component and a red chrominance component; cx and cy represent control parameters; wherein, cx is 109.38, cy is 152.02, θ is 2.53, ecx is 1.60, ecy is 2.41, a is 25.39, and b is 14.03.
Further, in the process of skin color detection by using the skin color clustering model, for different brightness Y values, the major and minor axes a and b of the ellipse are adaptively adjusted to improve the identification rate of skin color pixel points; when the brightness value Y is less than 40, no skin color pixel exists; when the brightness value Y is in the interval [40,900), the major axis and the minor axis a, b of the ellipse are reduced to be half of a constant; when the brightness value Y is in the interval [90,220], the major axis and the minor axis a, b are kept unchanged; the brightness value Y is larger than 220, and the major axis and the minor axis of the ellipse are adjusted to be 1.2 times of a constant value.
The embodiment of the invention also provides a skin color beautifying and correcting device, which comprises:
the conversion acquisition module is used for converting the RGB space of the image into the YCbCr space and acquiring the Cb mean value and the Cr mean value of the whole image;
the judgment processing module is used for performing illumination compensation processing on the image when the difference value of the Cb mean value and the Cr mean value exceeds a preset value;
the modeling segmentation module is used for establishing a skin color model and carrying out skin color segmentation to determine a skin color area in the image;
and the skin color processing module is used for sequentially carrying out skin color whitening and skin color smoothing on the skin color area.
Further, the skin color processing module performs whitening processing on the skin color specifically includes:
using the convex curve transformation formula Y' 255(1-c)×YcAdjusting the brightness value, wherein c is more than 0 and less than 1, Y is the brightness value before adjustment, Y 'is the brightness value after adjustment, and delta Y-Y' -Y is the increment of skin color brightness;
the proportional relation between brightness and tone is not changed before and after adjustment
Figure BDA0002211606920000043
Figure BDA0002211606920000044
Determining the increment delta Cr of Cr and the increment delta Cb of Cb;
using the formula Cb' ═ Cb + α × (128-Cb) and
Figure BDA0002211606920000041
Figure BDA0002211606920000042
determining skin color adjustment coefficients alpha and beta;
and when the skin color adjustment coefficients alpha and beta simultaneously meet the preset condition, finishing the adjustment of the YCbCr parameters.
Further, the value c in the convex curve transformation formula is 0.7; the convex curve transformation formula is that Y' is 5.27 multiplied by Y0.7
Further, the smoothing of the skin color by the skin color processing module specifically includes:
carrying out Skin color detection on the whitened image to obtain a first binary image Skin 1;
performing Skin color detection on the original image which is not subjected to whitening processing to obtain a second binary image Skin 2:
determining a spot region SpotMap in the image as (1-Skin2) from the first binary image Skin1 and the second binary image Skin2 as Skin 1;
carrying out double-sideband filtering processing on the skin color part in the original image which is not subjected to whitening processing, and subtracting the RGB value of the original image and the filtered image to obtain a detail image Idetail;
carrying out double-sideband filtering processing on the image subjected to whitening processing according to the spot area spotMap to obtain a filtered image Ifilter;
and restoring the detail characteristics in the skin area to obtain a whitened and smoothed image Ifinal, (1-skin2). Idetail + Ifilter.
An embodiment of the present invention further provides a computer device, including: a memory and a processor;
the memory for storing a computer program;
the processor is used for executing the steps of the skin color beautification correction method when the computer program is run.
An embodiment of the present invention further provides a computer storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the above skin tone beautification correction method.
The invention can effectively reduce missed detection and false detection through illumination compensation by carrying out illumination compensation judgment before skin color detection. And performing skin color segmentation by using a skin color model to determine a skin color area in the image, and performing whitening and smoothing on skin color, wherein non-skin color pixel points still have original color and brightness information. Only the information such as the brightness, the tone and the like of the skin color pixel points in the image is adjusted, and the integral aesthetic feeling is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a skin tone beautification correction method according to an embodiment of the present invention;
fig. 2 is a schematic composition diagram of a skin tone beautification correction apparatus according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic flow chart of a skin tone beautification correction method according to an embodiment of the present invention. The method comprises the following steps:
s101, converting the image from an RGB space to a YCbCr space, and acquiring a Cb mean value and a Cr mean value of the whole image.
In this embodiment, the conversion of the image from RGB space to YCbCr space may use the following conversion formula:
Figure BDA0002211606920000061
other similar transformation methods may be used in other embodiments.
And S102, when the difference value of the Cb mean value and the Cr mean value exceeds a preset value, carrying out illumination compensation processing on the image.
In order to accurately segment skin color pixel points from an image, the illumination condition of the image needs to be judged, and skin color false detection or missing detection caused by the conditions of uneven illumination distribution and the like is avoided. The high-brightness area is caused by the specular reflection or interface reflection of the object surface, the reflection of the high-brightness area is the light source color, and the high-brightness area is not the actual color of the object surface, so that a certain color deviation exists. For skin detection in an image, it is generally difficult to accurately find all skin pixels under poor light conditions, and when there is a large light difference in the same image, the light distribution of the face and other parts of the body is not uniform, resulting in missed skin color detection, so that before a skin color model is established, light compensation processing is required. The detection of the skin color area is generally based on information such as skin color and the like, so the skin color area is sensitive to illumination, and is influenced by factors such as light source color, intensity, distribution and the like, and the detection is easy to miss when the color tone is warmer and easy to miss when the color tone is colder. Firstly, whether illumination compensation is needed to be carried out on the illumination condition of an image needs to be judged, the image needs to be transferred from a GRB space to a YCbCr space, the Cb and Cr mean values of the whole image are analyzed, when the difference value of the Cb and Cr mean values exceeds a certain threshold value, the phenomenon that the difference value between a blue chrominance component and a red chrominance component in the image is large is shown, the phenomenon of color tone imbalance exists in the image, and illumination compensation processing needs to be carried out.
The illumination compensation processing on the image may specifically include:
and S1021, converting the image into a gray scale image.
And converting the image needing illumination compensation processing into a gray-scale image.
S1022, counting the pixel points of each gray value and arranging the pixel points according to the gray value from high to low to obtain the average value of the pixel points which are 5% before arrangement.
Counting the number of pixels of each level of gray value, obtaining the number of pixels (gray values are arranged from large to small) which is 5% of the first gray level sequence of the pixels in the image and the minimum gray value of the part, if the number of the pixels reaches a certain number, indicating that the number of the pixels affected by the illumination deviation is more and illumination compensation is needed, and setting the minimum gray value as a critical gray value. For pixels with gray values exceeding the threshold gray value, the pixels are considered as reference points to adjust the color information of the whole image. The RGB three-channel color average of the pixels exceeding the critical gray value needs to be calculated. The average value was used. The RGB three-channel color average value averageR, averageG and averageB is obtained by dividing the sum of the RGB three-channel color values of the pixels exceeding the critical gray value by the number of the pixels exceeding the critical gray value.
And S1023, determining an illumination compensation coefficient according to the average value.
Respectively obtaining the illumination compensation coefficient eta of the RGB three channels according to the average values averageR, averageG and averageB of the RGB three channelsr、ηg、ηb
Figure BDA0002211606920000081
And S1024, multiplying the original pixel value by the illumination compensation coefficient to obtain a pixel value after illumination compensation processing.
And multiplying the RGB values of the original image by the corresponding illumination compensation coefficients respectively to obtain the RGB image after illumination compensation.
In other embodiments, other illumination compensation methods may also be used. For example: GrayWorld color equalization algorithm.
S103, establishing a skin color model, and performing skin color segmentation to determine a skin color area in the image.
And establishing a skin color model and carrying out skin color segmentation. The establishment of the skin color model is to find a skin color aggregation area in a color space with better skin color aggregation property by a statistical analysis method, determine model parameters, analyze each pixel point in the image, and judge whether the pixel point is skin color or non-skin color according to whether the pixel point falls in the skin color aggregation area. The skin color difference between different people is mainly influenced by the brightness greatly and is influenced by the hue and the saturation less, so that the image is mapped to a YCbCr space, the brightness Y component is separated, and a better skin color clustering model is formed mainly according to the Cb component and the Cr component.
The projection of the skin color pixel point in the YCbCr space is in a spindle shape with thick middle and sharp two ends, namely, in a place with a larger or smaller Y value, the clustering shrinkage of skin color on a CbCr plane is obvious, the difference is large, and therefore, the influence of different Y values needs to be considered when the skin color is segmented.
And setting upper and lower limit values for the Y value, wherein the influence of brightness change on skin color clustering is small within the limit value range, and the skin color can be judged only through Cb and Cr values. And in the part exceeding the limit value, the clustering bodies are distributed on the Y-Cb and Y-Cr planes by utilizing the trapezoidal geometric description, and the scales of the Cb axis and the Cr axis are stretched to ensure that the skin color clustering bodies are columnar, and the skin color clustering body shape does not change along with the change of the Y value.
The upper and lower threshold values Kl and Kh for Y are typically 125 and 188. And correcting the central axes of Cb and Cr and the width of the skin color area at the part outside the upper and lower limit ranges, and performing linear transformation on the Cb and Cr values of the part according to the ratio of the width of the skin color area outside the range to the width of the skin color area inside the limit value.
Figure BDA0002211606920000091
Figure BDA0002211606920000092
Figure BDA0002211606920000093
Figure BDA0002211606920000094
Wherein, YminAnd YmaxIs the minimum and maximum of the luminance component in the skin tone cluster, 16 and 255 respectively. Wcb(Y) and Wcr(Y) is the projection width of the upper and lower brightness values in Y-Cb and Y-Cr space, and the other constant is Wcb=46.97,WLcb=23,WHcb= 14,Wcr=38.76,WLcr=20,WHcr=10
Thus, a nonlinear piecewise transformation formula is obtained:
Figure BDA0002211606920000101
Figure BDA0002211606920000102
the projection of the skin color point clusters on a Cb '-Cr' plane after nonlinear transformation is similar to an ellipse, the skin color model is a skin color cluster ellipse model, and the formula is
Figure BDA0002211606920000103
In the formula, (ecx, ecy) represents the coordinates of the center of the ellipse, a and b represent the major and minor semi-axes of the ellipse respectively, theta represents the rotation angle of the ellipse model coordinates, and x and y represent the blue chromaticity component and the red chromaticity component after rotation; cb 'and Cr' represent a blue chrominance component and a red chrominance component; cx and cy represent control parameters; wherein, cx is 109.38, cy is 152.02, θ is 2.53, ecx is 1.60, ecy is 2.41, a is 25.39, and b is 14.03.
In the skin color detection process of the skin color clustering model, for different brightness Y values, the major and minor axes a and b of the ellipse are subjected to adaptive adjustment to improve the identification rate of skin color pixel points; when the brightness value Y is less than 40, no skin color pixel exists; when the brightness value Y is in the interval [40,900), the major axis and the minor axis a, b of the ellipse are reduced to be half of a constant; when the brightness value Y is in the interval [90,220], the major axis and the minor axis a, b are kept unchanged; the brightness value Y is larger than 220, and the major axis and the minor axis of the ellipse are adjusted to be 1.2 times of a constant value.
And judging whether each pixel point in the whole image falls in a corresponding range through a skin color model, if so, determining the pixel point as a skin color pixel point, and otherwise, determining the pixel point as a non-skin color pixel point.
In this embodiment, the skin color clustering uses an elliptical model, and in other embodiments, other skin color clustering models may be used for the skin color clustering model.
And S104, sequentially carrying out skin color whitening and skin color smoothing on the skin color area.
The skin color beautification mainly comprises skin color whitening and skin color smoothing processing, optimization correction is carried out on skin color areas, the background and other non-skin color points in an image or a video cannot be distorted in color or lose details, and the skin color areas such as a human face and the like can be more attractive after being optimized.
Skin color points in the image are adjacent to non-skin color points, for example, the position of lips of a face, and outer edge points of the lips may be determined as skin color points or non-skin color points, so that in order to avoid unnatural transition between skin color and non-skin color caused by an optimization process, a beautification weight template needs to be generated, and a skin color area can achieve the effect of gradual whitening. For the skin color pixel points of a picture, the weight is set to be 1, and the weight value of the non-skin color pixel points at the boundary part of the skin color and the non-skin color is set to be between 0 and 1 to form a skin color template with natural transition. For the weight value of this portion, a mean value or a gaussian distribution may be selected for determination. The weight value of the pixel point detected as skin color of the obtained skin color template is 1, the weight value of the non-skin color pixel point in the skin color boundary range is between 0 and 1, and the weight value of the non-skin color pixel point closer to the skin color area is larger. The other non-skin color pixel points have a weight of 0.
The skin color processing module performs whitening processing on the skin color specifically comprises the following steps:
s1041, converting the formula Y' to 255 with a convex curve(1-c)×YcAnd adjusting the brightness value, wherein Y is the brightness value before adjustment, Y 'is the brightness value after adjustment, and delta Y-Y' -Y is the increment of the skin color brightness.
The purpose of beautifying the skin is to brighten the skin color part and obtain the effect of whitening and natural skin. The brightness Y value is increased in a gradual mode, and the phenomenon that the skin color is greatly enhanced at the overhigh or overlow part to cause highlight distortion is avoided. By Y' ═ c × YxThe convex curve progressively increases the Y value.
In this embodiment, the value c in the convex curve transformation formula is 0.7; the convex curve transformation formula is that Y' is 5.27 multiplied by Y0.7. The skin color brightening and whitening effect is optimal by adopting the convex curve transformation formula. In other embodiments, the value of c may take any value greater than 0 and less than 1; for example: when the value c in the convex curve transformation formula is 0.6; the corresponding convex curve transformation formula is that the value c in the Y' is 9.18 multiplied by Y curve transformation formula is 0.6; the convex curve transformation formula is that Y' is 9.18 multiplied by Y0.6
S1042, using the ratio of brightness to hue before and after adjustmentExample relationship is not changed
Figure BDA0002211606920000121
Figure BDA0002211606920000122
An increment of Cr Δ Cr and an increment of Cb Δ Cb are determined.
For the adjustment of the hue, in order to ensure that the brightness of the skin color portion is improved, but the skin color is not distorted, it is necessary to ensure a proportional relationship between the brightness and the hue.
S1043 using the formula Cb' ═ Cb + α × (128-Cb) and
Figure BDA0002211606920000123
Figure BDA0002211606920000124
skin tone adjustment coefficients alpha and beta are determined.
When the red component of the image skin color is high, Cr/Cb is greater than 1, and the increment Δ Cr of Cr becomes small. Wherein alpha and beta are adjustment coefficients for skin color and are used for controlling the required beautifying, whitening and ruddiness degree of the skin color.
And S1044, when the skin color adjustment coefficients alpha and beta simultaneously meet the preset conditions, finishing the adjustment of the YCbCr parameters.
The smoothing of the skin color by the skin color processing module specifically comprises:
s1051, carrying out Skin color detection on the whitened image to obtain a first binary image Skin 1.
And performing Skin color detection on the whitening-processed image Iwhite, and expanding the range of the elliptical model to a certain extent, so that flaws such as spots, moles and the like which are relatively close to Skin color can be detected, and obtaining a binary image Skin 1. Skin1 binary images, including as much as possible the speckle, mottle and Skin tone values were all 1, with a background of 0.
And S1052, performing Skin color detection on the original image which is not subjected to whitening processing to obtain a second binary image Skin 2.
And carrying out Skin color detection on the original image I, and reducing the range of the elliptical model to a certain extent so that flaws such as spots, moles and the like which have certain difference with Skin color are not detected to obtain a binary image Skin 2. Skin2 binary image, including as little spots as possible, i.e., Skin color region value of 1, spot area value of 0, and background of 0.
And S1053, determining a spot region SpotMap in the image as (1-Skin2) Skin1 according to the first binary image Skin1 and the second binary image Skin 2.
Correspondingly, the spot is (1-0) × 1 ═ 1, the skin color is (1-1) × 1 ═ 0, and the background is (1-0) × 0 ═ 0.
And S1054, carrying out double-sideband filtering processing on the skin color part in the original image which is not subjected to whitening processing, and subtracting the RGB value of the original image and the filtered image to obtain a detail image Idetail.
The kernel function of the double-sideband filtering considers the relation between the pixel difference and the distance in space at the same time, and protects the edge of the skin color area while filtering the skin area.
Kernel function for double sideband filtering
Figure BDA0002211606920000131
Where w represents a weight, f is a pixel value, and (i, j) is all elements within a window having a radius r centered at (x, y), σdControlling the influence degree, sigma, of the pixel difference between the neighborhood point and the current point on the filteringrAnd controlling the influence degree of the spatial distance between the neighborhood point and the current point on the filtering.
S1055, carrying out double-sideband filtering processing on the whitened image according to the spot area SpotMap to obtain a filtered image Ifilter;
s1056, restoring the detail features in the skin region, and obtaining a whitened and smoothed image Ifinal ═(1-skin2) · Idetail + Ifilter.
The smoothing of the skin tone is based on RGB images.
Fig. 2 shows that the embodiment of the present invention further provides a skin tone beautification correction apparatus, including:
the conversion acquisition module is used for converting the RGB space of the image into the YCbCr space and acquiring the Cb mean value and the Cr mean value of the whole image;
the judgment processing module is used for performing illumination compensation processing on the image when the difference value of the Cb mean value and the Cr mean value exceeds a preset value;
the modeling segmentation module is used for establishing a skin color model and carrying out skin color segmentation to determine a skin color area in the image;
and the skin color processing module is used for sequentially carrying out skin color whitening and skin color smoothing on the skin color area.
The skin color processing module performs whitening processing on the skin color specifically comprises the following steps:
using the convex curve transformation formula Y' 255(1-c)×YcAdjusting the brightness value, wherein c is more than 0 and less than 1, Y is the brightness value before adjustment, Y 'is the brightness value after adjustment, and delta Y-Y' -Y is the increment of skin color brightness; the value c in the convex curve transformation formula is preferably 0.7; the corresponding convex curve transformation formula is that Y' is 5.27 multiplied by Y0.7
The proportional relation between brightness and tone is not changed before and after adjustment
Figure BDA0002211606920000141
Figure BDA0002211606920000142
Determining the increment delta Cr of Cr and the increment delta Cb of Cb;
using the formula Cb' ═ Cb + α × (128-Cb) and
Figure BDA0002211606920000143
Figure BDA0002211606920000144
determining skin color adjustment coefficients alpha and beta;
and when the skin color adjustment coefficients alpha and beta simultaneously meet the preset condition, finishing the adjustment of the YCbCr parameters.
The smoothing of the skin color by the skin color processing module specifically comprises:
carrying out Skin color detection on the whitened image to obtain a first binary image Skin 1;
carrying out Skin color detection on the original image which is not subjected to whitening processing to obtain a second binary image Skin 2;
determining a spot region SpotMap in the image as (1-Skin2) from the first binary image Skin1 and the second binary image Skin2 as Skin 1;
carrying out double-sideband filtering processing on a skin color part in an original image which is not subjected to whitening processing, and subtracting an RGB value of the original image and an image subjected to filtering processing to obtain a detail image Tdetail;
carrying out double-sideband filtering processing on the image subjected to whitening processing according to the spot area spotMap to obtain a filtered image Ifilter;
and restoring the detail characteristics in the skin area to obtain a whitened and smoothed image Ifinal, (1-skin2). Idetail + Ifilter.
It should be noted that: in the skin color beautification correction device provided in the above embodiment, only the division of the program modules is exemplified when performing the correction, and in practical applications, the processing distribution may be completed by different program modules according to needs, that is, the internal structure of the device is divided into different program modules to complete all or part of the processing described above. In addition, the skin color beautification correction device and the skin color beautification correction method provided by the embodiment belong to the same concept, the specific implementation process is described in the method embodiment in detail, and the beneficial effects are the same as the method embodiment and are not described again.
An embodiment of the present invention further provides a computer device, including: a memory and a processor. Wherein the memory is for storing a computer program. The processor is used for executing the steps of the skin color beautification correction method when the computer program runs.
The embodiment of the present invention further provides a computer storage medium, which is a computer readable storage medium, and a computer program is stored thereon, where the computer program can be executed by a processor of a computer device to complete the steps of the skin tone beautification correction method. The computer-readable storage medium may be a magnetic random access Memory (FRAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Programmable Read-Only Memory (EPROM), an electrically Erasable Programmable Read-Only Memory (EEPROM), a Flash Memory (Flash Memory), a magnetic surface Memory, an optical disk, or a Compact Disc Read-Only Memory (CD-ROM), among other memories.
In the embodiments provided in the present invention, it should be understood that the disclosed method and intelligent device may be implemented in other ways. The above-described device embodiments are merely illustrative, for example, the division of the unit is only a logical functional division, and there may be other division ways in actual implementation, such as: multiple units or components may be combined, or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the coupling, direct coupling or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection between the devices or units may be electrical, mechanical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed on a plurality of network units; some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.

Claims (10)

1. A skin tone beautification correction method, comprising:
converting the image from RGB space to YCbCr space, and obtaining Cb mean value and Cr mean value of the whole image;
when the difference value of the Cb mean value and the Cr mean value exceeds a preset value, carrying out illumination compensation processing on the image;
establishing a skin color model, and performing skin color segmentation to determine a skin color area in the image;
and sequentially carrying out skin color whitening and skin color smoothing treatment on the skin color area.
2. The method according to claim 1, wherein performing illumination compensation processing on the image specifically comprises:
converting the image into a grey-scale map;
counting the pixel points of each gray value and arranging the pixel points according to the gray value from high to low to obtain the average value of the pixel points which are 5 percent before arrangement;
determining an illumination compensation coefficient according to the average gray value;
and multiplying the original pixel value by the illumination compensation coefficient to obtain the pixel value after illumination compensation processing.
3. The method according to claim 1, wherein the skin-whitening treatment specifically comprises:
using the convex curve transformation formula Y' 255(1-c)×YcAdjusting the brightness value of 0<c<1, Y is a brightness value before adjustment, Y 'is a brightness value after adjustment, and Δ Y ═ Y' -Y is an increment of skin color brightness;
the proportional relation between brightness and tone is not changed before and after adjustment
Figure FDA0002211606910000011
Figure FDA0002211606910000012
Determining the increment delta Cr of Cr and the increment delta Cb of Cb;
the formula Cb '═ Cb + α × (128-Cb) and Cr' ═ Cr + β are used as a reference
Figure FDA0002211606910000013
Determining skin tone adjustment factorα and β;
and when the skin color adjustment coefficients alpha and beta simultaneously meet the preset condition, finishing the adjustment of the YCbCr parameters.
4. The method of claim 3, wherein the convex curve transformation formula has a c value of 0.7; the convex curve transformation formula is that Y' is 5.27 multiplied by Y0.7
5. The method according to claim 1, wherein smoothing the skin tone specifically comprises:
carrying out Skin color detection on the whitened image to obtain a first binary image Skin 1;
carrying out Skin color detection on the original image which is not subjected to whitening processing to obtain a second binary image Skin 2;
determining a spot region SpotMap in the image as (1-Skin2) from the first binary image Skin1 and the second binary image Skin2 as Skin 1;
carrying out double-sideband filtering processing on the skin color part in the original image which is not subjected to whitening processing, and subtracting the RGB value of the original image and the filtered image to obtain a detail image Idetail;
carrying out double-sideband filtering processing on the image subjected to whitening processing according to the spot area spotMap to obtain a filtered image Ifilter;
and restoring the detail characteristics in the skin area to obtain a whitened and smoothed image Ifinal, (1-skin2). Idetail + Ifilter.
6. The method of claim 1, wherein the skin color model is a skin color clustering ellipse model having a formula
Figure FDA0002211606910000021
In the formula, (ecx, ecy) represents the coordinates of the center of the ellipse, a and b represent the major and minor semi-axes of the ellipse respectively, theta represents the rotation angle of the ellipse model coordinates, and x and y represent the blue chromaticity component and the red chromaticity component after rotation; cb 'and Cr' represent a blue chrominance component and a red chrominance component; cx and cy represent control parameters; wherein, cx is 109.38, cy is 152.02, θ is 2.53, ecx is 1.60, ecy is 2.41, a is 25.39, and b is 14.03.
7. The method according to claim 6, wherein in the skin color detection process using the skin color clustering model, for different brightness Y values, the major and minor axes a, b of the ellipse are adaptively adjusted to improve the recognition rate of skin color pixel points; when the brightness value Y is less than 40, no skin color pixel exists; when the brightness value Y is in the interval [40,900), the major and minor axes a and b of the ellipse are reduced to be half of a constant; when the brightness value Y is in the interval [90,220], the major and minor axes a and b are kept unchanged; the brightness value Y is larger than 220, and the major axis and the minor axis of the ellipse are adjusted to be 1.2 times of a constant value.
8. A skin tone beautification correction apparatus, comprising:
the conversion acquisition module is used for converting the RGB space of the image into the YCbCr space and acquiring the Cb mean value and the Cr mean value of the whole image;
the judgment processing module is used for performing illumination compensation processing on the image when the difference value of the Cb mean value and the Cr mean value exceeds a preset value;
the modeling segmentation module is used for establishing a skin color model and carrying out skin color segmentation to determine a skin color area in the image;
and the skin color processing module is used for sequentially carrying out skin color whitening and skin color smoothing on the skin color area.
9. The apparatus of claim 8, wherein the skin tone processing module performs whitening processing on the skin tone specifically comprises:
using the convex curve transformation formula Y' 255(1-c)×YcAdjusting the brightness value of 0<c<1, Y is a brightness value before adjustment, Y 'is a brightness value after adjustment, and Δ Y ═ Y' -Y is an increment of skin color brightness;
the proportional relation between brightness and tone is not changed before and after adjustment
Figure FDA0002211606910000031
Figure FDA0002211606910000032
Determining the increment delta Cr of Cr and the increment delta Cb of Cb;
using the formula Cb' ═ Cb + α × (128-Cb) and
Figure FDA0002211606910000033
Figure FDA0002211606910000034
determining skin color adjustment coefficients alpha and beta;
and when the skin color adjustment coefficients alpha and beta simultaneously meet the preset condition, finishing the adjustment of the YCbCr parameters.
10. The apparatus of claim 8, wherein the skin tone processing module smoothing the skin tone comprises:
carrying out Skin color detection on the whitened image to obtain a first binary image Skin 1;
carrying out Skin color detection on the original image which is not subjected to whitening processing to obtain a second binary image Skin 2;
determining a spot region SpotMap in the image as (1-Skin2) from the first binary image Skin1 and the second binary image Skin2 as Skin 1;
carrying out double-sideband filtering processing on the skin color part in the original image which is not subjected to whitening processing, and subtracting the RGB value of the original image and the filtered image to obtain a detail image Idetail;
carrying out double-sideband filtering processing on the image subjected to whitening processing according to the spot area spotMap to obtain a filtered image Ifilter;
and restoring the detail characteristics in the skin area to obtain a whitened and smoothed image Ifinal, (1-skin2). Idetail + Ifilter.
CN201910900282.3A 2019-09-23 2019-09-23 Skin color beautifying correction method and device Pending CN112541860A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910900282.3A CN112541860A (en) 2019-09-23 2019-09-23 Skin color beautifying correction method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910900282.3A CN112541860A (en) 2019-09-23 2019-09-23 Skin color beautifying correction method and device

Publications (1)

Publication Number Publication Date
CN112541860A true CN112541860A (en) 2021-03-23

Family

ID=75013242

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910900282.3A Pending CN112541860A (en) 2019-09-23 2019-09-23 Skin color beautifying correction method and device

Country Status (1)

Country Link
CN (1) CN112541860A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113870404A (en) * 2021-09-23 2021-12-31 聚好看科技股份有限公司 Skin rendering method and device of 3D model
CN113947606A (en) * 2021-09-26 2022-01-18 北京达佳互联信息技术有限公司 Image processing method, image processing device, electronic equipment and storage medium
CN115587948A (en) * 2022-10-12 2023-01-10 青岛海信医疗设备股份有限公司 Image dark field correction method and device

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040119995A1 (en) * 2002-10-17 2004-06-24 Noriyuki Nishi Conversion correcting method of color image data and photographic processing apparatus implementing the method
JP2006180267A (en) * 2004-12-22 2006-07-06 Fujitsu General Ltd Picture quality correcting circuit
CN101840688A (en) * 2010-05-07 2010-09-22 青岛海信电器股份有限公司 Gamma debugging method, device and system of liquid crystal display terminal
CN102096823A (en) * 2011-02-12 2011-06-15 厦门大学 Face detection method based on Gaussian model and minimum mean-square deviation
CN104598914A (en) * 2013-10-31 2015-05-06 展讯通信(天津)有限公司 Skin color detecting method and device
CN106845455A (en) * 2017-03-01 2017-06-13 中国科学院上海高等研究院 Image processing method, system and server based on Face Detection
CN107369133A (en) * 2016-05-13 2017-11-21 炬芯(珠海)科技有限公司 A kind of facial image beautification method and device
CN107480607A (en) * 2017-07-28 2017-12-15 青岛大学 A kind of method that standing Face datection positions in intelligent recording and broadcasting system
KR20180038857A (en) * 2016-10-07 2018-04-17 삼성전기주식회사 Visual inspection apparatus and method of optical calibration of the same
CN109214363A (en) * 2018-10-23 2019-01-15 广东电网有限责任公司 A kind of substation's worker's face identification method based on YCbCr and connected component analysis
CN109359531A (en) * 2018-09-12 2019-02-19 仲恺农业工程学院 Fruit harvesting area automatic positioning method facing natural scene
CN110222555A (en) * 2019-04-18 2019-09-10 江苏图云智能科技发展有限公司 The detection method and device of area of skin color

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040119995A1 (en) * 2002-10-17 2004-06-24 Noriyuki Nishi Conversion correcting method of color image data and photographic processing apparatus implementing the method
JP2006180267A (en) * 2004-12-22 2006-07-06 Fujitsu General Ltd Picture quality correcting circuit
CN101840688A (en) * 2010-05-07 2010-09-22 青岛海信电器股份有限公司 Gamma debugging method, device and system of liquid crystal display terminal
CN102096823A (en) * 2011-02-12 2011-06-15 厦门大学 Face detection method based on Gaussian model and minimum mean-square deviation
CN104598914A (en) * 2013-10-31 2015-05-06 展讯通信(天津)有限公司 Skin color detecting method and device
CN107369133A (en) * 2016-05-13 2017-11-21 炬芯(珠海)科技有限公司 A kind of facial image beautification method and device
KR20180038857A (en) * 2016-10-07 2018-04-17 삼성전기주식회사 Visual inspection apparatus and method of optical calibration of the same
CN106845455A (en) * 2017-03-01 2017-06-13 中国科学院上海高等研究院 Image processing method, system and server based on Face Detection
CN107480607A (en) * 2017-07-28 2017-12-15 青岛大学 A kind of method that standing Face datection positions in intelligent recording and broadcasting system
CN109359531A (en) * 2018-09-12 2019-02-19 仲恺农业工程学院 Fruit harvesting area automatic positioning method facing natural scene
CN109214363A (en) * 2018-10-23 2019-01-15 广东电网有限责任公司 A kind of substation's worker's face identification method based on YCbCr and connected component analysis
CN110222555A (en) * 2019-04-18 2019-09-10 江苏图云智能科技发展有限公司 The detection method and device of area of skin color

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
WANG, HUAN 等: "Perceptual Hashing-Based Image Copy-Move Forgery Detection", 《SECURITY AND COMMUNICATION NETWORKS》, 22 January 2018 (2018-01-22) *
李坤波: "多光谱和全色遥感图像融合技术研究", 《中国优秀硕士学位论文全文数据库 (信息科技辑)》, no. 2, 15 February 2012 (2012-02-15) *
王海林;雷跃峰;陈钰;: "基于肤色模型的机动车驾驶员面部定位的研究", 机械科学与技术, no. 01, 15 January 2008 (2008-01-15) *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113870404A (en) * 2021-09-23 2021-12-31 聚好看科技股份有限公司 Skin rendering method and device of 3D model
CN113870404B (en) * 2021-09-23 2024-05-07 聚好看科技股份有限公司 Skin rendering method of 3D model and display equipment
CN113947606A (en) * 2021-09-26 2022-01-18 北京达佳互联信息技术有限公司 Image processing method, image processing device, electronic equipment and storage medium
CN113947606B (en) * 2021-09-26 2024-03-26 北京达佳互联信息技术有限公司 Image processing method, device, electronic equipment and storage medium
CN115587948A (en) * 2022-10-12 2023-01-10 青岛海信医疗设备股份有限公司 Image dark field correction method and device

Similar Documents

Publication Publication Date Title
CN106845455B (en) Image processing method, system and server based on skin color detection
KR101554403B1 (en) Image processing device, image processing method, and recording medium for control program
CN107451969B (en) Image processing method, image processing device, mobile terminal and computer readable storage medium
CN108197546B (en) Illumination processing method and device in face recognition, computer equipment and storage medium
CN107392858B (en) Image highlight area processing method and device and terminal equipment
KR101446975B1 (en) Automatic face and skin beautification using face detection
KR101437195B1 (en) Detecting block artifacts in coded image and video
JP4870617B2 (en) Image data automatic mapping method and image processing device
JP4870618B2 (en) Image data automatic mapping method and image processing device
US7822272B2 (en) Adaptive histogram equalization for images with strong local contrast
CN112541860A (en) Skin color beautifying correction method and device
TWI573095B (en) Image enhancement methods and systems using the same
WO2013168618A1 (en) Image processing device and image processing method
US9007484B2 (en) Alleviating dominant color failure in automatic white balance using histogram trimming
KR102084343B1 (en) Background removal
WO2014133844A1 (en) Multi-spectral imaging system for shadow detection and attenuation
CN112614060A (en) Method and device for rendering human face image hair, electronic equipment and medium
WO2012000800A1 (en) Eye beautification
US9378564B2 (en) Methods for color correcting digital images and devices thereof
CN107369133A (en) A kind of facial image beautification method and device
CN111968065A (en) Self-adaptive enhancement method for image with uneven brightness
CN115456905A (en) Single image defogging method based on bright and dark region segmentation
US9384561B2 (en) Method of selecting a region of interest
CN107424134B (en) Image processing method, image processing device, computer-readable storage medium and computer equipment
JP5327766B2 (en) Memory color correction in digital images

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination