Human face skin pigmentation analysis method, system and computer readable storage medium
By segmenting the skin area of the human face and enhancing the color deposition area of the test pictures, a facial skin pigmentation analysis report was generated, which solved the problem of insufficient detection accuracy and convenience in the prior art, and achieved efficient and accurate skin pigmentation analysis.
Patent Information
- Application Number
- CN202311128373.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-31
- Publication Date
- 2025-05-23
- Estimated Expiration
- 2043-08-31
AI Technical Summary
The prior art is difficult to ensure the accuracy and convenience of detection in skin pigmentation analysis, especially in oil-light zone detection.
By obtaining the pictures to be detected, the skin area of the human face is divided, the skin picture is enhanced by using the color sinking area enhancement algorithm to obtain the color sinking grayscale map, and quantitatively analyze it and render the brown area map to generate a facial skin pigmentation analysis report.
It realizes that the face skin pigmentation analysis report is generated through image recognition without the need for special detection equipment, which improves the accuracy and convenience of detection.
Smart Images

Figure CN117173259B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the fields of image processing and skin detection, and in particular to a facial skin pigmentation analysis method, system and computer-readable storage medium. Background Art
[0002] Pigmentation is a change in the color, range and depth of human skin due to various reasons. Common pigmentation is the increase of pigment in the epidermis or dermis, which causes the skin lesions to not fade when pressed.
[0003] Skin pigmentation analysis mainly analyzes skin problems such as darkening of the skin and spots caused by excessive skin pigmentation. The vast majority of hyperpigmented facial spots are benign, but in some rare cases, hyperpigmented spots can indicate more serious skin conditions. Among them, "hyperpigmented" and "hyperpigmented spots" mean a localized part of the skin with a relatively high melanin content compared to nearby parts of the skin in the same general area of the body. Examples of hyperpigmented spots include, but are not limited to, age spots, dark spots, chloasma, freckles, post-inflammatory hyperpigmentation, sun-induced pigmentation blemishes, etc.
[0004] Therefore, how to ensure the accuracy of skin pigmentation analysis while improving the convenience of detection has become an urgent problem to be solved. Summary of the invention
[0005] The embodiments of the present application provide a facial skin pigmentation analysis method, system, and computer-readable storage medium to solve or partially solve the problem of how to improve the efficiency and accuracy of oily area detection.
[0006] A method for analyzing facial skin pigmentation, comprising:
[0007] Obtain a picture to be detected, and segment the face skin area based on the picture to be detected to obtain a skin picture;
[0008] The skin image is enhanced using the color sink area enhancement algorithm to obtain a color sink grayscale image;
[0009] The pigmentation grayscale image is quantitatively analyzed to obtain a quantitative evaluation, and the pigmentation grayscale image is rendered using a brown area image rendering algorithm to generate a facial skin pigmentation analysis report based on the quantitative evaluation and the rendered pigmentation grayscale image.
[0010] In a preferred example, the present application can be further configured to: use a brown area image rendering algorithm to render the color sink grayscale image, including:
[0011] Get the preset reference color RGB parameters;
[0012] Convert the preset reference color RGB parameters into HSV color space to obtain HSV parameters;
[0013] Based on the HSV parameters, a brown reference image is generated, and the saturation of the brown reference image is processed to obtain a color sink image, which is used to generate a facial skin pigmentation analysis report.
[0014] In a preferred example, the present application can be further configured as follows: using a color sink area enhancement algorithm to enhance the skin image to obtain a color sink grayscale image, including:
[0015] Grayscale the skin image to generate a skin grayscale image;
[0016] The skin grayscale image is enhanced using the color sink area enhancement algorithm to obtain a color sink grayscale image.
[0017] In a preferred example, the present application can be further configured to: process the saturation of the brown reference image, including:
[0018] The saturation of the brown reference image is processed using a saturation processing formula, specifically including:
[0019] s = 255-gray;
[0020] Among them, s represents the saturation of the brown reference image, and gray represents each pixel value of the color grayscale image.
[0021] In a preferred example, the present application can be further configured as follows: segmenting the face skin area based on the image to be detected to obtain a skin image, including:
[0022] Based on the face skin region segmentation model, the image to be detected is segmented into multiple areas to be detected, and multiple segmented images corresponding to the multiple areas to be detected are obtained;
[0023] Skin detection is performed on multiple segmented images to obtain the facial skin area where the face in the segmented image is located, which is used to obtain the skin image.
[0024] In a preferred example, the present application can be further configured as follows: performing skin detection on multiple segmented images to obtain a human face skin region where the face in the segmented image is located, including:
[0025] Perform facial key point detection on the segmented image to obtain the facial key points of the segmented image;
[0026] Based on the facial key points, the facial skin area where the face is located in the segmented image is obtained to generate a skin image.
[0027] In a preferred example, the present application can be further configured as follows: after performing skin detection on multiple segmented images to obtain the human face skin area where the face in the segmented images is located, the method includes:
[0028] Perform erosion or dilation operations on the skin area of the face;
[0029] Calculate the variance of the skin area of the face after corrosion or dilation operation to remove non-skin areas.
[0030] In a preferred example, the present application can be further configured as follows: after obtaining the image to be detected, the following steps are included:
[0031] Perform image preprocessing on the image to be detected, including face orientation correction, edge cropping, and / or enhancing the contrast between the face skin color and the background.
[0032] The second purpose of this application is to provide a facial skin pigmentation analysis system.
[0033] The second application objective of the present application is achieved through the following technical solutions:
[0034] A facial skin pigmentation analysis system, comprising:
[0035] A skin image acquisition module is used to acquire a picture to be detected and segment the facial skin area based on the picture to be detected to obtain a skin image;
[0036] A color sink grayscale image acquisition module is used to enhance the skin image using a color sink area enhancement algorithm to obtain a color sink grayscale image;
[0037] The analysis report generation module is used to perform quantitative analysis on the pigmentation grayscale image, obtain a quantitative evaluation, and render the pigmentation grayscale image using a brown area image rendering algorithm, so as to generate a facial skin pigmentation analysis report based on the quantitative evaluation and the rendered pigmentation grayscale image.
[0038] A computer-readable storage medium stores a computer program, which implements the above-mentioned facial skin pigmentation analysis method when executed by a processor.
[0039] In summary, this application includes the following beneficial technical effects:
[0040] The above-mentioned facial skin pigmentation analysis method obtains a picture to be detected, and segments the facial skin area according to the picture to be detected to obtain a skin picture; uses a pigmentation area enhancement algorithm to enhance the skin picture to obtain a pigmentation grayscale map; performs quantitative analysis on the pigmentation grayscale map to obtain a quantitative evaluation, and uses a brown area rendering algorithm to render the pigmentation grayscale map, and then performs quantitative evaluation on the pigmentation grayscale map, and generates a facial skin pigmentation analysis report in combination with the rendered pigmentation grayscale map. This method does not require the use of special detection equipment, and can generate a facial skin pigmentation analysis report only by recognizing the image. While ensuring the detection accuracy of the facial skin pigmentation area, the detection process is convenient and fast. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0042] Figure 1 A flowchart of a method for analyzing facial skin pigmentation in one embodiment of the present application is shown;
[0043] Figure 2 A picture to be detected in a method for analyzing facial skin pigmentation in one embodiment of the present application is shown;
[0044] Figure 3 A skin picture illustrating a method for analyzing facial skin pigmentation in an embodiment of the present application;
[0045] Figure 4 The overall flow chart of the method for analyzing facial skin pigmentation in one embodiment of the present application is shown;
[0046] Figure 5 A skin grayscale diagram illustrating a method for analyzing facial skin pigmentation in an embodiment of the present application;
[0047] Figure 6 A grayscale diagram showing a method for analyzing facial skin pigmentation in an embodiment of the present application is shown;
[0048] Figure 7 A color chart showing a method for analyzing facial skin pigmentation in an embodiment of the present application is shown;
[0049] Figure 8 A schematic diagram of a facial skin pigmentation analysis system according to an embodiment of the present application is shown;
[0050] Fig. 9 An overall schematic diagram of a facial skin pigmentation analysis system in one embodiment of the present application is shown;
[0051] Fig.10 A schematic diagram of a UI interface of an electronic device in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0052] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are described in detail below in conjunction with the accompanying drawings. In the following description, many specific details are set forth to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without violating the connotation of the present application, so the present application is not limited by the specific embodiments disclosed below.
[0053] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations on the present application. As used in the specification and appended claims of the present application, the singular expressions "one", "a kind", "said", "above", "the" and "this" are intended to also include plural expressions, unless there is a clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present application refers to and includes any or all possible combinations of one or more listed items.
[0054] The embodiments of the present application are further described in detail below in conjunction with the drawings in the specification.
[0055] Example 1
[0056] The present application embodiment provides a method for analyzing facial skin pigmentation, and the main process of the method is described as follows:
[0057] Please refer to Figure 1 , S10, obtaining a picture to be detected, and segmenting the face skin area based on the picture to be detected to obtain a skin picture.
[0058] Specifically, in this embodiment, a picture shooting device can be used to shoot the human face skin at close range to obtain the picture to be detected, and then the picture to be detected can be identified, wherein there is no special requirement for the light source, and it is best to be under natural light to avoid obvious reflections, such as an RGB color image of a person's face, wherein RGB represents the colors of the three color channels of red (R), green (G), and blue (B). The picture to be detected can usually include a facial area, and of course, can include other facial skin areas. The face picture in this embodiment can be a facial test picture of a user of any age and any gender.
[0059] In this embodiment, the image to be detected can be pre-input into the system database, and the image can be directly obtained from the system database during the image processing. Figure 2 The picture to be tested is shown.
[0060] In this embodiment, a color matching method or a deep learning segmentation method is used to segment the facial skin area in the image to be detected. It should be known that there are many methods for segmenting the facial skin area in the image to be detected. This embodiment takes two of the methods as examples for explanation.
[0061] Among them, the color matching method uses the inRange method of openCV to match the color interval. First, the color value of the RGB color space of the image to be detected is converted to the HSV color space, and then a skin color interval is set, for example, lower = [0, 20, 70], higher = [20, 255, 255], and then a mask image is obtained. Then, the mask image and the original image to be detected are used for an "AND" operation to segment the skin area of the face and obtain a skin image.
[0062] The deep learning instance segmentation method is customized through training a specific skin segmentation model. The specific operation is to prepare a batch of pictures to be detected, and then use a labeling tool to circle the edges of the facial skin in the pictures to be detected.
[0063] In addition to skin, this embodiment can also circle the eyes, hair and other facial features to form a sample set for instance segmentation, and then use the sample set to train a prediction model, and then use the prediction model to predict the image to be detected, so as to obtain the segmented image. Figure 3 Skin picture shown.
[0064] Specifically, the deep learning instance segmentation method is to obtain a facial skin area segmentation model by custom training through a segmentation model of a specific training skin. In this embodiment, the segmentation model of the specific training skin can be selected from the UNet model. First, the encoder in the convolutional neural network UNet is used to extract features to obtain a high-level semantic feature map; then the decoder is used to restore the feature map to its original size. In the training stage, a loss function is constructed by combining the prediction map output by the model with the true label map of the sample to perform model training. In the inference stage, the prediction map of the model, that is, the skin picture, is used as the final output.
[0065] Specifically, the segmentation model for the specific training skin in this embodiment can also use the YOLO model. First, the image to be detected is divided into grids, each grid is responsible for detecting a target, and then the feature vector is extracted, which represents the characteristics of the target in the grid. Then the bounding box and category are predicted. For each grid, a fully connected layer is used to predict one or more bounding boxes, as well as the possible category and confidence score of each bounding box. Finally, for each target, the bounding box with the highest confidence is selected, and then, the duplicate bounding boxes are removed according to the non-maximum suppression algorithm and the final target box is selected to obtain the skin area of the face.
[0066] Among them, the YOLO model consists of the following parts:
[0067] Input — the input layer to which the input image is fed;
[0068] Backbone — the part of the input image that is encoded in the form of features;
[0069] Neck — This is the rest of the model that processes the image encoded by the features;
[0070] Head(s) – One or more output layers that produce the model’s predictions.
[0071] In this model architecture, the image to be detected is divided into S×S cells, and each cell predicts B bounding boxes (bbox) and the confidence of the existence of any object in these bounding boxes, as well as the probability that the object belongs to category C. The number of cells on each side is odd, so there is one cell in the center of the image. This is better than an even number because there is usually a main subject in the center of the photo. The main prediction is made in the center cell.
[0072] The confidence value represents how confident the model is that a given bounding box contains an object and how accurately the bounding box predicts its location. If there is no object in the cell, the confidence is zero.
[0073] The composite function form of the loss function is:
[0074]
[0075] Among them, the first term is the loss of the object center coordinates, the second term is the dimension of the bbox, the third term is the category of the object, the fourth term is the category when the object does not exist, and the fifth term is the probability loss of finding an object in the bbox. 1(obj,i) indicates whether the center of the object appears in cell i, and 1(obj,i,j) indicates that the jth bbox in cell i is responsible for this prediction.
[0076] The purpose of step S10 is to facilitate the extraction of the effective part of the image to be detected in the subsequent detection process, thereby improving the accuracy and reliability of facial skin pigmentation analysis.
[0077] S20, using a color sink area enhancement algorithm to enhance the skin image to obtain a color sink grayscale image.
[0078] Specifically, this embodiment adopts the CLAHE algorithm (Contrast Limited Adaptive Histogram Equalization, histogram equalization algorithm), first reads the skin image, then sets the corresponding parameters such as contrast limit and grid number to clipLimit=5.0, tileGridSize=(8.8), and then calls the adapthisteq function to enhance the skin image, and finally obtains the color grayscale image.
[0079] The CLAHE algorithm is an adaptive histogram equalization algorithm that can effectively enhance the contrast and details of an image and avoid the problems of over-enhancement and noise amplification that occur in traditional histogram equalization algorithms. The implementation steps are as follows:
[0080] 1. Divide the original image into several sub-blocks of the same size, each of which is N×N in size.
[0081] 2. Perform histogram equalization on each sub-block to obtain a balanced sub-block so that the pixel value distribution of each sub-block is more uniform.
[0082] 3. Clip the grayscale value of the central pixel of each sub-block to avoid over-enhancement of the entire image. Specifically, for each pixel, calculate the mean and standard deviation of the pixels around it. If the value of the pixel exceeds the mean plus a limiting factor multiplied by the standard deviation, set the value of the pixel to the mean plus the limiting factor multiplied by the standard deviation.
[0083] 4. Concatenate all sub-blocks into an enhanced image.
[0084] 5. According to actual needs, the interpolation algorithm can be used to enlarge the enhanced image.
[0085] The role of step S20 is to enhance the contrast of the image while suppressing noise, thereby improving the accuracy and reliability of facial skin pigmentation analysis.
[0086] S30, quantitatively analyzing the pigmentation grayscale image to obtain a quantitative evaluation, and rendering the pigmentation grayscale image using a brown area image rendering algorithm, so as to generate a facial skin pigmentation analysis report based on the quantitative evaluation and the rendered pigmentation grayscale image.
[0087] Among them, this embodiment performs quantitative analysis on the color sink grayscale image, mainly including the color sink area ratio and the color sink severity analysis. Among them, the color sink area ratio = the number of pixels with grayscale values less than 160 / the total number of pixels, and the color sink severity = the sum of the pixel values with grayscale values less than 160 / the number of pixels with grayscale values less than 160.
[0088] Specifically, this embodiment uses a pixel analysis tool to obtain the number of pixels with grayscale values less than 160 and the total number of pixels, and performs a "sum" operation on the pixel values with grayscale values less than 160 to obtain the sum of the pixel values with grayscale values less than 160, and then uses the color sink area ratio formula and the color sink severity formula to calculate various color sink indicators.
[0089] This embodiment uses the brown area map rendering algorithm to first obtain the preset reference color RGB parameters. Then the preset reference color RGB parameters are converted into the HSV color space to obtain HSV parameters. This embodiment then generates a brown reference map based on the HSV parameters, and uses a saturation processing formula to process the saturation of the brown reference map, thereby obtaining a color sink map for generating a facial skin pigmentation analysis report. The saturation processing formula specifically includes:
[0090] s=255-gray
[0091] Among them, s represents the saturation of the brown reference image, and gray represents each pixel value of the color grayscale image.
[0092] The function of step S30 is to quantitatively measure the facial skin pigmentation area in the pigmentation grayscale image, thereby improving the accuracy and reliability of facial skin pigmentation analysis.
[0093] The above-mentioned facial skin pigmentation analysis method obtains a picture to be detected, and segments the facial skin area according to the picture to be detected to obtain a skin picture; enhances the skin picture using a pigmentation area enhancement algorithm to obtain a pigmentation grayscale map; performs quantitative analysis on the pigmentation grayscale map to obtain a quantitative evaluation, and uses a brown area rendering algorithm to render the pigmentation grayscale map, and then generates a facial skin pigmentation analysis report through the quantitative evaluation and the rendered pigmentation grayscale map. This method does not require the use of special detection equipment, and can generate a facial skin pigmentation analysis report only by recognizing the image. While ensuring the detection accuracy of the facial skin pigmentation area, the detection process is convenient and fast.
[0094] Example 2
[0095] See also Figure 4 In some possible embodiments, step S10, i.e., segmenting the facial skin area based on the image to be detected to obtain a skin image, includes:
[0096] S11. Based on the face skin region segmentation model, the image to be detected is segmented into multiple areas to be detected, and multiple segmented images corresponding to the multiple areas to be detected are obtained.
[0097] S12. Perform skin detection on the multiple segmented images to obtain the facial skin area where the face in the segmented images is located, which is used to obtain the skin image.
[0098] Specifically, this embodiment uses the facial skin area segmentation model obtained after training to segment the image to be detected into multiple areas to be detected, obtains multiple segmented images corresponding to the multiple areas to be detected, and then performs skin detection on the multiple segmented images. Specifically, this embodiment performs facial key point detection on the segmented images to obtain the facial key points of the segmented images, and based on the facial key points, obtains the facial skin area where the face in the segmented image is located, and then generates a skin image.
[0099] The purpose of step S11 and step S12 is to improve the efficiency of processing the image to be detected by performing regional detection on the image to be detected, thereby improving the accuracy and reliability of facial skin pigmentation analysis.
[0100] Example 3
[0101] In some possible embodiments, step S12, i.e., performing skin detection on a plurality of segmented images to obtain a human face skin region where a face in the segmented images is located, includes:
[0102] S121, performing facial key point detection on the segmented image to obtain facial key points of the segmented image.
[0103] S122. Based on the facial key points, a facial skin region where the face in the segmented image is located is obtained for generating a skin image.
[0104] This embodiment uses Dlib's frontal face detector get_frontal_face_detector() to detect facial key points on the segmented image, extract facial key points, and mark the facial key points to obtain key point positioning information. The facial key point positioning information includes information such as the coordinates and area of the facial key points, and then obtains the facial skin area where the face in the segmented image is located, and then reorganizes the facial skin area according to the obtained facial key points to obtain a skin image.
[0105] The purpose of step S121 and step S122 is to locate the key areas of the face in the segmented image, reduce the influence of face posture, occlusion and light, and improve the accuracy and robustness of facial skin pigmentation analysis.
[0106] Example 4
[0107] In some possible embodiments, after step S12, that is, after performing skin detection on a plurality of segmented images to obtain the facial skin region where the face in the segmented image is located, the following steps are included:
[0108] S13, performing corrosion or expansion operations on the facial skin area.
[0109] S14. Calculate the variance of the skin area of the face after the corrosion or dilation operation, and use it to remove the non-skin area.
[0110] Furthermore, since skin color is not unique in distinguishing from the colors of other objects, the face skin region segmented by the face skin region segmentation model in this embodiment may still contain other skin color-like pixels. In this case, the face skin region needs to be processed, namely:
[0111] (1) Corrosion or dilation operations are performed on the facial skin area to remove the influence of noise on skin color segmentation;
[0112] (2) For the facial skin area, since the facial skin area contains non-skin areas such as eyes, nose, and mouth, its variance is larger than that of the human face areas such as hands and arms with uniform color. Therefore, this embodiment can eliminate non-skin areas such as hands and arms by calculating the variance of the skin color area.
[0113] The role of step S13 and step S14 is to further process the facial skin area, thereby improving the accuracy of the segmented image and further improving the accuracy of the facial skin pigmentation analysis.
[0114] Example 5
[0115] In some possible embodiments, after step S10, that is, after obtaining the image to be detected, the following steps are included:
[0116] S40, performing image preprocessing on the image to be detected, including face orientation correction, edge cropping, and / or enhancing the contrast between the face skin color and the background.
[0117] The face orientation correction in this embodiment is determined based on the angle between the lines connecting the centers of both eyes in the horizontal direction. The rotation of the image is achieved through interpolation, and the change in angle will cause the image to change, so the position of the center of the eye of the rotated image may change, and the tilt of the orientation will also affect the positioning of the eye itself. Therefore, in this embodiment, the face orientation correction is achieved through repeated eye positioning and rotation until the deflection angle is zero.
[0118] The process of face orientation correction:
[0119] 1. Positioning of both eyes, obtaining the coordinates of the center of both eyes (L x ,L y ) and (R x ,R y );
[0120] 2. After the center position of both eyes is determined, if the two eyes are not on the same horizontal line, there is an angle θ between the center line of both eyes and the horizontal direction.
[0121] 3. If θ=0, it indicates that the two eyes are already on a horizontal line, and no rotation is performed. Otherwise, rotation is performed. In this embodiment, linear interpolation can be used to rotate the image.
[0122] In this embodiment, an image is rotated to obtain a rotated image, on which basis the two eyes are repositioned to obtain their coordinate values, and the angle θ between the line connecting the two eyes and the horizontal direction is recalculated. If θ=0, it means that the two eyes are already on a horizontal line. Otherwise, the above steps are repeated to rotate the image until θ=0.
[0123] The purpose of step S40 is to improve the reliability and accuracy of the face image by performing face orientation correction, edge cropping and / or enhancing the contrast between the face skin color and the background on the image to be detected, thereby further improving the accuracy and reliability of the facial skin pigmentation analysis.
[0124] Example 6
[0125] In some possible embodiments, step S20, i.e., using a color sink area enhancement algorithm to enhance the skin image to obtain a color sink grayscale image, includes:
[0126] S21, graying the skin image to generate a skin grayscale image.
[0127] S22. Enhance the skin grayscale image using a color sink area enhancement algorithm to obtain a color sink grayscale image.
[0128] Specifically, this embodiment uses grayscale image threshold segmentation to grayscale the skin image to generate Figure 5 The skin grayscale image shown. Grayscale image threshold segmentation is a commonly used image processing method. Its basic idea is to divide a grayscale image into two parts: one part is the pixels in the image whose pixel values are greater than a certain threshold, and the other part is the pixels whose pixel values are less than or equal to the threshold. This process can be regarded as the process of separating the foreground and background in the image, which can be used in image segmentation, target detection, character recognition and other fields. This embodiment uses the CLAHE algorithm (Contrast Limited Adaptive Histogram Equalization) to enhance the skin grayscale image, and then obtains the following Figure 6 Grayscale diagram of color sink shown.
[0129] The purpose of step S21 and step S22 is to further process the skin grayscale image so that the obtained pigmentation grayscale image is more reliable and intuitive, thereby improving the accuracy, reliability and professionalism of facial skin pigmentation analysis.
[0130] Example 7
[0131] In some possible embodiments, step S30, namely rendering the pigmentation grayscale image using the brown area map rendering algorithm, includes:
[0132] S31. Obtain the preset reference color RGB parameters.
[0133] S32. Convert the preset reference color RGB parameters into the HSV color space to obtain the HSV parameters.
[0134] S33. Generate a brown reference map based on the HSV parameters, and process the saturation of the brown reference map to obtain the pigmentation map, which is used to generate the analysis report of human face skin pigmentation.
[0135] Specifically, in this embodiment, a preset reference color RGB parameter for brown is [153, 84, 31]. It should be noted that the preset reference color RGB parameter for brown can also be other similar values as long as the color is brown. Then, in this embodiment, the preset reference color RGB parameters are converted into the HSV color space to obtain the HSV parameters. Then, a brown reference map with the same width and height as the pigmentation grayscale image is generated according to the HSV parameters, and the saturation of the brown reference map is processed through the saturation processing formula, and then the pigmentation map as shown in Figure 7 is obtained. The saturation mentioned here is the S channel. Finally, the obtained pigmentation map is used to generate the analysis report of human face skin pigmentation so that the user can obtain appropriate skin suggestions according to the analysis report of human face skin pigmentation.
[0136] The functions of steps S31 to S33 are to further process the pigmentation grayscale image and the brown reference map, making the obtained pigmentation map more professional, and improving the accuracy, reliability and professionalism of the analysis of human face skin pigmentation.
[0137] Embodiment 8
[0138] In some possible embodiments, step S33, namely processing the saturation of the brown reference map, includes:
[0139] S331. Process the saturation of the brown reference map using the saturation processing formula, specifically including:
[0140] s = 255 - gray.
[0141] Where s represents the saturation of the brown reference map, and gray represents the pixel values of the pigmentation grayscale image.
[0142] The function of step S331 is to be able to give a fair and objective evaluation for the analysis data of human face skin pigmentation, and improve the accuracy, reliability and professionalism of the analysis of human face skin pigmentation.
[0143] The method for analyzing facial skin pigmentation provided in this embodiment is as follows: Figure 4 As shown, the method improves the processing efficiency of the image to be detected by performing regional detection on the image to be detected, thereby improving the accuracy and reliability of the facial skin pigmentation analysis. This embodiment can also locate the position of the key area of the face in the segmented image, reduce the influence of facial posture, occlusion, light, etc., and improve the accuracy and robustness of the facial skin pigmentation analysis; by correcting the facial orientation, edge cropping and / or enhancing the contrast between the facial skin color and the background on the image to be detected, the reliability and accuracy of the facial image are improved, and the accuracy and reliability of the facial skin pigmentation analysis are further improved; by further processing the color sink grayscale map and the brown reference map, the obtained color sink map is made more professional, and the accuracy, reliability and professionalism of the facial skin pigmentation analysis are improved.
[0144] Another embodiment of the present application discloses a facial skin pigmentation analysis system.
[0145] Reference Figure 8 , the facial skin pigmentation analysis system includes:
[0146] The skin image acquisition module 10 is used to acquire the image to be detected, and segment the facial skin area based on the image to be detected to obtain the skin image.
[0147] The module 20 for obtaining a color sink grayscale image is used to enhance the skin image using a color sink area enhancement algorithm to obtain a color sink grayscale image.
[0148] The analysis report generation module 30 is used to perform quantitative analysis on the pigmentation grayscale image to obtain a quantitative evaluation, and to render the pigmentation grayscale image using a brown area image rendering algorithm, so as to generate a facial skin pigmentation analysis report based on the quantitative evaluation and the rendered pigmentation grayscale image.
[0149] Furthermore, if Fig. 9 As shown, the skin image obtaining module 10 includes:
[0150] The submodule 11 for obtaining segmented images is used to segment the image to be detected into a plurality of regions to be detected based on the face skin region segmentation model, and obtain a plurality of segmented images corresponding to the plurality of regions to be detected.
[0151] The facial skin region obtaining submodule 12 is used to perform skin detection on a plurality of segmented images, and obtain the facial skin region where the face in the segmented images is located, so as to obtain the skin image.
[0152] Furthermore, if Fig. 9 As shown, the facial skin region obtaining submodule 12 includes:
[0153] The facial key point obtaining unit 121 is used to detect facial key points on the segmented image to obtain facial key points of the segmented image.
[0154] The facial skin region obtaining unit 122 is used to obtain the facial skin region where the face in the segmented image is located based on the facial key points, so as to generate a skin image.
[0155] Furthermore, if Fig. 9 As shown, the skin image obtaining module 10 includes:
[0156] The corrosion or expansion processing submodule 13 is used to perform corrosion or expansion operations on the skin area of the face.
[0157] The variance calculation submodule 14 is used to calculate the variance of the skin area of the face after the corrosion or dilation operation, so as to eliminate the non-skin area.
[0158] Furthermore, if Fig. 9 As shown, the facial skin pigmentation analysis system includes:
[0159] The image preprocessing module 40 is used to perform image preprocessing on the image to be detected, including face orientation correction, edge cropping and / or enhancing the contrast between the face skin color and the background.
[0160] Furthermore, if Fig. 9 As shown, the module 20 for obtaining a color sink grayscale image includes:
[0161] The skin grayscale image generation submodule 21 is used to grayscale the skin image to generate a skin grayscale image.
[0162] The color sink grayscale image acquisition submodule 22 is used to enhance the skin grayscale image by using a color sink area enhancement algorithm to obtain a color sink grayscale image.
[0163] Furthermore, if Fig. 9 As shown, the analysis report generation module 30 includes:
[0164] The parameter acquisition submodule 31 is used to acquire the preset reference color RGB parameters.
[0165] The HSV parameter obtaining submodule 32 is used to convert the preset reference color RGB parameters into the HSV color space to obtain the HSV parameters.
[0166] The color sink map obtaining submodule 33 is used to generate a brown reference map based on HSV parameters, and process the saturation of the brown reference map to obtain a color sink map for generating a facial skin pigmentation analysis report.
[0167] Furthermore, if Fig. 9 As shown, the color sink map obtaining submodule 33 includes:
[0168] The saturation processing unit 331 is used to process the saturation of the brown reference image using a saturation processing formula, specifically including:
[0169] s=255-gray.
[0170] Among them, s represents the saturation of the brown reference image, and gray represents each pixel value of the color grayscale image.
[0171] The facial skin pigmentation analysis system provided in this embodiment can implement the various steps of the aforementioned embodiments due to the functions of its modules themselves and the logical connections between each other, and thus can achieve the same technical effects as the aforementioned embodiments. The principle analysis can be found in the relevant description of the steps of the aforementioned facial skin pigmentation analysis method, which will not be repeated here.
[0172] For the specific definition of the facial skin pigmentation analysis system, please refer to the definition of the facial skin pigmentation analysis method above, which will not be repeated here. Each module in the above facial skin pigmentation analysis system can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the device in the form of hardware, or stored in the memory in the device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0173] In one embodiment, an electronic device is provided. The electronic device may include a processor, an external memory interface, an internal memory, a universal serial bus (USB) interface, a charging management module, a power management module, a battery, an antenna, a wireless communication module, an audio module, a speaker, a receiver, a microphone, a headphone interface, a sensor module, a button, an indicator, a camera, and a display screen. The sensor module includes an ambient light sensor. In addition, the sensor module may also include a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, a bone conduction sensor, and the like. In other embodiments, the electronic device in the embodiment of the present application may also include a mobile communication module, and a subscriber identification module (SIM) card interface, and the like. The functions of the above modules or devices are prior art and will not be repeated here.
[0174] The application programs supported by the electronic device in the embodiments of the present application may include photo-taking applications, such as a camera.
[0175] The applications supported by the electronic device in the embodiment of the present application may also include an application for facial skin pigmentation analysis. The application for facial skin pigmentation analysis detects the pigmentation area of the user's facial skin by taking a picture to be detected, and can provide an analysis report for the user.
[0176] The application for facial skin pigmentation analysis in this embodiment can adopt the facial skin pigmentation analysis method provided in other embodiments of the present application to detect the pigmentation area on the skin.
[0177] This embodiment takes the electronic device as a mobile phone as an example. In specific operations, Fig.10 shown.
[0178] like Fig.10 As shown in A, the electronic device detects a click operation on the skin detection icon, and in response to the operation on the icon, the electronic device displays a user interface of the skin detection application on the display screen, such as Fig.10 As shown in B. In this interface, a camera icon is included.
[0179] The electronic device detects the operation of the camera icon, and in response to the operation of the camera icon, calls the camera application on the electronic device to obtain the face picture to be detected. Of course, the user can also select a picture containing a face stored in the internal memory as the picture to be detected.
[0180] After the skin detection application receives the input image to be detected, it can use the facial skin pigmentation analysis method provided in other embodiments of the present application to detect the pigmentation area on the skin. In other embodiments, in addition to detecting the facial skin pigmentation area, it can also evaluate the dimensions such as pigment area ratio and pigmentation, and provide the user with a skin analysis report based on all the evaluations, such as Fig.10 As shown in C.
[0181] The skin analysis report can be presented to the user through the user interface of the electronic device. For example, the skin analysis report can provide a pigmentation and a pigmentation map (i.e., a rendered pigmentation grayscale map), and provide relevant skin care suggestions for the user's reference.
[0182] "Skin care" means regulating and / or improving the condition of the skin. Some non-limiting examples include improving the appearance and / or feel of the skin by providing a smoother, more even look and / or feel; increasing the thickness of one or more layers of the skin; improving the elasticity or resilience of the skin; improving the firmness of the skin; and reducing the oily, shiny and / or dull appearance of the skin, improving the hydration or moisturization of the skin, improving the appearance of fine lines and / or wrinkles, improving flaking or scaling of the skin, plumping the skin, improving skin barrier properties, improving skin tone, pigmentation, reducing the appearance of redness or skin rashes, and / or improving the brightness, radiance, or translucency of the skin.
[0183] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the method for analyzing facial skin pigmentation in the above embodiment is implemented, or when the computer program is executed by a processor, the functions of each module / unit in the system for analyzing facial skin pigmentation in the above system embodiment are implemented. To avoid repetition, it will not be described here.
[0184] It is clear to those skilled in the art that the embodiments of the present application can be implemented in hardware, firmware, or a combination thereof. When implemented using software, the above functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein the communication media include any medium that facilitates the transmission of a computer program from one place to another. The storage medium can be any available medium that a computer can access. Taking this as an example but not limited to: a computer-readable medium may include RAM, ROM, electrically erasable programmable read only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer.
[0185] In addition, any connection can be appropriately computer-readable media. For example, if the software is transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, wireless, and microwave are included in the fixation of the medium. As used in the embodiments of the present application, disks and discs include compact discs (CDs), laser discs, optical discs, digital video discs (DVDs), floppy disks, and Blu-ray discs, where disks usually copy data magnetically, while discs use lasers to optically copy data. The above combinations should also be included in the scope of protection of computer-readable media.
[0186] Those skilled in the art will clearly understand that for the sake of convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the system can be divided into different functional units or modules to complete all or part of the functions described above.
[0187] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A method for analyzing facial skin pigmentation, It is characterized in that include: Acquire a picture to be detected, and segment the face skin area based on the picture to be detected to obtain a skin picture; The skin image is enhanced by using a color sink area enhancement algorithm to obtain a color sink grayscale image; Performing quantitative analysis on the pigmentation grayscale image to obtain a quantitative evaluation, and rendering the pigmentation grayscale image using a brown area image rendering algorithm, so as to generate a facial skin pigmentation analysis report based on the quantitative evaluation and the rendered pigmentation grayscale image; The step of segmenting the facial skin region based on the image to be detected to obtain a skin image includes: segmenting the image to be detected into a plurality of regions to be detected based on a facial skin region segmentation model to obtain a plurality of segmented images corresponding to the plurality of regions to be detected; performing skin detection on the plurality of segmented images to obtain a facial skin region where the face in the segmented images is located, for obtaining a skin image; The step of performing skin detection on the plurality of segmented images to obtain the facial skin region where the face in the segmented images is located comprises: performing facial key point detection on the segmented images to obtain the facial key points of the segmented images; based on the facial key points, obtaining the facial skin region where the face in the segmented images is located, for generating the skin image; wherein, using a forward face detector to perform facial key point detection on the segmented images, extracting facial key points, and annotating the facial key points to obtain facial key point location information; wherein the facial key point location information includes the coordinates and area of the facial key points, thereby obtaining the facial skin region where the face in the segmented images is located, and then reorganizing the facial skin region according to the obtained facial key points to obtain the skin image; Performing quantitative analysis on the color sink grayscale image, including color sink area ratio and color sink severity analysis; wherein, color sink area ratio = number of pixels with grayscale values less than 160 / total number of pixels, color sink severity = sum of pixel values with grayscale values less than 160 / number of pixels with grayscale values less than 160; After performing skin detection on the multiple segmented images to obtain the facial skin area where the face in the segmented images is located, the method includes: performing corrosion or expansion operations on the facial skin area; calculating the variance of the facial skin area after the corrosion or expansion operations, so as to eliminate non-skin areas.
2. A method for analyzing facial skin pigmentation according to claim 1, It is characterized in that The step of rendering the color sink grayscale image using a brown area image rendering algorithm includes: Get the preset reference color RGB parameters; Convert the preset reference color RGB parameters into HSV color space to obtain HSV parameters; Based on the HSV parameters, a brown reference image is generated, and the saturation of the brown reference image is processed to obtain a color sink image for generating a facial skin pigmentation analysis report.
3. A method for analyzing facial skin pigmentation according to claim 1, It is characterized in that The step of enhancing the skin image using a color sink area enhancement algorithm to obtain a color sink grayscale image includes: Gray-scale the skin image to generate a skin grayscale image; The skin grayscale image is enhanced by using a color sink area enhancement algorithm to obtain a color sink grayscale image.
4. A method for analyzing facial skin pigmentation according to claim 2, It is characterized in that The processing of the saturation of the brown reference image includes: The saturation of the brown reference image is processed using a saturation processing formula, specifically including: s = 255-gray; Wherein, s represents the saturation of the brown reference image, and gray represents each pixel value of the color depth grayscale image.
5. A method for analyzing facial skin pigmentation according to claim 1, It is characterized in that After obtaining the image to be detected, the following steps are included: The image to be detected is subjected to image preprocessing, including face orientation correction, edge cropping and / or enhancing the contrast between the face skin color and the background.
6. A facial skin pigmentation analysis system, It is characterized in that include: A skin image acquisition module is used to acquire a picture to be detected, and segment the face skin area based on the picture to be detected to obtain a skin picture; A module for obtaining a color sink grayscale image is used to enhance the skin image using a color sink area enhancement algorithm to obtain a color sink grayscale image; A module for generating an analysis report is used to perform a quantitative analysis on the pigmentation grayscale image to obtain a quantitative evaluation, and to render the pigmentation grayscale image using a brown area image rendering algorithm, so as to generate a facial skin pigmentation analysis report based on the quantitative evaluation and the rendered pigmentation grayscale image; The skin image acquisition module includes: a segmentation image acquisition submodule, which is used to segment the image to be detected into multiple areas to be detected based on the face skin area segmentation model, and obtain multiple segmentation images corresponding to the multiple areas to be detected; a face skin area acquisition submodule, which is used to perform skin detection on the multiple segmentation images, and obtain the face skin area where the face in the segmentation image is located, so as to obtain the skin image; The submodule for obtaining the face skin region includes: a face key point obtaining unit, which is used to perform face key point detection on the segmented image to obtain the face key points of the segmented image; a face skin region obtaining unit, which is used to obtain the face skin region where the face in the segmented image is located based on the face key points, so as to generate the skin image; wherein, a forward face detector is used to perform face key point detection on the segmented image, extract face key points, and annotate the face key points to obtain face key point positioning information; wherein the face key point positioning information includes the coordinates and area of the face key points, so as to obtain the face skin region where the face in the segmented image is located, and then the face skin region is reorganized according to the obtained face key points to obtain the skin image; The system is also used to perform quantitative analysis on the color sink grayscale image, including color sink area ratio and color sink severity analysis; wherein, color sink area ratio = number of pixels with grayscale values less than 160 / total number of pixels, color sink severity = sum of pixel values with grayscale values less than 160 / number of pixels with grayscale values less than 160; The module for obtaining skin images includes: a corrosion or expansion processing submodule, which is used to perform corrosion or expansion operations on the skin area of the face; and a variance calculation submodule, which is used to calculate the variance of the skin area of the face after the corrosion or expansion operation, so as to eliminate non-skin areas.
7. A computer-readable storage medium storing a computer program, It is characterized in that When the computer program is executed by a processor, the method for analyzing facial skin pigmentation as described in any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Method for detecting skin colors and pigmentation situation of skin
CN106388781A
Method for extracting facial skin image pigmentation and forming brown region spectrum
CN113989137A